aboutsummaryrefslogtreecommitdiff
path: root/src/testing/test_testing_portreservation.c
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-11-01 22:02:16 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-11-01 22:02:16 +0000
commit4d501ee10c63e2edc044d6bcdb8ba060f78b34e5 (patch)
tree1bf7dca53ed163cf9f7acdd4e9a9e9e7a1f75ccc /src/testing/test_testing_portreservation.c
parent71cc3e168ae8b07413645ff4a8be8bfe5b732cf7 (diff)
downloadgnunet-4d501ee10c63e2edc044d6bcdb8ba060f78b34e5.tar.gz
gnunet-4d501ee10c63e2edc044d6bcdb8ba060f78b34e5.zip
fix crashing checks
Diffstat (limited to 'src/testing/test_testing_portreservation.c')
-rw-r--r--src/testing/test_testing_portreservation.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/testing/test_testing_portreservation.c b/src/testing/test_testing_portreservation.c
index 664031633..9a69916fa 100644
--- a/src/testing/test_testing_portreservation.c
+++ b/src/testing/test_testing_portreservation.c
@@ -33,6 +33,11 @@
33 GNUNET_log (kind, __VA_ARGS__) 33 GNUNET_log (kind, __VA_ARGS__)
34 34
35/** 35/**
36 * The status of the test
37 */
38int status;
39
40/**
36 * Main point of test execution 41 * Main point of test execution
37 */ 42 */
38static void 43static void
@@ -50,11 +55,13 @@ run (void *cls, char *const *args, const char *cfgfile,
50 new_port1 = GNUNET_TESTING_reserve_port (system, GNUNET_YES); 55 new_port1 = GNUNET_TESTING_reserve_port (system, GNUNET_YES);
51 LOG (GNUNET_ERROR_TYPE_DEBUG, 56 LOG (GNUNET_ERROR_TYPE_DEBUG,
52 "Reserved TCP port %u\n", new_port1); 57 "Reserved TCP port %u\n", new_port1);
53 GNUNET_assert (0 != new_port1); 58 if (0 == new_port1)
59 goto end;
54 new_port2 = GNUNET_TESTING_reserve_port (system, GNUNET_YES); 60 new_port2 = GNUNET_TESTING_reserve_port (system, GNUNET_YES);
55 LOG (GNUNET_ERROR_TYPE_DEBUG, 61 LOG (GNUNET_ERROR_TYPE_DEBUG,
56 "Reserved TCP port %u\n", new_port2); 62 "Reserved TCP port %u\n", new_port2);
57 GNUNET_assert (0 != new_port2); 63 if (0 == new_port2)
64 goto end;
58 GNUNET_assert (new_port1 != new_port2); 65 GNUNET_assert (new_port1 != new_port2);
59 GNUNET_TESTING_release_port (system, GNUNET_YES, new_port1); 66 GNUNET_TESTING_release_port (system, GNUNET_YES, new_port1);
60 old_port1 = new_port1; 67 old_port1 = new_port1;
@@ -66,6 +73,9 @@ run (void *cls, char *const *args, const char *cfgfile,
66 GNUNET_assert (old_port1 == new_port1); 73 GNUNET_assert (old_port1 == new_port1);
67 GNUNET_TESTING_release_port (system, GNUNET_YES, new_port1); 74 GNUNET_TESTING_release_port (system, GNUNET_YES, new_port1);
68 GNUNET_TESTING_release_port (system, GNUNET_YES, new_port2); 75 GNUNET_TESTING_release_port (system, GNUNET_YES, new_port2);
76 status = GNUNET_OK;
77
78 end:
69 GNUNET_TESTING_system_destroy (system, GNUNET_YES); 79 GNUNET_TESTING_system_destroy (system, GNUNET_YES);
70} 80}
71 81
@@ -75,6 +85,8 @@ int main (int argc, char *argv[])
75 struct GNUNET_GETOPT_CommandLineOption options[] = { 85 struct GNUNET_GETOPT_CommandLineOption options[] = {
76 GNUNET_GETOPT_OPTION_END 86 GNUNET_GETOPT_OPTION_END
77 }; 87 };
88
89 status = GNUNET_SYSERR;
78 if (GNUNET_OK != 90 if (GNUNET_OK !=
79 GNUNET_PROGRAM_run (argc, 91 GNUNET_PROGRAM_run (argc,
80 argv, 92 argv,
@@ -87,7 +99,7 @@ int main (int argc, char *argv[])
87 { 99 {
88 return 1; 100 return 1;
89 } 101 }
90 return 0; 102 return (GNUNET_OK == status) ? 0 : 1;
91} 103}
92 104
93/* end of test_testing_portreservation.c */ 105/* end of test_testing_portreservation.c */