diff options
Diffstat (limited to 'src/testing/test_testing_topology_churn.c')
-rw-r--r-- | src/testing/test_testing_topology_churn.c | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/src/testing/test_testing_topology_churn.c b/src/testing/test_testing_topology_churn.c index b92288199..ee800c52c 100644 --- a/src/testing/test_testing_topology_churn.c +++ b/src/testing/test_testing_topology_churn.c | |||
@@ -79,20 +79,19 @@ void | |||
79 | shutdown_callback (void *cls, const char *emsg) | 79 | shutdown_callback (void *cls, const char *emsg) |
80 | { | 80 | { |
81 | if (emsg != NULL) | 81 | if (emsg != NULL) |
82 | { | 82 | { |
83 | #if VERBOSE | 83 | #if VERBOSE |
84 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown of peers failed!\n"); | 84 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown of peers failed!\n"); |
85 | #endif | 85 | #endif |
86 | if (ok == 0) | 86 | if (ok == 0) |
87 | ok = 666; | 87 | ok = 666; |
88 | } | 88 | } |
89 | else | 89 | else |
90 | { | 90 | { |
91 | #if VERBOSE | 91 | #if VERBOSE |
92 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 92 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All peers successfully shut down!\n"); |
93 | "All peers successfully shut down!\n"); | ||
94 | #endif | 93 | #endif |
95 | } | 94 | } |
96 | } | 95 | } |
97 | 96 | ||
98 | static void | 97 | static void |
@@ -123,14 +122,15 @@ static void | |||
123 | end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 122 | end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
124 | { | 123 | { |
125 | char *msg = cls; | 124 | char *msg = cls; |
125 | |||
126 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 126 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
127 | "End badly was called (%s)... stopping daemons.\n", msg); | 127 | "End badly was called (%s)... stopping daemons.\n", msg); |
128 | 128 | ||
129 | if (pg != NULL) | 129 | if (pg != NULL) |
130 | { | 130 | { |
131 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | 131 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
132 | ok = 7331; /* Opposite of leet */ | 132 | ok = 7331; /* Opposite of leet */ |
133 | } | 133 | } |
134 | else | 134 | else |
135 | ok = 401; /* Never got peers started */ | 135 | ok = 401; /* Never got peers started */ |
136 | 136 | ||
@@ -154,18 +154,18 @@ void | |||
154 | churn_callback (void *cls, const char *emsg) | 154 | churn_callback (void *cls, const char *emsg) |
155 | { | 155 | { |
156 | if (emsg == NULL) | 156 | if (emsg == NULL) |
157 | { | 157 | { |
158 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Successfully churned peers!\n", | 158 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Successfully churned peers!\n", |
159 | emsg); | 159 | emsg); |
160 | GNUNET_SCHEDULER_add_now (churn_ctx.next_task, NULL); | 160 | GNUNET_SCHEDULER_add_now (churn_ctx.next_task, NULL); |
161 | } | 161 | } |
162 | else | 162 | else |
163 | { | 163 | { |
164 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 164 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
165 | "Failed to churn peers with error `%s'\n", emsg); | 165 | "Failed to churn peers with error `%s'\n", emsg); |
166 | GNUNET_SCHEDULER_cancel (die_task); | 166 | GNUNET_SCHEDULER_cancel (die_task); |
167 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); | 167 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); |
168 | } | 168 | } |
169 | } | 169 | } |
170 | 170 | ||
171 | 171 | ||
@@ -204,11 +204,11 @@ peers_started_callback (void *cls, | |||
204 | struct GNUNET_TESTING_Daemon *d, const char *emsg) | 204 | struct GNUNET_TESTING_Daemon *d, const char *emsg) |
205 | { | 205 | { |
206 | if (emsg != NULL) | 206 | if (emsg != NULL) |
207 | { | 207 | { |
208 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 208 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
209 | "Failed to start daemon with error: `%s'\n", emsg); | 209 | "Failed to start daemon with error: `%s'\n", emsg); |
210 | return; | 210 | return; |
211 | } | 211 | } |
212 | GNUNET_assert (id != NULL); | 212 | GNUNET_assert (id != NULL); |
213 | #if VERBOSE | 213 | #if VERBOSE |
214 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started daemon %llu out of %llu\n", | 214 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started daemon %llu out of %llu\n", |
@@ -216,21 +216,21 @@ peers_started_callback (void *cls, | |||
216 | #endif | 216 | #endif |
217 | peers_left--; | 217 | peers_left--; |
218 | if (peers_left == 0) | 218 | if (peers_left == 0) |
219 | { | 219 | { |
220 | #if VERBOSE | 220 | #if VERBOSE |
221 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 221 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
222 | "All %d daemons started, now testing churn!\n", num_peers); | 222 | "All %d daemons started, now testing churn!\n", num_peers); |
223 | #endif | 223 | #endif |
224 | GNUNET_SCHEDULER_cancel (die_task); | 224 | GNUNET_SCHEDULER_cancel (die_task); |
225 | /* Set up task in case topology creation doesn't finish | 225 | /* Set up task in case topology creation doesn't finish |
226 | * within a reasonable amount of time */ | 226 | * within a reasonable amount of time */ |
227 | die_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 227 | die_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply |
228 | (GNUNET_TIME_UNIT_MINUTES, 5), | 228 | (GNUNET_TIME_UNIT_MINUTES, 5), |
229 | &end_badly, | 229 | &end_badly, |
230 | "from peers_started_callback"); | 230 | "from peers_started_callback"); |
231 | churn_peers_off (); | 231 | churn_peers_off (); |
232 | ok = 0; | 232 | ok = 0; |
233 | } | 233 | } |
234 | } | 234 | } |
235 | 235 | ||
236 | 236 | ||
@@ -249,10 +249,10 @@ run (void *cls, | |||
249 | if (GNUNET_YES != | 249 | if (GNUNET_YES != |
250 | GNUNET_CONFIGURATION_get_value_string (cfg, "paths", "servicehome", | 250 | GNUNET_CONFIGURATION_get_value_string (cfg, "paths", "servicehome", |
251 | &test_directory)) | 251 | &test_directory)) |
252 | { | 252 | { |
253 | ok = 404; | 253 | ok = 404; |
254 | return; | 254 | return; |
255 | } | 255 | } |
256 | 256 | ||
257 | if (GNUNET_SYSERR == | 257 | if (GNUNET_SYSERR == |
258 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers", | 258 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers", |
@@ -293,6 +293,7 @@ static int | |||
293 | check () | 293 | check () |
294 | { | 294 | { |
295 | int ret; | 295 | int ret; |
296 | |||
296 | char *const argv[] = { "test-testing-topology-churn", | 297 | char *const argv[] = { "test-testing-topology-churn", |
297 | "-c", | 298 | "-c", |
298 | "test_testing_data_topology_churn.conf", | 299 | "test_testing_data_topology_churn.conf", |
@@ -308,11 +309,11 @@ check () | |||
308 | argv, "test-testing-topology-churn", "nohelp", | 309 | argv, "test-testing-topology-churn", "nohelp", |
309 | options, &run, &ok); | 310 | options, &run, &ok); |
310 | if (ret != GNUNET_OK) | 311 | if (ret != GNUNET_OK) |
311 | { | 312 | { |
312 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 313 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
313 | "`test-testing-topology-churn': Failed with error code %d\n", | 314 | "`test-testing-topology-churn': Failed with error code %d\n", |
314 | ret); | 315 | ret); |
315 | } | 316 | } |
316 | 317 | ||
317 | return ok; | 318 | return ok; |
318 | } | 319 | } |
@@ -336,14 +337,13 @@ main (int argc, char *argv[]) | |||
336 | * of by the testing framework. | 337 | * of by the testing framework. |
337 | */ | 338 | */ |
338 | if (test_directory != NULL) | 339 | if (test_directory != NULL) |
340 | { | ||
341 | if (GNUNET_DISK_directory_remove (test_directory) != GNUNET_OK) | ||
339 | { | 342 | { |
340 | if (GNUNET_DISK_directory_remove (test_directory) != GNUNET_OK) | 343 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
341 | { | 344 | "Failed to remove testing directory %s\n", test_directory); |
342 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
343 | "Failed to remove testing directory %s\n", | ||
344 | test_directory); | ||
345 | } | ||
346 | } | 345 | } |
346 | } | ||
347 | 347 | ||
348 | return ret; | 348 | return ret; |
349 | } | 349 | } |