diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-04-29 09:19:29 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-04-29 09:19:29 +0000 |
commit | 681ac3bc00480423462eab50ba7f4d0b22522c63 (patch) | |
tree | a1fd7128a8af245ea7679d1d01375589c7dee56c | |
parent | 610fe40c67d1b06cebbf4e63e5f6b9a4df38ec35 (diff) | |
download | gnunet-681ac3bc00480423462eab50ba7f4d0b22522c63.tar.gz gnunet-681ac3bc00480423462eab50ba7f4d0b22522c63.zip |
coverity warning fixes
-rw-r--r-- | src/testing/test_testing_topology.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c index 77f99018d..784c850f3 100644 --- a/src/testing/test_testing_topology.c +++ b/src/testing/test_testing_topology.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "gnunet_testing_lib.h" | 25 | #include "gnunet_testing_lib.h" |
26 | #include "gnunet_core_service.h" | 26 | #include "gnunet_core_service.h" |
27 | 27 | ||
28 | #define VERBOSE GNUNET_NO | 28 | #define VERBOSE GNUNET_YES |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * How long until we fail the whole testcase? | 31 | * How long until we fail the whole testcase? |
@@ -83,6 +83,8 @@ static int transmit_ready_called; | |||
83 | 83 | ||
84 | static enum GNUNET_TESTING_Topology topology; | 84 | static enum GNUNET_TESTING_Topology topology; |
85 | 85 | ||
86 | static char *test_directory; | ||
87 | |||
86 | #define MTYPE 12345 | 88 | #define MTYPE 12345 |
87 | 89 | ||
88 | struct GNUNET_TestMessage | 90 | struct GNUNET_TestMessage |
@@ -592,6 +594,12 @@ run (void *cls, | |||
592 | "Starting daemons based on config file %s\n", cfgfile); | 594 | "Starting daemons based on config file %s\n", cfgfile); |
593 | #endif | 595 | #endif |
594 | 596 | ||
597 | if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_string(cfg, "paths", "servicehome", &test_directory)) | ||
598 | { | ||
599 | ok = 404; | ||
600 | return; | ||
601 | } | ||
602 | |||
595 | if (GNUNET_YES == | 603 | if (GNUNET_YES == |
596 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "topology", | 604 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "topology", |
597 | &topology_num)) | 605 | &topology_num)) |
@@ -625,6 +633,7 @@ check () | |||
625 | char *config_file_name; | 633 | char *config_file_name; |
626 | GNUNET_asprintf(&binary_name, "test-testing-topology-%s", topology_string); | 634 | GNUNET_asprintf(&binary_name, "test-testing-topology-%s", topology_string); |
627 | GNUNET_asprintf(&config_file_name, "test_testing_data_topology_%s.conf", topology_string); | 635 | GNUNET_asprintf(&config_file_name, "test_testing_data_topology_%s.conf", topology_string); |
636 | int ret; | ||
628 | char *const argv[] = {binary_name, | 637 | char *const argv[] = {binary_name, |
629 | "-c", | 638 | "-c", |
630 | config_file_name, | 639 | config_file_name, |
@@ -636,9 +645,13 @@ check () | |||
636 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 645 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
637 | GNUNET_GETOPT_OPTION_END | 646 | GNUNET_GETOPT_OPTION_END |
638 | }; | 647 | }; |
639 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, | 648 | ret = GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, |
640 | argv, binary_name, "nohelp", | 649 | argv, binary_name, "nohelp", |
641 | options, &run, &ok); | 650 | options, &run, &ok); |
651 | if (ret != GNUNET_OK) | ||
652 | { | ||
653 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "`test-testing-topology-%s': Failed with error code %d\n", topology_string, ret); | ||
654 | } | ||
642 | GNUNET_free(binary_name); | 655 | GNUNET_free(binary_name); |
643 | GNUNET_free(config_file_name); | 656 | GNUNET_free(config_file_name); |
644 | return ok; | 657 | return ok; |
@@ -676,7 +689,10 @@ main (int argc, char *argv[]) | |||
676 | * Need to remove base directory, subdirectories taken care | 689 | * Need to remove base directory, subdirectories taken care |
677 | * of by the testing framework. | 690 | * of by the testing framework. |
678 | */ | 691 | */ |
679 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-testing"); | 692 | if (GNUNET_DISK_directory_remove (test_directory) != GNUNET_OK) |
693 | { | ||
694 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Failed to remove testing directory %s\n", test_directory); | ||
695 | } | ||
680 | GNUNET_free(our_binary_name); | 696 | GNUNET_free(our_binary_name); |
681 | return ret; | 697 | return ret; |
682 | } | 698 | } |