diff options
Diffstat (limited to 'src/nat/test_nat_test.c')
-rw-r--r-- | src/nat/test_nat_test.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/src/nat/test_nat_test.c b/src/nat/test_nat_test.c index 32c4fb2d8..520d82d92 100644 --- a/src/nat/test_nat_test.c +++ b/src/nat/test_nat_test.c | |||
@@ -47,15 +47,13 @@ static struct GNUNET_NAT_Test *tst; | |||
47 | static GNUNET_SCHEDULER_TaskIdentifier end; | 47 | static GNUNET_SCHEDULER_TaskIdentifier end; |
48 | 48 | ||
49 | static void | 49 | static void |
50 | end_test (void *cls, | 50 | end_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
51 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
52 | { | 51 | { |
53 | GNUNET_NAT_test_stop (tst); | 52 | GNUNET_NAT_test_stop (tst); |
54 | } | 53 | } |
55 | 54 | ||
56 | static void | 55 | static void |
57 | report_success (void *cls, | 56 | report_success (void *cls, int success) |
58 | int success) | ||
59 | { | 57 | { |
60 | GNUNET_assert (GNUNET_OK == success); | 58 | GNUNET_assert (GNUNET_OK == success); |
61 | ret = 0; | 59 | ret = 0; |
@@ -72,13 +70,10 @@ run (void *cls, | |||
72 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) | 70 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
73 | { | 71 | { |
74 | tst = GNUNET_NAT_test_start (cfg, GNUNET_YES, | 72 | tst = GNUNET_NAT_test_start (cfg, GNUNET_YES, |
75 | 1285, 1285, | 73 | 1285, 1285, &report_success, NULL); |
76 | &report_success, NULL); | ||
77 | if (NULL == tst) | 74 | if (NULL == tst) |
78 | return; | 75 | return; |
79 | end = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 76 | end = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_test, NULL); |
80 | &end_test, | ||
81 | NULL); | ||
82 | } | 77 | } |
83 | 78 | ||
84 | 79 | ||
@@ -89,6 +84,7 @@ main (int argc, char *const argv[]) | |||
89 | GNUNET_GETOPT_OPTION_END | 84 | GNUNET_GETOPT_OPTION_END |
90 | }; | 85 | }; |
91 | struct GNUNET_OS_Process *gns; | 86 | struct GNUNET_OS_Process *gns; |
87 | |||
92 | char *const argv_prog[] = { | 88 | char *const argv_prog[] = { |
93 | "test-nat-test", | 89 | "test-nat-test", |
94 | "-c", | 90 | "-c", |
@@ -110,23 +106,17 @@ main (int argc, char *const argv[]) | |||
110 | #endif | 106 | #endif |
111 | NULL); | 107 | NULL); |
112 | gns = GNUNET_OS_start_process (NULL, NULL, | 108 | gns = GNUNET_OS_start_process (NULL, NULL, |
113 | "gnunet-nat-server", | 109 | "gnunet-nat-server", "gnunet-nat-server", |
114 | "gnunet-nat-server", | ||
115 | #if VERBOSE | 110 | #if VERBOSE |
116 | "-L", | 111 | "-L", "DEBUG", |
117 | "DEBUG", | ||
118 | #endif | 112 | #endif |
119 | "-c", "test_nat_test_data.conf", | 113 | "-c", "test_nat_test_data.conf", |
120 | "12345", | 114 | "12345", NULL); |
121 | NULL); | ||
122 | GNUNET_assert (NULL != gns); | 115 | GNUNET_assert (NULL != gns); |
123 | GNUNET_PROGRAM_run (5, argv_prog, | 116 | GNUNET_PROGRAM_run (5, argv_prog, |
124 | "test-nat-test", "nohelp", | 117 | "test-nat-test", "nohelp", options, &run, NULL); |
125 | options, | ||
126 | &run, NULL); | ||
127 | GNUNET_break (0 == GNUNET_OS_process_kill (gns, SIGTERM)); | 118 | GNUNET_break (0 == GNUNET_OS_process_kill (gns, SIGTERM)); |
128 | GNUNET_break (GNUNET_OK == | 119 | GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (gns)); |
129 | GNUNET_OS_process_wait (gns)); | ||
130 | GNUNET_OS_process_close (gns); | 120 | GNUNET_OS_process_close (gns); |
131 | return ret; | 121 | return ret; |
132 | } | 122 | } |