aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-05-10 13:43:04 +0200
committerChristian Grothoff <christian@grothoff.org>2018-05-10 13:43:04 +0200
commit4cb69d0abd7b44e57f3d0718ece5df05c33d4078 (patch)
treed832f6c422d102ac76ef9483bfa78a128bf8580c
parent5351d6b088a895b5c21577ec540f139f2d6d2467 (diff)
downloadgnunet-4cb69d0abd7b44e57f3d0718ece5df05c33d4078.tar.gz
gnunet-4cb69d0abd7b44e57f3d0718ece5df05c33d4078.zip
fix clean up logic in test_plugin_transport.c
-rw-r--r--src/transport/test_plugin_transport.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c
index d80a13410..2ef3a0ceb 100644
--- a/src/transport/test_plugin_transport.c
+++ b/src/transport/test_plugin_transport.c
@@ -582,19 +582,24 @@ run (void *cls,
582 &ok); 582 &ok);
583 cfg = c; 583 cfg = c;
584 /* parse configuration */ 584 /* parse configuration */
585 if ((GNUNET_OK 585 if ( (GNUNET_OK !=
586 != GNUNET_CONFIGURATION_get_value_number (c, "TRANSPORT", 586 GNUNET_CONFIGURATION_get_value_number (c,
587 "NEIGHBOUR_LIMIT", &tneigh)) 587 "TRANSPORT",
588 || (GNUNET_OK 588 "NEIGHBOUR_LIMIT",
589 != GNUNET_CONFIGURATION_get_value_filename (c, "PEER", "PRIVATE_KEY", 589 &tneigh)) ||
590 &keyfile))) 590 (GNUNET_OK !=
591 GNUNET_CONFIGURATION_get_value_filename (c,
592 "PEER",
593 "PRIVATE_KEY",
594 &keyfile)))
591 { 595 {
592 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 596 GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
593 "Transport service is lacking key configuration settings. Exiting.\n"); 597 "Transport service is lacking key configuration settings. Exiting.\n");
594 return; 598 return;
595 } 599 }
596 600
597 if (NULL == (stats = GNUNET_STATISTICS_create ("transport", cfg))) 601 if (NULL == (stats = GNUNET_STATISTICS_create ("transport",
602 cfg)))
598 { 603 {
599 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 604 GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
600 "Could not create statistics. Exiting.\n"); 605 "Could not create statistics. Exiting.\n");
@@ -739,9 +744,9 @@ run (void *cls,
739 end_badly_now (); 744 end_badly_now ();
740 return; 745 return;
741 } 746 }
742
743} 747}
744 748
749
745/** 750/**
746 * The main function for the test 751 * The main function for the test
747 * 752 *
@@ -750,23 +755,32 @@ run (void *cls,
750 * @return 0 ok, 1 on error 755 * @return 0 ok, 1 on error
751 */ 756 */
752int 757int
753main (int argc, char * const *argv) 758main (int argc,
759 char * const *argv)
754{ 760{
755 static struct GNUNET_GETOPT_CommandLineOption options[] = { 761 static struct GNUNET_GETOPT_CommandLineOption options[] = {
756 GNUNET_GETOPT_OPTION_END }; 762 GNUNET_GETOPT_OPTION_END
763 };
757 int ret; 764 int ret;
758 765 char * const argv_prog[] = {
759 GNUNET_DISK_directory_remove (GNUNET_DISK_mktemp("test-gnunetd-plugin-transport")); 766 "test_plugin_transport",
760 767 "-c",
761 char * const argv_prog[] = { "test_plugin_transport", "-c", 768 "test_plugin_transport_data.conf",
762 "test_plugin_transport_data.conf", NULL }; 769 NULL
763 GNUNET_log_setup ("test-plugin-transport", "WARNING", NULL ); 770 };
771
772 GNUNET_log_setup ("test-plugin-transport",
773 "WARNING",
774 NULL);
775 GNUNET_DISK_purge_cfg_dir ("test_plugin_transport_data.conf",
776 "GNUNET_TEST_HOME");
764 ok = 1; /* set to fail */ 777 ok = 1; /* set to fail */
765 ret = 778 ret =
766 (GNUNET_OK 779 (GNUNET_OK
767 == GNUNET_PROGRAM_run (3, argv_prog, "test-plugin-transport", 780 == GNUNET_PROGRAM_run (3, argv_prog, "test-plugin-transport",
768 "testcase", options, &run, (void *) argv)) ? ok : 1; 781 "testcase", options, &run, (void *) argv)) ? ok : 1;
769 GNUNET_DISK_directory_remove (GNUNET_DISK_mktemp("test-gnunetd-plugin-transport")); 782 GNUNET_DISK_purge_cfg_dir ("test_plugin_transport_data.conf",
783 "GNUNET_TEST_HOME");
770 return ret; 784 return ret;
771} 785}
772 786