diff options
Diffstat (limited to 'src/testbed/test_testbed_api_3peers_3controllers.c')
-rw-r--r-- | src/testbed/test_testbed_api_3peers_3controllers.c | 968 |
1 files changed, 492 insertions, 476 deletions
diff --git a/src/testbed/test_testbed_api_3peers_3controllers.c b/src/testbed/test_testbed_api_3peers_3controllers.c index 1d1d1ce44..ec396d6ca 100644 --- a/src/testbed/test_testbed_api_3peers_3controllers.c +++ b/src/testbed/test_testbed_api_3peers_3controllers.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
@@ -51,21 +51,20 @@ | |||
51 | /** | 51 | /** |
52 | * Generic logging shortcut | 52 | * Generic logging shortcut |
53 | */ | 53 | */ |
54 | #define LOG(kind,...) \ | 54 | #define LOG(kind, ...) \ |
55 | GNUNET_log (kind, __VA_ARGS__) | 55 | GNUNET_log(kind, __VA_ARGS__) |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Relative time seconds shorthand | 58 | * Relative time seconds shorthand |
59 | */ | 59 | */ |
60 | #define TIME_REL_SECS(sec) \ | 60 | #define TIME_REL_SECS(sec) \ |
61 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, sec) | 61 | GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, sec) |
62 | 62 | ||
63 | 63 | ||
64 | /** | 64 | /** |
65 | * Peer context | 65 | * Peer context |
66 | */ | 66 | */ |
67 | struct PeerContext | 67 | struct PeerContext { |
68 | { | ||
69 | /** | 68 | /** |
70 | * The peer handle | 69 | * The peer handle |
71 | */ | 70 | */ |
@@ -161,9 +160,7 @@ static struct GNUNET_SCHEDULER_Task * delayed_connect_task; | |||
161 | /** | 160 | /** |
162 | * Different stages in testing | 161 | * Different stages in testing |
163 | */ | 162 | */ |
164 | enum Stage | 163 | enum Stage { |
165 | { | ||
166 | |||
167 | /** | 164 | /** |
168 | * Initial stage | 165 | * Initial stage |
169 | */ | 166 | */ |
@@ -256,30 +253,30 @@ static enum Stage result; | |||
256 | * @param cls NULL | 253 | * @param cls NULL |
257 | */ | 254 | */ |
258 | static void | 255 | static void |
259 | do_shutdown (void *cls) | 256 | do_shutdown(void *cls) |
260 | { | 257 | { |
261 | if (NULL != abort_task) | 258 | if (NULL != abort_task) |
262 | GNUNET_SCHEDULER_cancel (abort_task); | 259 | GNUNET_SCHEDULER_cancel(abort_task); |
263 | if (NULL != hc_handle) | 260 | if (NULL != hc_handle) |
264 | GNUNET_TESTBED_is_host_habitable_cancel (hc_handle); | 261 | GNUNET_TESTBED_is_host_habitable_cancel(hc_handle); |
265 | GNUNET_assert (NULL == delayed_connect_task); | 262 | GNUNET_assert(NULL == delayed_connect_task); |
266 | if (NULL != common_operation) | 263 | if (NULL != common_operation) |
267 | GNUNET_TESTBED_operation_done (common_operation); | 264 | GNUNET_TESTBED_operation_done(common_operation); |
268 | if (NULL != reg_handle) | 265 | if (NULL != reg_handle) |
269 | GNUNET_TESTBED_cancel_registration (reg_handle); | 266 | GNUNET_TESTBED_cancel_registration(reg_handle); |
270 | if (NULL != controller1) | 267 | if (NULL != controller1) |
271 | GNUNET_TESTBED_controller_disconnect (controller1); | 268 | GNUNET_TESTBED_controller_disconnect(controller1); |
272 | GNUNET_CONFIGURATION_destroy (cfg); | 269 | GNUNET_CONFIGURATION_destroy(cfg); |
273 | if (NULL != cfg2) | 270 | if (NULL != cfg2) |
274 | GNUNET_CONFIGURATION_destroy (cfg2); | 271 | GNUNET_CONFIGURATION_destroy(cfg2); |
275 | if (NULL != cp1) | 272 | if (NULL != cp1) |
276 | GNUNET_TESTBED_controller_stop (cp1); | 273 | GNUNET_TESTBED_controller_stop(cp1); |
277 | if (NULL != host) | 274 | if (NULL != host) |
278 | GNUNET_TESTBED_host_destroy (host); | 275 | GNUNET_TESTBED_host_destroy(host); |
279 | if (NULL != neighbour1) | 276 | if (NULL != neighbour1) |
280 | GNUNET_TESTBED_host_destroy (neighbour1); | 277 | GNUNET_TESTBED_host_destroy(neighbour1); |
281 | if (NULL != neighbour2) | 278 | if (NULL != neighbour2) |
282 | GNUNET_TESTBED_host_destroy (neighbour2); | 279 | GNUNET_TESTBED_host_destroy(neighbour2); |
283 | } | 280 | } |
284 | 281 | ||
285 | 282 | ||
@@ -289,25 +286,25 @@ do_shutdown (void *cls) | |||
289 | * @param cls NULL | 286 | * @param cls NULL |
290 | */ | 287 | */ |
291 | static void | 288 | static void |
292 | do_abort (void *cls) | 289 | do_abort(void *cls) |
293 | { | 290 | { |
294 | LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); | 291 | LOG(GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); |
295 | abort_task = NULL; | 292 | abort_task = NULL; |
296 | if (NULL != delayed_connect_task) | 293 | if (NULL != delayed_connect_task) |
297 | { | 294 | { |
298 | GNUNET_SCHEDULER_cancel (delayed_connect_task); | 295 | GNUNET_SCHEDULER_cancel(delayed_connect_task); |
299 | delayed_connect_task = NULL; | 296 | delayed_connect_task = NULL; |
300 | } | 297 | } |
301 | do_shutdown (cls); | 298 | do_shutdown(cls); |
302 | } | 299 | } |
303 | 300 | ||
304 | 301 | ||
305 | static void | 302 | static void |
306 | abort_test () | 303 | abort_test() |
307 | { | 304 | { |
308 | if (NULL != abort_task) | 305 | if (NULL != abort_task) |
309 | GNUNET_SCHEDULER_cancel (abort_task); | 306 | GNUNET_SCHEDULER_cancel(abort_task); |
310 | abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL); | 307 | abort_task = GNUNET_SCHEDULER_add_now(&do_abort, NULL); |
311 | } | 308 | } |
312 | 309 | ||
313 | 310 | ||
@@ -320,7 +317,7 @@ abort_test () | |||
320 | * operation has executed successfully. | 317 | * operation has executed successfully. |
321 | */ | 318 | */ |
322 | static void | 319 | static void |
323 | op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg); | 320 | op_comp_cb(void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg); |
324 | 321 | ||
325 | 322 | ||
326 | /** | 323 | /** |
@@ -329,18 +326,18 @@ op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg); | |||
329 | * @param cls NULL | 326 | * @param cls NULL |
330 | */ | 327 | */ |
331 | static void | 328 | static void |
332 | do_delayed_connect (void *cls) | 329 | do_delayed_connect(void *cls) |
333 | { | 330 | { |
334 | delayed_connect_task = NULL; | 331 | delayed_connect_task = NULL; |
335 | if (NULL != common_operation) | 332 | if (NULL != common_operation) |
336 | { | 333 | { |
337 | GNUNET_break (0); | 334 | GNUNET_break(0); |
338 | abort_test (); | 335 | abort_test(); |
339 | return; | 336 | return; |
340 | } | 337 | } |
341 | common_operation = | 338 | common_operation = |
342 | GNUNET_TESTBED_overlay_connect (NULL, &op_comp_cb, NULL, peer1.peer, | 339 | GNUNET_TESTBED_overlay_connect(NULL, &op_comp_cb, NULL, peer1.peer, |
343 | peer2.peer); | 340 | peer2.peer); |
344 | } | 341 | } |
345 | 342 | ||
346 | 343 | ||
@@ -353,33 +350,34 @@ do_delayed_connect (void *cls) | |||
353 | * operation has executed successfully. | 350 | * operation has executed successfully. |
354 | */ | 351 | */ |
355 | static void | 352 | static void |
356 | op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg) | 353 | op_comp_cb(void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg) |
357 | { | 354 | { |
358 | if (common_operation != op) | 355 | if (common_operation != op) |
359 | { | 356 | { |
360 | GNUNET_break (0); | 357 | GNUNET_break(0); |
361 | abort_test (); | 358 | abort_test(); |
362 | return; | 359 | return; |
363 | } | 360 | } |
364 | 361 | ||
365 | switch (result) | 362 | switch (result) |
366 | { | 363 | { |
367 | case PEER3_STARTED: | 364 | case PEER3_STARTED: |
368 | case PEERS_2_3_CONNECTED: | 365 | case PEERS_2_3_CONNECTED: |
369 | case PEERS_1_2_CONNECTED: | 366 | case PEERS_1_2_CONNECTED: |
370 | break; | 367 | break; |
371 | default: | 368 | |
372 | GNUNET_break (0); | 369 | default: |
373 | abort_test (); | 370 | GNUNET_break(0); |
374 | return; | 371 | abort_test(); |
375 | } | 372 | return; |
373 | } | ||
376 | if ((NULL != peer1.operation) || (NULL != peer2.operation) || | 374 | if ((NULL != peer1.operation) || (NULL != peer2.operation) || |
377 | (NULL != peer3.operation)) | 375 | (NULL != peer3.operation)) |
378 | { | 376 | { |
379 | GNUNET_break (0); | 377 | GNUNET_break(0); |
380 | abort_test (); | 378 | abort_test(); |
381 | return; | 379 | return; |
382 | } | 380 | } |
383 | } | 381 | } |
384 | 382 | ||
385 | 383 | ||
@@ -393,51 +391,54 @@ op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg) | |||
393 | * @param emsg NULL if peer is not NULL; else MAY contain the error description | 391 | * @param emsg NULL if peer is not NULL; else MAY contain the error description |
394 | */ | 392 | */ |
395 | static void | 393 | static void |
396 | peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | 394 | peer_create_cb(void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) |
397 | { | 395 | { |
398 | switch (result) | 396 | switch (result) |
399 | { | ||
400 | case CONTROLLER1_UP: | ||
401 | if ((NULL == peer1.operation) || (NULL == peer) || (NULL != peer1.peer)) | ||
402 | { | ||
403 | GNUNET_break (0); | ||
404 | abort_test (); | ||
405 | return; | ||
406 | } | ||
407 | peer1.peer = peer; | ||
408 | GNUNET_TESTBED_operation_done (peer1.operation); | ||
409 | result = PEER1_CREATED; | ||
410 | peer1.operation = GNUNET_TESTBED_peer_start (NULL, peer, NULL, NULL); | ||
411 | break; | ||
412 | case CONTROLLER2_UP: | ||
413 | if ((NULL == peer2.operation) || (NULL == peer) || (NULL != peer2.peer)) | ||
414 | { | ||
415 | GNUNET_break (0); | ||
416 | abort_test (); | ||
417 | return; | ||
418 | } | ||
419 | peer2.peer = peer; | ||
420 | GNUNET_TESTBED_operation_done (peer2.operation); | ||
421 | result = PEER2_CREATED; | ||
422 | peer2.operation = GNUNET_TESTBED_peer_start (NULL, peer, NULL, NULL); | ||
423 | break; | ||
424 | case CONTROLLER3_UP: | ||
425 | if ((NULL == peer3.operation) || (NULL == peer) || (NULL != peer3.peer)) | ||
426 | { | 397 | { |
427 | GNUNET_break (0); | 398 | case CONTROLLER1_UP: |
428 | abort_test (); | 399 | if ((NULL == peer1.operation) || (NULL == peer) || (NULL != peer1.peer)) |
400 | { | ||
401 | GNUNET_break(0); | ||
402 | abort_test(); | ||
403 | return; | ||
404 | } | ||
405 | peer1.peer = peer; | ||
406 | GNUNET_TESTBED_operation_done(peer1.operation); | ||
407 | result = PEER1_CREATED; | ||
408 | peer1.operation = GNUNET_TESTBED_peer_start(NULL, peer, NULL, NULL); | ||
409 | break; | ||
410 | |||
411 | case CONTROLLER2_UP: | ||
412 | if ((NULL == peer2.operation) || (NULL == peer) || (NULL != peer2.peer)) | ||
413 | { | ||
414 | GNUNET_break(0); | ||
415 | abort_test(); | ||
416 | return; | ||
417 | } | ||
418 | peer2.peer = peer; | ||
419 | GNUNET_TESTBED_operation_done(peer2.operation); | ||
420 | result = PEER2_CREATED; | ||
421 | peer2.operation = GNUNET_TESTBED_peer_start(NULL, peer, NULL, NULL); | ||
422 | break; | ||
423 | |||
424 | case CONTROLLER3_UP: | ||
425 | if ((NULL == peer3.operation) || (NULL == peer) || (NULL != peer3.peer)) | ||
426 | { | ||
427 | GNUNET_break(0); | ||
428 | abort_test(); | ||
429 | return; | ||
430 | } | ||
431 | peer3.peer = peer; | ||
432 | GNUNET_TESTBED_operation_done(peer3.operation); | ||
433 | result = PEER3_CREATED; | ||
434 | peer3.operation = GNUNET_TESTBED_peer_start(NULL, peer, NULL, NULL); | ||
435 | break; | ||
436 | |||
437 | default: | ||
438 | GNUNET_break(0); | ||
439 | abort_test(); | ||
429 | return; | 440 | return; |
430 | } | 441 | } |
431 | peer3.peer = peer; | ||
432 | GNUNET_TESTBED_operation_done (peer3.operation); | ||
433 | result = PEER3_CREATED; | ||
434 | peer3.operation = GNUNET_TESTBED_peer_start (NULL, peer, NULL, NULL); | ||
435 | break; | ||
436 | default: | ||
437 | GNUNET_break (0); | ||
438 | abort_test (); | ||
439 | return; | ||
440 | } | ||
441 | } | 442 | } |
442 | 443 | ||
443 | 444 | ||
@@ -449,276 +450,289 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | |||
449 | * @param event information about the event | 450 | * @param event information about the event |
450 | */ | 451 | */ |
451 | static void | 452 | static void |
452 | controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) | 453 | controller_cb(void *cls, const struct GNUNET_TESTBED_EventInformation *event) |
453 | { | 454 | { |
454 | switch (event->type) | 455 | switch (event->type) |
455 | { | ||
456 | case GNUNET_TESTBED_ET_OPERATION_FINISHED: | ||
457 | if ((NULL != event->op_cls) || | ||
458 | (NULL != event->details.operation_finished.emsg)) | ||
459 | { | ||
460 | GNUNET_break (0); | ||
461 | abort_test (); | ||
462 | return; | ||
463 | } | ||
464 | switch (result) | ||
465 | { | ||
466 | case PEERS_STOPPED: | ||
467 | if (NULL != event->details.operation_finished.generic) | ||
468 | { | ||
469 | GNUNET_break (0); | ||
470 | abort_test (); | ||
471 | return; | ||
472 | } | ||
473 | if (event->op == peer1.operation) | ||
474 | { | ||
475 | GNUNET_TESTBED_operation_done (peer1.operation); | ||
476 | peer1.operation = NULL; | ||
477 | peer1.peer = NULL; | ||
478 | } | ||
479 | else if (event->op == peer2.operation) | ||
480 | { | ||
481 | GNUNET_TESTBED_operation_done (peer2.operation); | ||
482 | peer2.operation = NULL; | ||
483 | peer2.peer = NULL; | ||
484 | } | ||
485 | else if (event->op == peer3.operation) | ||
486 | { | ||
487 | GNUNET_TESTBED_operation_done (peer3.operation); | ||
488 | peer3.operation = NULL; | ||
489 | peer3.peer = NULL; | ||
490 | } | ||
491 | else | ||
492 | { | ||
493 | GNUNET_break (0); | ||
494 | abort_test (); | ||
495 | return; | ||
496 | } | ||
497 | if ((NULL == peer1.peer) && (NULL == peer2.peer) && (NULL == peer3.peer)) | ||
498 | { | ||
499 | result = SUCCESS; | ||
500 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | ||
501 | } | ||
502 | break; | ||
503 | case PEER1_STARTED: | ||
504 | if ((NULL != event->details.operation_finished.generic) || | ||
505 | (NULL == common_operation)) | ||
506 | { | ||
507 | GNUNET_break (0); | ||
508 | abort_test (); | ||
509 | return; | ||
510 | } | ||
511 | GNUNET_TESTBED_operation_done (common_operation); | ||
512 | common_operation = NULL; | ||
513 | result = CONTROLLER2_UP; | ||
514 | peer2.operation = | ||
515 | GNUNET_TESTBED_peer_create (controller1, neighbour1, cfg, | ||
516 | &peer_create_cb, NULL); | ||
517 | if (NULL == peer2.operation) | ||
518 | { | ||
519 | GNUNET_break (0); | ||
520 | abort_test (); | ||
521 | return; | ||
522 | } | ||
523 | break; | ||
524 | case PEER2_STARTED: | ||
525 | if ((NULL != event->details.operation_finished.generic) || | ||
526 | (NULL == common_operation)) | ||
527 | { | ||
528 | GNUNET_break (0); | ||
529 | abort_test (); | ||
530 | return; | ||
531 | } | ||
532 | GNUNET_TESTBED_operation_done (common_operation); | ||
533 | common_operation = NULL; | ||
534 | result = CONTROLLER3_UP; | ||
535 | peer3.operation = | ||
536 | GNUNET_TESTBED_peer_create (controller1, neighbour2, cfg, | ||
537 | &peer_create_cb, NULL); | ||
538 | if (NULL == peer3.operation) | ||
539 | { | ||
540 | GNUNET_break (0); | ||
541 | abort_test (); | ||
542 | return; | ||
543 | } | ||
544 | break; | ||
545 | default: | ||
546 | GNUNET_break (0); | ||
547 | abort_test (); | ||
548 | return; | ||
549 | } | ||
550 | break; | ||
551 | case GNUNET_TESTBED_ET_PEER_START: | ||
552 | switch (result) | ||
553 | { | 456 | { |
554 | case PEER1_CREATED: | 457 | case GNUNET_TESTBED_ET_OPERATION_FINISHED: |
555 | if (event->details.peer_start.host != host) | 458 | if ((NULL != event->op_cls) || |
556 | { | 459 | (NULL != event->details.operation_finished.emsg)) |
557 | GNUNET_break (0); | 460 | { |
558 | abort_test (); | 461 | GNUNET_break(0); |
559 | return; | 462 | abort_test(); |
560 | } | 463 | return; |
561 | peer1.is_running = GNUNET_YES; | 464 | } |
562 | GNUNET_TESTBED_operation_done (peer1.operation); | 465 | switch (result) |
563 | peer1.operation = NULL; | 466 | { |
564 | result = PEER1_STARTED; | 467 | case PEERS_STOPPED: |
565 | common_operation = | 468 | if (NULL != event->details.operation_finished.generic) |
566 | GNUNET_TESTBED_controller_link (NULL, controller1, neighbour1, NULL, | 469 | { |
567 | GNUNET_YES); | 470 | GNUNET_break(0); |
568 | break; | 471 | abort_test(); |
569 | case PEER2_CREATED: | 472 | return; |
570 | if (event->details.peer_start.host != neighbour1) | 473 | } |
571 | { | 474 | if (event->op == peer1.operation) |
572 | GNUNET_break (0); | 475 | { |
573 | abort_test (); | 476 | GNUNET_TESTBED_operation_done(peer1.operation); |
574 | return; | 477 | peer1.operation = NULL; |
575 | } | 478 | peer1.peer = NULL; |
576 | peer2.is_running = GNUNET_YES; | 479 | } |
577 | GNUNET_TESTBED_operation_done (peer2.operation); | 480 | else if (event->op == peer2.operation) |
578 | peer2.operation = NULL; | 481 | { |
579 | result = PEER2_STARTED; | 482 | GNUNET_TESTBED_operation_done(peer2.operation); |
580 | if (NULL != common_operation) | 483 | peer2.operation = NULL; |
581 | { | 484 | peer2.peer = NULL; |
582 | GNUNET_break (0); | 485 | } |
583 | abort_test (); | 486 | else if (event->op == peer3.operation) |
584 | return; | 487 | { |
585 | } | 488 | GNUNET_TESTBED_operation_done(peer3.operation); |
586 | common_operation = | 489 | peer3.operation = NULL; |
587 | GNUNET_TESTBED_controller_link (NULL, controller1, neighbour2, NULL, | 490 | peer3.peer = NULL; |
588 | GNUNET_YES); | 491 | } |
589 | if (NULL == common_operation) | 492 | else |
590 | { | 493 | { |
591 | GNUNET_break (0); | 494 | GNUNET_break(0); |
592 | abort_test (); | 495 | abort_test(); |
593 | return; | 496 | return; |
594 | } | 497 | } |
498 | if ((NULL == peer1.peer) && (NULL == peer2.peer) && (NULL == peer3.peer)) | ||
499 | { | ||
500 | result = SUCCESS; | ||
501 | GNUNET_SCHEDULER_add_now(&do_shutdown, NULL); | ||
502 | } | ||
503 | break; | ||
504 | |||
505 | case PEER1_STARTED: | ||
506 | if ((NULL != event->details.operation_finished.generic) || | ||
507 | (NULL == common_operation)) | ||
508 | { | ||
509 | GNUNET_break(0); | ||
510 | abort_test(); | ||
511 | return; | ||
512 | } | ||
513 | GNUNET_TESTBED_operation_done(common_operation); | ||
514 | common_operation = NULL; | ||
515 | result = CONTROLLER2_UP; | ||
516 | peer2.operation = | ||
517 | GNUNET_TESTBED_peer_create(controller1, neighbour1, cfg, | ||
518 | &peer_create_cb, NULL); | ||
519 | if (NULL == peer2.operation) | ||
520 | { | ||
521 | GNUNET_break(0); | ||
522 | abort_test(); | ||
523 | return; | ||
524 | } | ||
525 | break; | ||
526 | |||
527 | case PEER2_STARTED: | ||
528 | if ((NULL != event->details.operation_finished.generic) || | ||
529 | (NULL == common_operation)) | ||
530 | { | ||
531 | GNUNET_break(0); | ||
532 | abort_test(); | ||
533 | return; | ||
534 | } | ||
535 | GNUNET_TESTBED_operation_done(common_operation); | ||
536 | common_operation = NULL; | ||
537 | result = CONTROLLER3_UP; | ||
538 | peer3.operation = | ||
539 | GNUNET_TESTBED_peer_create(controller1, neighbour2, cfg, | ||
540 | &peer_create_cb, NULL); | ||
541 | if (NULL == peer3.operation) | ||
542 | { | ||
543 | GNUNET_break(0); | ||
544 | abort_test(); | ||
545 | return; | ||
546 | } | ||
547 | break; | ||
548 | |||
549 | default: | ||
550 | GNUNET_break(0); | ||
551 | abort_test(); | ||
552 | return; | ||
553 | } | ||
595 | break; | 554 | break; |
596 | case PEER3_CREATED: | 555 | |
597 | if (event->details.peer_start.host != neighbour2) | 556 | case GNUNET_TESTBED_ET_PEER_START: |
598 | { | 557 | switch (result) |
599 | GNUNET_break (0); | 558 | { |
600 | abort_test (); | 559 | case PEER1_CREATED: |
601 | return; | 560 | if (event->details.peer_start.host != host) |
602 | } | 561 | { |
603 | peer3.is_running = GNUNET_YES; | 562 | GNUNET_break(0); |
604 | GNUNET_TESTBED_operation_done (peer3.operation); | 563 | abort_test(); |
605 | peer3.operation = NULL; | 564 | return; |
606 | result = PEER3_STARTED; | 565 | } |
607 | common_operation = | 566 | peer1.is_running = GNUNET_YES; |
608 | GNUNET_TESTBED_overlay_connect (NULL, &op_comp_cb, NULL, peer2.peer, | 567 | GNUNET_TESTBED_operation_done(peer1.operation); |
609 | peer1.peer); | 568 | peer1.operation = NULL; |
610 | break; | 569 | result = PEER1_STARTED; |
611 | default: | 570 | common_operation = |
612 | GNUNET_break (0); | 571 | GNUNET_TESTBED_controller_link(NULL, controller1, neighbour1, NULL, |
613 | abort_test (); | 572 | GNUNET_YES); |
614 | return; | 573 | break; |
615 | } | 574 | |
616 | break; | 575 | case PEER2_CREATED: |
617 | case GNUNET_TESTBED_ET_PEER_STOP: | 576 | if (event->details.peer_start.host != neighbour1) |
618 | if (PEERS_CONNECTED_2 != result) | 577 | { |
619 | { | 578 | GNUNET_break(0); |
620 | GNUNET_break (0); | 579 | abort_test(); |
621 | abort_test (); | 580 | return; |
622 | return; | 581 | } |
623 | } | 582 | peer2.is_running = GNUNET_YES; |
624 | if (event->details.peer_stop.peer == peer1.peer) | 583 | GNUNET_TESTBED_operation_done(peer2.operation); |
625 | { | 584 | peer2.operation = NULL; |
626 | peer1.is_running = GNUNET_NO; | 585 | result = PEER2_STARTED; |
627 | GNUNET_TESTBED_operation_done (peer1.operation); | 586 | if (NULL != common_operation) |
628 | } | 587 | { |
629 | else if (event->details.peer_stop.peer == peer2.peer) | 588 | GNUNET_break(0); |
630 | { | 589 | abort_test(); |
631 | peer2.is_running = GNUNET_NO; | 590 | return; |
632 | GNUNET_TESTBED_operation_done (peer2.operation); | 591 | } |
633 | } | 592 | common_operation = |
634 | else if (event->details.peer_stop.peer == peer3.peer) | 593 | GNUNET_TESTBED_controller_link(NULL, controller1, neighbour2, NULL, |
635 | { | 594 | GNUNET_YES); |
636 | peer3.is_running = GNUNET_NO; | 595 | if (NULL == common_operation) |
637 | GNUNET_TESTBED_operation_done (peer3.operation); | 596 | { |
638 | } | 597 | GNUNET_break(0); |
639 | else | 598 | abort_test(); |
640 | { | 599 | return; |
641 | GNUNET_break (0); | 600 | } |
642 | abort_test (); | 601 | break; |
643 | return; | 602 | |
644 | } | 603 | case PEER3_CREATED: |
645 | if ((GNUNET_NO == peer1.is_running) && (GNUNET_NO == peer2.is_running) && | 604 | if (event->details.peer_start.host != neighbour2) |
646 | (GNUNET_NO == peer3.is_running)) | 605 | { |
647 | { | 606 | GNUNET_break(0); |
648 | result = PEERS_STOPPED; | 607 | abort_test(); |
649 | peer1.operation = GNUNET_TESTBED_peer_destroy (peer1.peer); | 608 | return; |
650 | peer2.operation = GNUNET_TESTBED_peer_destroy (peer2.peer); | 609 | } |
651 | peer3.operation = GNUNET_TESTBED_peer_destroy (peer3.peer); | 610 | peer3.is_running = GNUNET_YES; |
652 | } | 611 | GNUNET_TESTBED_operation_done(peer3.operation); |
653 | break; | 612 | peer3.operation = NULL; |
654 | case GNUNET_TESTBED_ET_CONNECT: | 613 | result = PEER3_STARTED; |
655 | if ((NULL != peer1.operation) || (NULL != peer2.operation) || | 614 | common_operation = |
656 | (NULL != peer3.operation) || (NULL == common_operation)) | 615 | GNUNET_TESTBED_overlay_connect(NULL, &op_comp_cb, NULL, peer2.peer, |
657 | { | 616 | peer1.peer); |
658 | GNUNET_break (0); | 617 | break; |
659 | abort_test (); | 618 | |
660 | return; | 619 | default: |
661 | } | 620 | GNUNET_break(0); |
662 | switch (result) | 621 | abort_test(); |
663 | { | 622 | return; |
664 | case PEER3_STARTED: | 623 | } |
665 | if ((event->details.peer_connect.peer1 != peer2.peer) || | ||
666 | (event->details.peer_connect.peer2 != peer1.peer)) | ||
667 | { | ||
668 | GNUNET_break (0); | ||
669 | abort_test (); | ||
670 | return; | ||
671 | } | ||
672 | GNUNET_TESTBED_operation_done (common_operation); | ||
673 | common_operation = NULL; | ||
674 | result = PEERS_1_2_CONNECTED; | ||
675 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected\n"); | ||
676 | common_operation = | ||
677 | GNUNET_TESTBED_overlay_connect (NULL, &op_comp_cb, NULL, peer2.peer, | ||
678 | peer3.peer); | ||
679 | break; | 624 | break; |
680 | case PEERS_1_2_CONNECTED: | 625 | |
681 | if ((event->details.peer_connect.peer1 != peer2.peer) || | 626 | case GNUNET_TESTBED_ET_PEER_STOP: |
682 | (event->details.peer_connect.peer2 != peer3.peer)) | 627 | if (PEERS_CONNECTED_2 != result) |
683 | { | 628 | { |
684 | GNUNET_break (0); | 629 | GNUNET_break(0); |
685 | abort_test (); | 630 | abort_test(); |
686 | return; | 631 | return; |
687 | } | 632 | } |
688 | GNUNET_TESTBED_operation_done (common_operation); | 633 | if (event->details.peer_stop.peer == peer1.peer) |
689 | common_operation = NULL; | 634 | { |
690 | result = PEERS_2_3_CONNECTED; | 635 | peer1.is_running = GNUNET_NO; |
691 | delayed_connect_task = | 636 | GNUNET_TESTBED_operation_done(peer1.operation); |
692 | GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS (3), &do_delayed_connect, | 637 | } |
693 | NULL); | 638 | else if (event->details.peer_stop.peer == peer2.peer) |
639 | { | ||
640 | peer2.is_running = GNUNET_NO; | ||
641 | GNUNET_TESTBED_operation_done(peer2.operation); | ||
642 | } | ||
643 | else if (event->details.peer_stop.peer == peer3.peer) | ||
644 | { | ||
645 | peer3.is_running = GNUNET_NO; | ||
646 | GNUNET_TESTBED_operation_done(peer3.operation); | ||
647 | } | ||
648 | else | ||
649 | { | ||
650 | GNUNET_break(0); | ||
651 | abort_test(); | ||
652 | return; | ||
653 | } | ||
654 | if ((GNUNET_NO == peer1.is_running) && (GNUNET_NO == peer2.is_running) && | ||
655 | (GNUNET_NO == peer3.is_running)) | ||
656 | { | ||
657 | result = PEERS_STOPPED; | ||
658 | peer1.operation = GNUNET_TESTBED_peer_destroy(peer1.peer); | ||
659 | peer2.operation = GNUNET_TESTBED_peer_destroy(peer2.peer); | ||
660 | peer3.operation = GNUNET_TESTBED_peer_destroy(peer3.peer); | ||
661 | } | ||
694 | break; | 662 | break; |
695 | case PEERS_2_3_CONNECTED: | 663 | |
696 | if ((event->details.peer_connect.peer1 != peer1.peer) || | 664 | case GNUNET_TESTBED_ET_CONNECT: |
697 | (event->details.peer_connect.peer2 != peer2.peer)) | 665 | if ((NULL != peer1.operation) || (NULL != peer2.operation) || |
698 | { | 666 | (NULL != peer3.operation) || (NULL == common_operation)) |
699 | GNUNET_break (0); | 667 | { |
700 | abort_test (); | 668 | GNUNET_break(0); |
701 | return; | 669 | abort_test(); |
702 | } | 670 | return; |
703 | GNUNET_TESTBED_operation_done (common_operation); | 671 | } |
704 | common_operation = NULL; | 672 | switch (result) |
705 | result = PEERS_CONNECTED_2; | 673 | { |
706 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected again\n"); | 674 | case PEER3_STARTED: |
707 | peer1.operation = GNUNET_TESTBED_peer_stop (NULL, peer1.peer, NULL, NULL); | 675 | if ((event->details.peer_connect.peer1 != peer2.peer) || |
708 | peer2.operation = GNUNET_TESTBED_peer_stop (NULL, peer2.peer, NULL, NULL); | 676 | (event->details.peer_connect.peer2 != peer1.peer)) |
709 | peer3.operation = GNUNET_TESTBED_peer_stop (NULL, peer3.peer, NULL, NULL); | 677 | { |
678 | GNUNET_break(0); | ||
679 | abort_test(); | ||
680 | return; | ||
681 | } | ||
682 | GNUNET_TESTBED_operation_done(common_operation); | ||
683 | common_operation = NULL; | ||
684 | result = PEERS_1_2_CONNECTED; | ||
685 | LOG(GNUNET_ERROR_TYPE_DEBUG, "Peers connected\n"); | ||
686 | common_operation = | ||
687 | GNUNET_TESTBED_overlay_connect(NULL, &op_comp_cb, NULL, peer2.peer, | ||
688 | peer3.peer); | ||
689 | break; | ||
690 | |||
691 | case PEERS_1_2_CONNECTED: | ||
692 | if ((event->details.peer_connect.peer1 != peer2.peer) || | ||
693 | (event->details.peer_connect.peer2 != peer3.peer)) | ||
694 | { | ||
695 | GNUNET_break(0); | ||
696 | abort_test(); | ||
697 | return; | ||
698 | } | ||
699 | GNUNET_TESTBED_operation_done(common_operation); | ||
700 | common_operation = NULL; | ||
701 | result = PEERS_2_3_CONNECTED; | ||
702 | delayed_connect_task = | ||
703 | GNUNET_SCHEDULER_add_delayed(TIME_REL_SECS(3), &do_delayed_connect, | ||
704 | NULL); | ||
705 | break; | ||
706 | |||
707 | case PEERS_2_3_CONNECTED: | ||
708 | if ((event->details.peer_connect.peer1 != peer1.peer) || | ||
709 | (event->details.peer_connect.peer2 != peer2.peer)) | ||
710 | { | ||
711 | GNUNET_break(0); | ||
712 | abort_test(); | ||
713 | return; | ||
714 | } | ||
715 | GNUNET_TESTBED_operation_done(common_operation); | ||
716 | common_operation = NULL; | ||
717 | result = PEERS_CONNECTED_2; | ||
718 | LOG(GNUNET_ERROR_TYPE_DEBUG, "Peers connected again\n"); | ||
719 | peer1.operation = GNUNET_TESTBED_peer_stop(NULL, peer1.peer, NULL, NULL); | ||
720 | peer2.operation = GNUNET_TESTBED_peer_stop(NULL, peer2.peer, NULL, NULL); | ||
721 | peer3.operation = GNUNET_TESTBED_peer_stop(NULL, peer3.peer, NULL, NULL); | ||
722 | break; | ||
723 | |||
724 | default: | ||
725 | GNUNET_break(0); | ||
726 | abort_test(); | ||
727 | return; | ||
728 | } | ||
710 | break; | 729 | break; |
730 | |||
711 | default: | 731 | default: |
712 | GNUNET_break (0); | 732 | GNUNET_break(0); |
713 | abort_test (); | 733 | abort_test(); |
714 | return; | 734 | return; |
715 | } | 735 | } |
716 | break; | ||
717 | default: | ||
718 | GNUNET_break (0); | ||
719 | abort_test (); | ||
720 | return; | ||
721 | } | ||
722 | } | 736 | } |
723 | 737 | ||
724 | 738 | ||
@@ -729,44 +743,44 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) | |||
729 | * @param emsg the error message; NULL if host registration is successful | 743 | * @param emsg the error message; NULL if host registration is successful |
730 | */ | 744 | */ |
731 | static void | 745 | static void |
732 | registration_comp (void *cls, const char *emsg) | 746 | registration_comp(void *cls, const char *emsg) |
733 | { | 747 | { |
734 | reg_handle = NULL; | 748 | reg_handle = NULL; |
735 | if (cls == neighbour1) | 749 | if (cls == neighbour1) |
736 | { | ||
737 | neighbour2 = GNUNET_TESTBED_host_create ("127.0.0.1", NULL, cfg, 0); | ||
738 | if (NULL == neighbour2) | ||
739 | { | 750 | { |
740 | GNUNET_break (0); | 751 | neighbour2 = GNUNET_TESTBED_host_create("127.0.0.1", NULL, cfg, 0); |
741 | abort_test (); | 752 | if (NULL == neighbour2) |
753 | { | ||
754 | GNUNET_break(0); | ||
755 | abort_test(); | ||
756 | return; | ||
757 | } | ||
758 | reg_handle = | ||
759 | GNUNET_TESTBED_register_host(controller1, neighbour2, | ||
760 | ®istration_comp, neighbour2); | ||
761 | if (NULL == reg_handle) | ||
762 | { | ||
763 | GNUNET_break(0); | ||
764 | abort_test(); | ||
765 | return; | ||
766 | } | ||
742 | return; | 767 | return; |
743 | } | 768 | } |
744 | reg_handle = | 769 | if (cls != neighbour2) |
745 | GNUNET_TESTBED_register_host (controller1, neighbour2, | ||
746 | ®istration_comp, neighbour2); | ||
747 | if (NULL == reg_handle) | ||
748 | { | 770 | { |
749 | GNUNET_break (0); | 771 | GNUNET_break(0); |
750 | abort_test (); | 772 | abort_test(); |
751 | return; | 773 | return; |
752 | } | 774 | } |
753 | return; | ||
754 | } | ||
755 | if (cls != neighbour2) | ||
756 | { | ||
757 | GNUNET_break (0); | ||
758 | abort_test (); | ||
759 | return; | ||
760 | } | ||
761 | peer1.operation = | 775 | peer1.operation = |
762 | GNUNET_TESTBED_peer_create (controller1, host, cfg, &peer_create_cb, | 776 | GNUNET_TESTBED_peer_create(controller1, host, cfg, &peer_create_cb, |
763 | &peer1); | 777 | &peer1); |
764 | if (NULL == peer1.operation) | 778 | if (NULL == peer1.operation) |
765 | { | 779 | { |
766 | GNUNET_break (0); | 780 | GNUNET_break(0); |
767 | abort_test (); | 781 | abort_test(); |
768 | return; | 782 | return; |
769 | } | 783 | } |
770 | } | 784 | } |
771 | 785 | ||
772 | 786 | ||
@@ -780,58 +794,59 @@ registration_comp (void *cls, const char *emsg) | |||
780 | * GNUNET_TESTBED_controller_stop() shouldn't be called in this case | 794 | * GNUNET_TESTBED_controller_stop() shouldn't be called in this case |
781 | */ | 795 | */ |
782 | static void | 796 | static void |
783 | status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, | 797 | status_cb(void *cls, const struct GNUNET_CONFIGURATION_Handle *config, |
784 | int status) | 798 | int status) |
785 | { | 799 | { |
786 | uint64_t event_mask; | 800 | uint64_t event_mask; |
787 | 801 | ||
788 | if (GNUNET_OK != status) | 802 | if (GNUNET_OK != status) |
789 | { | 803 | { |
790 | GNUNET_break (0); | 804 | GNUNET_break(0); |
791 | cp1 = NULL; | 805 | cp1 = NULL; |
792 | abort_test (); | 806 | abort_test(); |
793 | return; | 807 | return; |
794 | } | 808 | } |
795 | event_mask = 0; | 809 | event_mask = 0; |
796 | event_mask |= (1L << GNUNET_TESTBED_ET_PEER_START); | 810 | event_mask |= (1L << GNUNET_TESTBED_ET_PEER_START); |
797 | event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP); | 811 | event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP); |
798 | event_mask |= (1L << GNUNET_TESTBED_ET_CONNECT); | 812 | event_mask |= (1L << GNUNET_TESTBED_ET_CONNECT); |
799 | event_mask |= (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED); | 813 | event_mask |= (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED); |
800 | switch (result) | 814 | switch (result) |
801 | { | ||
802 | case INIT: | ||
803 | controller1 = | ||
804 | GNUNET_TESTBED_controller_connect (host, event_mask, | ||
805 | &controller_cb, NULL); | ||
806 | if (NULL == controller1) | ||
807 | { | ||
808 | GNUNET_break (0); | ||
809 | abort_test (); | ||
810 | return; | ||
811 | } | ||
812 | result = CONTROLLER1_UP; | ||
813 | neighbour1 = GNUNET_TESTBED_host_create ("127.0.0.1", NULL, cfg, 0); | ||
814 | if (NULL == neighbour1) | ||
815 | { | ||
816 | GNUNET_break (0); | ||
817 | abort_test (); | ||
818 | return; | ||
819 | } | ||
820 | reg_handle = | ||
821 | GNUNET_TESTBED_register_host (controller1, neighbour1, | ||
822 | ®istration_comp, neighbour1); | ||
823 | if (NULL == reg_handle) | ||
824 | { | 815 | { |
825 | GNUNET_break (0); | 816 | case INIT: |
826 | abort_test (); | 817 | controller1 = |
818 | GNUNET_TESTBED_controller_connect(host, event_mask, | ||
819 | &controller_cb, NULL); | ||
820 | if (NULL == controller1) | ||
821 | { | ||
822 | GNUNET_break(0); | ||
823 | abort_test(); | ||
824 | return; | ||
825 | } | ||
826 | result = CONTROLLER1_UP; | ||
827 | neighbour1 = GNUNET_TESTBED_host_create("127.0.0.1", NULL, cfg, 0); | ||
828 | if (NULL == neighbour1) | ||
829 | { | ||
830 | GNUNET_break(0); | ||
831 | abort_test(); | ||
832 | return; | ||
833 | } | ||
834 | reg_handle = | ||
835 | GNUNET_TESTBED_register_host(controller1, neighbour1, | ||
836 | ®istration_comp, neighbour1); | ||
837 | if (NULL == reg_handle) | ||
838 | { | ||
839 | GNUNET_break(0); | ||
840 | abort_test(); | ||
841 | return; | ||
842 | } | ||
843 | break; | ||
844 | |||
845 | default: | ||
846 | GNUNET_break(0); | ||
847 | abort_test(); | ||
827 | return; | 848 | return; |
828 | } | 849 | } |
829 | break; | ||
830 | default: | ||
831 | GNUNET_break (0); | ||
832 | abort_test (); | ||
833 | return; | ||
834 | } | ||
835 | } | 850 | } |
836 | 851 | ||
837 | 852 | ||
@@ -846,25 +861,25 @@ status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, | |||
846 | * @param status #GNUNET_YES if it is habitable; #GNUNET_NO if not | 861 | * @param status #GNUNET_YES if it is habitable; #GNUNET_NO if not |
847 | */ | 862 | */ |
848 | static void | 863 | static void |
849 | host_habitable_cb (void *cls, | 864 | host_habitable_cb(void *cls, |
850 | const struct GNUNET_TESTBED_Host *_host, | 865 | const struct GNUNET_TESTBED_Host *_host, |
851 | int status) | 866 | int status) |
852 | { | 867 | { |
853 | hc_handle = NULL; | 868 | hc_handle = NULL; |
854 | if (GNUNET_NO == status) | 869 | if (GNUNET_NO == status) |
855 | { | 870 | { |
856 | (void) printf ("%s", | 871 | (void)printf("%s", |
857 | "Unable to run the test as this system is not configured " | 872 | "Unable to run the test as this system is not configured " |
858 | "to use password less SSH logins to localhost.\n" | 873 | "to use password less SSH logins to localhost.\n" |
859 | "Skipping test\n"); | 874 | "Skipping test\n"); |
860 | GNUNET_SCHEDULER_cancel (abort_task); | 875 | GNUNET_SCHEDULER_cancel(abort_task); |
861 | abort_task = NULL; | 876 | abort_task = NULL; |
862 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 877 | GNUNET_SCHEDULER_add_now(&do_shutdown, NULL); |
863 | result = SKIP; | 878 | result = SKIP; |
864 | return; | 879 | return; |
865 | } | 880 | } |
866 | cp1 = | 881 | cp1 = |
867 | GNUNET_TESTBED_controller_start ("127.0.0.1", host, status_cb, NULL); | 882 | GNUNET_TESTBED_controller_start("127.0.0.1", host, status_cb, NULL); |
868 | } | 883 | } |
869 | 884 | ||
870 | 885 | ||
@@ -877,35 +892,35 @@ host_habitable_cb (void *cls, | |||
877 | * @param cfg the configuration file handle | 892 | * @param cfg the configuration file handle |
878 | */ | 893 | */ |
879 | static void | 894 | static void |
880 | run (void *cls, char *const *args, const char *cfgfile, | 895 | run(void *cls, char *const *args, const char *cfgfile, |
881 | const struct GNUNET_CONFIGURATION_Handle *config) | 896 | const struct GNUNET_CONFIGURATION_Handle *config) |
882 | { | 897 | { |
883 | cfg = GNUNET_CONFIGURATION_dup (config); | 898 | cfg = GNUNET_CONFIGURATION_dup(config); |
884 | host = GNUNET_TESTBED_host_create (NULL, NULL, cfg, 0); | 899 | host = GNUNET_TESTBED_host_create(NULL, NULL, cfg, 0); |
885 | if (NULL == host) | 900 | if (NULL == host) |
886 | { | 901 | { |
887 | GNUNET_break (0); | 902 | GNUNET_break(0); |
888 | abort_test (); | 903 | abort_test(); |
889 | return; | 904 | return; |
890 | } | 905 | } |
891 | if (NULL == | 906 | if (NULL == |
892 | (hc_handle = | 907 | (hc_handle = |
893 | GNUNET_TESTBED_is_host_habitable (host, config, &host_habitable_cb, | 908 | GNUNET_TESTBED_is_host_habitable(host, config, &host_habitable_cb, |
894 | NULL))) | 909 | NULL))) |
895 | { | 910 | { |
896 | GNUNET_TESTBED_host_destroy (host); | 911 | GNUNET_TESTBED_host_destroy(host); |
897 | host = NULL; | 912 | host = NULL; |
898 | (void) printf ("%s", | 913 | (void)printf("%s", |
899 | "Unable to run the test as this system is not configured " | 914 | "Unable to run the test as this system is not configured " |
900 | "to use password less SSH logins to localhost.\n" | 915 | "to use password less SSH logins to localhost.\n" |
901 | "Skipping test\n"); | 916 | "Skipping test\n"); |
902 | result = SKIP; | 917 | result = SKIP; |
903 | return; | 918 | return; |
904 | } | 919 | } |
905 | abort_task = | 920 | abort_task = |
906 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 921 | GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply |
907 | (GNUNET_TIME_UNIT_MINUTES, 3), &do_abort, | 922 | (GNUNET_TIME_UNIT_MINUTES, 3), &do_abort, |
908 | NULL); | 923 | NULL); |
909 | } | 924 | } |
910 | 925 | ||
911 | 926 | ||
@@ -913,12 +928,11 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
913 | * Main function | 928 | * Main function |
914 | */ | 929 | */ |
915 | int | 930 | int |
916 | main (int argc, char **argv) | 931 | main(int argc, char **argv) |
917 | { | 932 | { |
918 | char *const argv2[] = { "test_testbed_api_3peers_3controllers", | 933 | char *const argv2[] = { "test_testbed_api_3peers_3controllers", |
919 | "-c", "test_testbed_api.conf", | 934 | "-c", "test_testbed_api.conf", |
920 | NULL | 935 | NULL }; |
921 | }; | ||
922 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 936 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
923 | GNUNET_GETOPT_OPTION_END | 937 | GNUNET_GETOPT_OPTION_END |
924 | }; | 938 | }; |
@@ -926,20 +940,22 @@ main (int argc, char **argv) | |||
926 | 940 | ||
927 | result = INIT; | 941 | result = INIT; |
928 | ret = | 942 | ret = |
929 | GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2, | 943 | GNUNET_PROGRAM_run((sizeof(argv2) / sizeof(char *)) - 1, argv2, |
930 | "test_testbed_api_3peers_3controllers", "nohelp", | 944 | "test_testbed_api_3peers_3controllers", "nohelp", |
931 | options, &run, NULL); | 945 | options, &run, NULL); |
932 | if (GNUNET_OK != ret) | 946 | if (GNUNET_OK != ret) |
933 | return 1; | 947 | return 1; |
934 | switch (result) | 948 | switch (result) |
935 | { | 949 | { |
936 | case SUCCESS: | 950 | case SUCCESS: |
937 | return 0; | 951 | return 0; |
938 | case SKIP: | 952 | |
939 | return 77; /* Mark test as skipped */ | 953 | case SKIP: |
940 | default: | 954 | return 77; /* Mark test as skipped */ |
941 | return 1; | 955 | |
942 | } | 956 | default: |
957 | return 1; | ||
958 | } | ||
943 | } | 959 | } |
944 | 960 | ||
945 | /* end of test_testbed_api_3peers_3controllers.c */ | 961 | /* end of test_testbed_api_3peers_3controllers.c */ |