diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-11-16 13:02:52 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-11-16 13:02:52 +0000 |
commit | b0685d4301b6ddf5d95e5467add39a23b51aa5a1 (patch) | |
tree | a9808ba0b435e871f1b85ac4e7006895979e9d8b /src/testing/test_testing_topology_blacklist.c | |
parent | 7f082ef1cd69b48984b05ae72f3c124493fdd86e (diff) | |
download | gnunet-b0685d4301b6ddf5d95e5467add39a23b51aa5a1.tar.gz gnunet-b0685d4301b6ddf5d95e5467add39a23b51aa5a1.zip |
Fix for testing where peer_start callback immediately calls peer_stop (also white space changes)
Diffstat (limited to 'src/testing/test_testing_topology_blacklist.c')
-rw-r--r-- | src/testing/test_testing_topology_blacklist.c | 246 |
1 files changed, 141 insertions, 105 deletions
diff --git a/src/testing/test_testing_topology_blacklist.c b/src/testing/test_testing_topology_blacklist.c index 13df683e9..1123c2f39 100644 --- a/src/testing/test_testing_topology_blacklist.c +++ b/src/testing/test_testing_topology_blacklist.c | |||
@@ -67,9 +67,9 @@ static FILE *dotOutFile; | |||
67 | 67 | ||
68 | static char *blacklist_transports; | 68 | static char *blacklist_transports; |
69 | 69 | ||
70 | static enum GNUNET_TESTING_Topology topology = GNUNET_TESTING_TOPOLOGY_CLIQUE; /* Overlay should allow all connections */ | 70 | static enum GNUNET_TESTING_Topology topology = GNUNET_TESTING_TOPOLOGY_CLIQUE; /* Overlay should allow all connections */ |
71 | 71 | ||
72 | static enum GNUNET_TESTING_Topology blacklist_topology = GNUNET_TESTING_TOPOLOGY_RING; /* Blacklist underlay into a ring */ | 72 | static enum GNUNET_TESTING_Topology blacklist_topology = GNUNET_TESTING_TOPOLOGY_RING; /* Blacklist underlay into a ring */ |
73 | 73 | ||
74 | static enum GNUNET_TESTING_Topology connection_topology = GNUNET_TESTING_TOPOLOGY_NONE; /* NONE actually means connect all allowed peers */ | 74 | static enum GNUNET_TESTING_Topology connection_topology = GNUNET_TESTING_TOPOLOGY_NONE; /* NONE actually means connect all allowed peers */ |
75 | 75 | ||
@@ -98,14 +98,13 @@ struct GNUNET_TestMessage | |||
98 | /** | 98 | /** |
99 | * Check whether peers successfully shut down. | 99 | * Check whether peers successfully shut down. |
100 | */ | 100 | */ |
101 | void shutdown_callback (void *cls, | 101 | void |
102 | const char *emsg) | 102 | shutdown_callback (void *cls, const char *emsg) |
103 | { | 103 | { |
104 | if (emsg != NULL) | 104 | if (emsg != NULL) |
105 | { | 105 | { |
106 | #if VERBOSE | 106 | #if VERBOSE |
107 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 107 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown of peers failed!\n"); |
108 | "Shutdown of peers failed!\n"); | ||
109 | #endif | 108 | #endif |
110 | if (ok == 0) | 109 | if (ok == 0) |
111 | ok = 666; | 110 | ok = 666; |
@@ -128,27 +127,25 @@ finish_testing () | |||
128 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 127 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
129 | "Called finish testing, stopping daemons.\n"); | 128 | "Called finish testing, stopping daemons.\n"); |
130 | #endif | 129 | #endif |
131 | sleep(1); | 130 | sleep (1); |
132 | #if VERBOSE | 131 | #if VERBOSE |
133 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 132 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Calling daemons_stop\n"); |
134 | "Calling daemons_stop\n"); | ||
135 | #endif | 133 | #endif |
136 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | 134 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
137 | #if VERBOSE | 135 | #if VERBOSE |
138 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 136 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "daemons_stop finished\n"); |
139 | "daemons_stop finished\n"); | ||
140 | #endif | 137 | #endif |
141 | if (dotOutFile != NULL) | 138 | if (dotOutFile != NULL) |
142 | { | 139 | { |
143 | fprintf(dotOutFile, "}"); | 140 | fprintf (dotOutFile, "}"); |
144 | fclose(dotOutFile); | 141 | fclose (dotOutFile); |
145 | } | 142 | } |
146 | 143 | ||
147 | ok = 0; | 144 | ok = 0; |
148 | } | 145 | } |
149 | 146 | ||
150 | static void | 147 | static void |
151 | end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | 148 | end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
152 | { | 149 | { |
153 | char *msg = cls; | 150 | char *msg = cls; |
154 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 151 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
@@ -164,8 +161,8 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
164 | 161 | ||
165 | if (dotOutFile != NULL) | 162 | if (dotOutFile != NULL) |
166 | { | 163 | { |
167 | fprintf(dotOutFile, "}"); | 164 | fprintf (dotOutFile, "}"); |
168 | fclose(dotOutFile); | 165 | fclose (dotOutFile); |
169 | } | 166 | } |
170 | } | 167 | } |
171 | 168 | ||
@@ -187,19 +184,19 @@ topology_callback (void *cls, | |||
187 | total_connections++; | 184 | total_connections++; |
188 | #if VERBOSE | 185 | #if VERBOSE |
189 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "connected peer %s to peer %s\n", | 186 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "connected peer %s to peer %s\n", |
190 | first_daemon->shortname, | 187 | first_daemon->shortname, second_daemon->shortname); |
191 | second_daemon->shortname); | ||
192 | #endif | 188 | #endif |
193 | if (dotOutFile != NULL) | 189 | if (dotOutFile != NULL) |
194 | fprintf(dotOutFile, "\tn%s -- n%s;\n", first_daemon->shortname, second_daemon->shortname); | 190 | fprintf (dotOutFile, "\tn%s -- n%s;\n", first_daemon->shortname, |
191 | second_daemon->shortname); | ||
195 | } | 192 | } |
196 | #if VERBOSE | 193 | #if VERBOSE |
197 | else | 194 | else |
198 | { | 195 | { |
199 | failed_connections++; | 196 | failed_connections++; |
200 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to connect peer %s to peer %s with error :\n%s\n", | 197 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
201 | first_daemon->shortname, | 198 | "Failed to connect peer %s to peer %s with error :\n%s\n", |
202 | second_daemon->shortname, emsg); | 199 | first_daemon->shortname, second_daemon->shortname, emsg); |
203 | } | 200 | } |
204 | #endif | 201 | #endif |
205 | 202 | ||
@@ -213,11 +210,15 @@ topology_callback (void *cls, | |||
213 | 210 | ||
214 | GNUNET_SCHEDULER_cancel (die_task); | 211 | GNUNET_SCHEDULER_cancel (die_task); |
215 | die_task = GNUNET_SCHEDULER_NO_TASK; | 212 | die_task = GNUNET_SCHEDULER_NO_TASK; |
216 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, "from topology_callback (too many successful connections)"); | 213 | die_task = |
214 | GNUNET_SCHEDULER_add_now (&end_badly, | ||
215 | "from topology_callback (too many successful connections)"); | ||
217 | } | 216 | } |
218 | else if (total_connections + failed_connections == expected_connections) | 217 | else if (total_connections + failed_connections == expected_connections) |
219 | { | 218 | { |
220 | if ((failed_connections == expected_failed_connections) && (total_connections == expected_connections - expected_failed_connections)) | 219 | if ((failed_connections == expected_failed_connections) |
220 | && (total_connections == | ||
221 | expected_connections - expected_failed_connections)) | ||
221 | { | 222 | { |
222 | GNUNET_SCHEDULER_cancel (die_task); | 223 | GNUNET_SCHEDULER_cancel (die_task); |
223 | die_task = GNUNET_SCHEDULER_NO_TASK; | 224 | die_task = GNUNET_SCHEDULER_NO_TASK; |
@@ -226,7 +227,9 @@ topology_callback (void *cls, | |||
226 | else | 227 | else |
227 | { | 228 | { |
228 | GNUNET_SCHEDULER_cancel (die_task); | 229 | GNUNET_SCHEDULER_cancel (die_task); |
229 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, "from topology_callback (wrong number of failed connections)"); | 230 | die_task = |
231 | GNUNET_SCHEDULER_add_now (&end_badly, | ||
232 | "from topology_callback (wrong number of failed connections)"); | ||
230 | } | 233 | } |
231 | } | 234 | } |
232 | else | 235 | else |
@@ -234,7 +237,9 @@ topology_callback (void *cls, | |||
234 | #if VERBOSE | 237 | #if VERBOSE |
235 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 238 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
236 | "Have %d total connections, %d failed connections, Want %d (failed) and %d (successful)\n", | 239 | "Have %d total connections, %d failed connections, Want %d (failed) and %d (successful)\n", |
237 | total_connections, failed_connections, expected_failed_connections, expected_connections - expected_failed_connections); | 240 | total_connections, failed_connections, |
241 | expected_failed_connections, | ||
242 | expected_connections - expected_failed_connections); | ||
238 | #endif | 243 | #endif |
239 | } | 244 | } |
240 | } | 245 | } |
@@ -245,7 +250,11 @@ connect_topology () | |||
245 | expected_connections = -1; | 250 | expected_connections = -1; |
246 | if ((pg != NULL) && (peers_left == 0)) | 251 | if ((pg != NULL) && (peers_left == 0)) |
247 | { | 252 | { |
248 | expected_connections = GNUNET_TESTING_connect_topology (pg, connection_topology, connect_topology_option, connect_topology_option_modifier, NULL, NULL); | 253 | expected_connections = |
254 | GNUNET_TESTING_connect_topology (pg, connection_topology, | ||
255 | connect_topology_option, | ||
256 | connect_topology_option_modifier, | ||
257 | NULL, NULL); | ||
249 | #if VERBOSE | 258 | #if VERBOSE |
250 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 259 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
251 | "Have %d expected connections\n", expected_connections); | 260 | "Have %d expected connections\n", expected_connections); |
@@ -255,46 +264,54 @@ connect_topology () | |||
255 | GNUNET_SCHEDULER_cancel (die_task); | 264 | GNUNET_SCHEDULER_cancel (die_task); |
256 | if (expected_connections == GNUNET_SYSERR) | 265 | if (expected_connections == GNUNET_SYSERR) |
257 | { | 266 | { |
258 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, "from connect topology (bad return)"); | 267 | die_task = |
268 | GNUNET_SCHEDULER_add_now (&end_badly, | ||
269 | "from connect topology (bad return)"); | ||
259 | } | 270 | } |
260 | 271 | ||
261 | die_task = GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT, | 272 | die_task = GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT, |
262 | &end_badly, "from connect topology (timeout)"); | 273 | &end_badly, |
274 | "from connect topology (timeout)"); | ||
263 | } | 275 | } |
264 | 276 | ||
265 | static void | 277 | static void |
266 | create_topology () | 278 | create_topology () |
267 | { | 279 | { |
268 | peers_left = num_peers; /* Reset counter */ | 280 | peers_left = num_peers; /* Reset counter */ |
269 | if (GNUNET_TESTING_create_topology (pg, topology, blacklist_topology, blacklist_transports) != GNUNET_SYSERR) | 281 | if (GNUNET_TESTING_create_topology |
282 | (pg, topology, blacklist_topology, | ||
283 | blacklist_transports) != GNUNET_SYSERR) | ||
270 | { | 284 | { |
271 | #if VERBOSE | 285 | #if VERBOSE |
272 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 286 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
273 | "Topology set up, now starting peers!\n"); | 287 | "Topology set up, now starting peers!\n"); |
274 | #endif | 288 | #endif |
275 | GNUNET_TESTING_daemons_continue_startup(pg); | 289 | GNUNET_TESTING_daemons_continue_startup (pg); |
276 | } | 290 | } |
277 | else | 291 | else |
278 | { | 292 | { |
279 | GNUNET_SCHEDULER_cancel (die_task); | 293 | GNUNET_SCHEDULER_cancel (die_task); |
280 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, "from create topology (bad return)"); | 294 | die_task = |
295 | GNUNET_SCHEDULER_add_now (&end_badly, | ||
296 | "from create topology (bad return)"); | ||
281 | } | 297 | } |
282 | GNUNET_SCHEDULER_cancel (die_task); | 298 | GNUNET_SCHEDULER_cancel (die_task); |
283 | die_task = GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT, | 299 | die_task = GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT, |
284 | &end_badly, "from continue startup (timeout)"); | 300 | &end_badly, |
301 | "from continue startup (timeout)"); | ||
285 | } | 302 | } |
286 | 303 | ||
287 | 304 | ||
288 | static void | 305 | static void |
289 | peers_started_callback (void *cls, | 306 | peers_started_callback (void *cls, |
290 | const struct GNUNET_PeerIdentity *id, | 307 | const struct GNUNET_PeerIdentity *id, |
291 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 308 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
292 | struct GNUNET_TESTING_Daemon *d, const char *emsg) | 309 | struct GNUNET_TESTING_Daemon *d, const char *emsg) |
293 | { | 310 | { |
294 | if (emsg != NULL) | 311 | if (emsg != NULL) |
295 | { | 312 | { |
296 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to start daemon with error: `%s'\n", | 313 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
297 | emsg); | 314 | "Failed to start daemon with error: `%s'\n", emsg); |
298 | return; | 315 | return; |
299 | } | 316 | } |
300 | GNUNET_assert (id != NULL); | 317 | GNUNET_assert (id != NULL); |
@@ -315,7 +332,8 @@ peers_started_callback (void *cls, | |||
315 | * within a reasonable amount of time */ | 332 | * within a reasonable amount of time */ |
316 | die_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 333 | die_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply |
317 | (GNUNET_TIME_UNIT_MINUTES, 5), | 334 | (GNUNET_TIME_UNIT_MINUTES, 5), |
318 | &end_badly, "from peers_started_callback"); | 335 | &end_badly, |
336 | "from peers_started_callback"); | ||
319 | connect_topology (); | 337 | connect_topology (); |
320 | ok = 0; | 338 | ok = 0; |
321 | } | 339 | } |
@@ -329,38 +347,39 @@ peers_started_callback (void *cls, | |||
329 | * @param d the daemon handle (pretty useless at this point, remove?) | 347 | * @param d the daemon handle (pretty useless at this point, remove?) |
330 | * @param emsg non-null on failure | 348 | * @param emsg non-null on failure |
331 | */ | 349 | */ |
332 | void hostkey_callback (void *cls, | 350 | void |
333 | const struct GNUNET_PeerIdentity *id, | 351 | hostkey_callback (void *cls, |
334 | struct GNUNET_TESTING_Daemon *d, | 352 | const struct GNUNET_PeerIdentity *id, |
335 | const char *emsg) | 353 | struct GNUNET_TESTING_Daemon *d, const char *emsg) |
336 | { | 354 | { |
337 | if (emsg != NULL) | 355 | if (emsg != NULL) |
338 | { | 356 | { |
339 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Hostkey callback received error: %s\n", emsg); | 357 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
358 | "Hostkey callback received error: %s\n", emsg); | ||
340 | } | 359 | } |
341 | 360 | ||
342 | #if VERBOSE | 361 | #if VERBOSE |
343 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 362 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
344 | "Hostkey created for peer `%s'\n", | 363 | "Hostkey created for peer `%s'\n", GNUNET_i2s (id)); |
345 | GNUNET_i2s(id)); | ||
346 | #endif | 364 | #endif |
347 | peers_left--; | 365 | peers_left--; |
348 | if (peers_left == 0) | 366 | if (peers_left == 0) |
349 | { | 367 | { |
350 | #if VERBOSE | 368 | #if VERBOSE |
351 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 369 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
352 | "All %d hostkeys created, now creating topology!\n", | 370 | "All %d hostkeys created, now creating topology!\n", |
353 | num_peers); | 371 | num_peers); |
354 | #endif | 372 | #endif |
355 | GNUNET_SCHEDULER_cancel (die_task); | 373 | GNUNET_SCHEDULER_cancel (die_task); |
356 | /* Set up task in case topology creation doesn't finish | 374 | /* Set up task in case topology creation doesn't finish |
357 | * within a reasonable amount of time */ | 375 | * within a reasonable amount of time */ |
358 | die_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 376 | die_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply |
359 | (GNUNET_TIME_UNIT_MINUTES, 5), | 377 | (GNUNET_TIME_UNIT_MINUTES, 5), |
360 | &end_badly, "from hostkey_callback"); | 378 | &end_badly, |
361 | GNUNET_SCHEDULER_add_now(&create_topology, NULL); | 379 | "from hostkey_callback"); |
362 | ok = 0; | 380 | GNUNET_SCHEDULER_add_now (&create_topology, NULL); |
363 | } | 381 | ok = 0; |
382 | } | ||
364 | } | 383 | } |
365 | 384 | ||
366 | static void | 385 | static void |
@@ -386,12 +405,14 @@ run (void *cls, | |||
386 | "Starting daemons based on config file %s\n", cfgfile); | 405 | "Starting daemons based on config file %s\n", cfgfile); |
387 | #endif | 406 | #endif |
388 | 407 | ||
389 | if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_string(cfg, "paths", "servicehome", &test_directory)) | 408 | if (GNUNET_YES != |
409 | GNUNET_CONFIGURATION_get_value_string (cfg, "paths", "servicehome", | ||
410 | &test_directory)) | ||
390 | { | 411 | { |
391 | ok = 404; | 412 | ok = 404; |
392 | if (dotOutFile != NULL) | 413 | if (dotOutFile != NULL) |
393 | { | 414 | { |
394 | fclose(dotOutFile); | 415 | fclose (dotOutFile); |
395 | } | 416 | } |
396 | return; | 417 | return; |
397 | } | 418 | } |
@@ -402,51 +423,60 @@ run (void *cls, | |||
402 | topology = topology_num; | 423 | topology = topology_num; |
403 | 424 | ||
404 | if (GNUNET_YES == | 425 | if (GNUNET_YES == |
405 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "connect_topology", | 426 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", |
427 | "connect_topology", | ||
406 | &connect_topology_num)) | 428 | &connect_topology_num)) |
407 | connection_topology = connect_topology_num; | 429 | connection_topology = connect_topology_num; |
408 | 430 | ||
409 | if (GNUNET_YES == | 431 | if (GNUNET_YES == |
410 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "connect_topology_option", | 432 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", |
411 | &connect_topology_option_num)) | 433 | "connect_topology_option", |
434 | &connect_topology_option_num)) | ||
412 | connect_topology_option = connect_topology_option_num; | 435 | connect_topology_option = connect_topology_option_num; |
413 | 436 | ||
414 | if (GNUNET_YES == | 437 | if (GNUNET_YES == |
415 | GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "connect_topology_option_modifier", | 438 | GNUNET_CONFIGURATION_get_value_string (cfg, "testing", |
416 | &connect_topology_option_modifier_string)) | 439 | "connect_topology_option_modifier", |
440 | &connect_topology_option_modifier_string)) | ||
417 | { | 441 | { |
418 | if (sscanf(connect_topology_option_modifier_string, "%lf", &connect_topology_option_modifier) != 1) | 442 | if (sscanf |
419 | { | 443 | (connect_topology_option_modifier_string, "%lf", |
420 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 444 | &connect_topology_option_modifier) != 1) |
421 | _("Invalid value `%s' for option `%s' in section `%s': expected float\n"), | 445 | { |
422 | connect_topology_option_modifier_string, | 446 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
423 | "connect_topology_option_modifier", | 447 | _ |
424 | "TESTING"); | 448 | ("Invalid value `%s' for option `%s' in section `%s': expected float\n"), |
425 | GNUNET_free (connect_topology_option_modifier_string); | 449 | connect_topology_option_modifier_string, |
426 | ok = 707; | 450 | "connect_topology_option_modifier", "TESTING"); |
427 | if (dotOutFile != NULL) | 451 | GNUNET_free (connect_topology_option_modifier_string); |
428 | { | 452 | ok = 707; |
429 | fclose(dotOutFile); | 453 | if (dotOutFile != NULL) |
430 | } | 454 | { |
431 | return; | 455 | fclose (dotOutFile); |
432 | } | 456 | } |
457 | return; | ||
458 | } | ||
433 | GNUNET_free (connect_topology_option_modifier_string); | 459 | GNUNET_free (connect_topology_option_modifier_string); |
434 | } | 460 | } |
435 | 461 | ||
436 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "blacklist_transports", | 462 | if (GNUNET_OK != |
437 | &blacklist_transports)) | 463 | GNUNET_CONFIGURATION_get_value_string (cfg, "testing", |
438 | { | 464 | "blacklist_transports", |
439 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "No transports specified for blacklisting in blacklist testcase (this shouldn't happen!)\n"); | 465 | &blacklist_transports)) |
440 | ok = 808; | 466 | { |
441 | if (dotOutFile != NULL) | 467 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
442 | { | 468 | "No transports specified for blacklisting in blacklist testcase (this shouldn't happen!)\n"); |
443 | fclose(dotOutFile); | 469 | ok = 808; |
444 | } | 470 | if (dotOutFile != NULL) |
445 | return; | 471 | { |
446 | } | 472 | fclose (dotOutFile); |
473 | } | ||
474 | return; | ||
475 | } | ||
447 | 476 | ||
448 | if (GNUNET_YES == | 477 | if (GNUNET_YES == |
449 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "blacklist_topology", | 478 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", |
479 | "blacklist_topology", | ||
450 | &blacklist_topology_num)) | 480 | &blacklist_topology_num)) |
451 | blacklist_topology = blacklist_topology_num; | 481 | blacklist_topology = blacklist_topology_num; |
452 | 482 | ||
@@ -457,7 +487,7 @@ run (void *cls, | |||
457 | 487 | ||
458 | main_cfg = cfg; | 488 | main_cfg = cfg; |
459 | 489 | ||
460 | GNUNET_assert(num_peers > 0 && num_peers < (unsigned int)-1); | 490 | GNUNET_assert (num_peers > 0 && num_peers < (unsigned int) -1); |
461 | peers_left = num_peers; | 491 | peers_left = num_peers; |
462 | 492 | ||
463 | /* For this specific test we only really want a CLIQUE topology as the | 493 | /* For this specific test we only really want a CLIQUE topology as the |
@@ -472,10 +502,12 @@ run (void *cls, | |||
472 | /* Set up a task to end testing if peer start fails */ | 502 | /* Set up a task to end testing if peer start fails */ |
473 | die_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 503 | die_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply |
474 | (GNUNET_TIME_UNIT_MINUTES, 5), | 504 | (GNUNET_TIME_UNIT_MINUTES, 5), |
475 | &end_badly, "didn't start all daemons in reasonable amount of time!!!"); | 505 | &end_badly, |
506 | "didn't start all daemons in reasonable amount of time!!!"); | ||
476 | 507 | ||
477 | pg = GNUNET_TESTING_daemons_start (cfg, | 508 | pg = GNUNET_TESTING_daemons_start (cfg, |
478 | peers_left, TIMEOUT, &hostkey_callback, NULL, &peers_started_callback, NULL, | 509 | peers_left, TIMEOUT, &hostkey_callback, |
510 | NULL, &peers_started_callback, NULL, | ||
479 | &topology_callback, NULL, NULL); | 511 | &topology_callback, NULL, NULL); |
480 | 512 | ||
481 | } | 513 | } |
@@ -484,7 +516,7 @@ static int | |||
484 | check () | 516 | check () |
485 | { | 517 | { |
486 | int ret; | 518 | int ret; |
487 | char *const argv[] = {"test-testing-topology-blacklist", | 519 | char *const argv[] = { "test-testing-topology-blacklist", |
488 | "-c", | 520 | "-c", |
489 | "test_testing_data_topology_blacklist.conf", | 521 | "test_testing_data_topology_blacklist.conf", |
490 | #if VERBOSE | 522 | #if VERBOSE |
@@ -496,11 +528,13 @@ check () | |||
496 | GNUNET_GETOPT_OPTION_END | 528 | GNUNET_GETOPT_OPTION_END |
497 | }; | 529 | }; |
498 | ret = GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, | 530 | ret = GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, |
499 | argv, "test-testing-topology-blacklist", "nohelp", | 531 | argv, "test-testing-topology-blacklist", "nohelp", |
500 | options, &run, &ok); | 532 | options, &run, &ok); |
501 | if (ret != GNUNET_OK) | 533 | if (ret != GNUNET_OK) |
502 | { | 534 | { |
503 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "`test-testing-topology-blacklist': Failed with error code %d\n", ret); | 535 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
536 | "`test-testing-topology-blacklist': Failed with error code %d\n", | ||
537 | ret); | ||
504 | } | 538 | } |
505 | 539 | ||
506 | return ok; | 540 | return ok; |
@@ -528,7 +562,9 @@ main (int argc, char *argv[]) | |||
528 | { | 562 | { |
529 | if (GNUNET_DISK_directory_remove (test_directory) != GNUNET_OK) | 563 | if (GNUNET_DISK_directory_remove (test_directory) != GNUNET_OK) |
530 | { | 564 | { |
531 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Failed to remove testing directory %s\n", test_directory); | 565 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
566 | "Failed to remove testing directory %s\n", | ||
567 | test_directory); | ||
532 | } | 568 | } |
533 | } | 569 | } |
534 | 570 | ||