diff options
author | Bart Polot <bart@net.in.tum.de> | 2012-02-06 16:55:38 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2012-02-06 16:55:38 +0000 |
commit | d2b0f1d3b4133ee2b90e820203c05988004d2ff7 (patch) | |
tree | 2ffb59ab5e1dddc6100f6c554d903d1df0a6b5cd /src/mesh | |
parent | 631987c39403ebc91265ea685be6a7df3f209b5c (diff) | |
download | gnunet-d2b0f1d3b4133ee2b90e820203c05988004d2ff7.tar.gz gnunet-d2b0f1d3b4133ee2b90e820203c05988004d2ff7.zip |
- Adapted testcase to working blacklisting, reduced number of peers, topology line
Diffstat (limited to 'src/mesh')
-rw-r--r-- | src/mesh/test_mesh_small.c | 191 | ||||
-rw-r--r-- | src/mesh/test_mesh_small.conf | 6 |
2 files changed, 55 insertions, 142 deletions
diff --git a/src/mesh/test_mesh_small.c b/src/mesh/test_mesh_small.c index 242062b2f..465e00879 100644 --- a/src/mesh/test_mesh_small.c +++ b/src/mesh/test_mesh_small.c | |||
@@ -176,8 +176,6 @@ static struct GNUNET_TIME_Absolute end_time; | |||
176 | static struct GNUNET_TIME_Relative total_time; | 176 | static struct GNUNET_TIME_Relative total_time; |
177 | 177 | ||
178 | 178 | ||
179 | static uint16_t *mesh_peers; | ||
180 | |||
181 | /** | 179 | /** |
182 | * Check whether peers successfully shut down. | 180 | * Check whether peers successfully shut down. |
183 | */ | 181 | */ |
@@ -188,7 +186,7 @@ shutdown_callback (void *cls, const char *emsg) | |||
188 | { | 186 | { |
189 | #if VERBOSE | 187 | #if VERBOSE |
190 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 188 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
191 | "***************** test: Shutdown of peers failed!\n"); | 189 | "test: Shutdown of peers failed!\n"); |
192 | #endif | 190 | #endif |
193 | ok--; | 191 | ok--; |
194 | } | 192 | } |
@@ -196,7 +194,7 @@ shutdown_callback (void *cls, const char *emsg) | |||
196 | { | 194 | { |
197 | #if VERBOSE | 195 | #if VERBOSE |
198 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 196 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
199 | "***************** test: All peers successfully shut down!\n"); | 197 | "test: All peers successfully shut down!\n"); |
200 | #endif | 198 | #endif |
201 | } | 199 | } |
202 | } | 200 | } |
@@ -210,7 +208,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
210 | { | 208 | { |
211 | #if VERBOSE | 209 | #if VERBOSE |
212 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 210 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
213 | "***************** test: Ending test.\n"); | 211 | "test: Ending test.\n"); |
214 | #endif | 212 | #endif |
215 | 213 | ||
216 | if (disconnect_task != GNUNET_SCHEDULER_NO_TASK) | 214 | if (disconnect_task != GNUNET_SCHEDULER_NO_TASK) |
@@ -233,7 +231,7 @@ static void | |||
233 | disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 231 | disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
234 | { | 232 | { |
235 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 233 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
236 | "***************** test: disconnecting mesh service of peers\n"); | 234 | "test: disconnecting mesh service of peers\n"); |
237 | disconnect_task = GNUNET_SCHEDULER_NO_TASK; | 235 | disconnect_task = GNUNET_SCHEDULER_NO_TASK; |
238 | GNUNET_MESH_disconnect (h1); | 236 | GNUNET_MESH_disconnect (h1); |
239 | GNUNET_MESH_disconnect (h2); | 237 | GNUNET_MESH_disconnect (h2); |
@@ -295,7 +293,7 @@ tmt_rdy (void *cls, size_t size, void *buf) | |||
295 | struct GNUNET_MessageHeader *msg = buf; | 293 | struct GNUNET_MessageHeader *msg = buf; |
296 | 294 | ||
297 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 295 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
298 | "***************** test: tmt_rdy called\n"); | 296 | "test: tmt_rdy called\n"); |
299 | if (size < sizeof (struct GNUNET_MessageHeader) || NULL == buf) | 297 | if (size < sizeof (struct GNUNET_MessageHeader) || NULL == buf) |
300 | return 0; | 298 | return 0; |
301 | msg->size = htons (sizeof (struct GNUNET_MessageHeader)); | 299 | msg->size = htons (sizeof (struct GNUNET_MessageHeader)); |
@@ -306,7 +304,7 @@ tmt_rdy (void *cls, size_t size, void *buf) | |||
306 | if (data_sent < 1000) | 304 | if (data_sent < 1000) |
307 | { | 305 | { |
308 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 306 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
309 | "***************** test: Scheduling %d packet\n", data_sent); | 307 | "test: Scheduling %d packet\n", data_sent); |
310 | GNUNET_SCHEDULER_add_now(&data_task, NULL); | 308 | GNUNET_SCHEDULER_add_now(&data_task, NULL); |
311 | } | 309 | } |
312 | } | 310 | } |
@@ -338,7 +336,7 @@ data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx, | |||
338 | { | 336 | { |
339 | case 1L: | 337 | case 1L: |
340 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 338 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
341 | "***************** test: Origin client got a response!\n"); | 339 | "test: Origin client got a response!\n"); |
342 | ok++; | 340 | ok++; |
343 | peers_responded++; | 341 | peers_responded++; |
344 | data_ack++; | 342 | data_ack++; |
@@ -354,7 +352,7 @@ data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx, | |||
354 | if (test == SPEED_ACK) | 352 | if (test == SPEED_ACK) |
355 | { | 353 | { |
356 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 354 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
357 | "***************** test: received ack %u\n", data_ack); | 355 | "test: received ack %u\n", data_ack); |
358 | GNUNET_MESH_notify_transmit_ready (tunnel, GNUNET_NO, 0, | 356 | GNUNET_MESH_notify_transmit_ready (tunnel, GNUNET_NO, 0, |
359 | GNUNET_TIME_UNIT_FOREVER_REL, sender, | 357 | GNUNET_TIME_UNIT_FOREVER_REL, sender, |
360 | sizeof (struct GNUNET_MessageHeader), | 358 | sizeof (struct GNUNET_MessageHeader), |
@@ -381,7 +379,7 @@ data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx, | |||
381 | case 2L: | 379 | case 2L: |
382 | case 3L: | 380 | case 3L: |
383 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 381 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
384 | "***************** test: Destination client %u got a message.\n", | 382 | "test: Destination client %u got a message.\n", |
385 | client); | 383 | client); |
386 | ok++; | 384 | ok++; |
387 | if (SPEED != test) | 385 | if (SPEED != test) |
@@ -395,7 +393,7 @@ data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx, | |||
395 | { | 393 | { |
396 | data_received++; | 394 | data_received++; |
397 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 395 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
398 | "***************** test: received data %u\n", data_received); | 396 | "test: received data %u\n", data_received); |
399 | if (data_received < 1000) | 397 | if (data_received < 1000) |
400 | return GNUNET_OK; | 398 | return GNUNET_OK; |
401 | } | 399 | } |
@@ -440,7 +438,7 @@ incoming_tunnel (void *cls, struct GNUNET_MESH_Tunnel *tunnel, | |||
440 | const struct GNUNET_ATS_Information *atsi) | 438 | const struct GNUNET_ATS_Information *atsi) |
441 | { | 439 | { |
442 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 440 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
443 | "***************** test: Incoming tunnel from %s to peer %d\n", | 441 | "test: Incoming tunnel from %s to peer %d\n", |
444 | GNUNET_i2s (initiator), (long) cls); | 442 | GNUNET_i2s (initiator), (long) cls); |
445 | ok++; | 443 | ok++; |
446 | if ((long) cls == 1L) | 444 | if ((long) cls == 1L) |
@@ -472,7 +470,7 @@ tunnel_cleaner (void *cls, const struct GNUNET_MESH_Tunnel *tunnel, | |||
472 | long i = (long) cls; | 470 | long i = (long) cls; |
473 | 471 | ||
474 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 472 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
475 | "***************** test: Incoming tunnel disconnected at peer %d\n", | 473 | "test: Incoming tunnel disconnected at peer %d\n", |
476 | i); | 474 | i); |
477 | if (2L == i) | 475 | if (2L == i) |
478 | ok++; | 476 | ok++; |
@@ -480,7 +478,7 @@ tunnel_cleaner (void *cls, const struct GNUNET_MESH_Tunnel *tunnel, | |||
480 | ok++; | 478 | ok++; |
481 | else | 479 | else |
482 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 480 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
483 | "***************** test: Unknown peer! %d\n", i); | 481 | "test: Unknown peer! %d\n", i); |
484 | peers_in_tunnel--; | 482 | peers_in_tunnel--; |
485 | if (peers_in_tunnel > 0) | 483 | if (peers_in_tunnel > 0) |
486 | return; | 484 | return; |
@@ -505,7 +503,7 @@ static void | |||
505 | dh (void *cls, const struct GNUNET_PeerIdentity *peer) | 503 | dh (void *cls, const struct GNUNET_PeerIdentity *peer) |
506 | { | 504 | { |
507 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 505 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
508 | "***************** test: peer %s disconnected\n", | 506 | "test: peer %s disconnected\n", |
509 | GNUNET_i2s (peer)); | 507 | GNUNET_i2s (peer)); |
510 | return; | 508 | return; |
511 | } | 509 | } |
@@ -525,7 +523,7 @@ ch (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
525 | struct GNUNET_PeerIdentity *dest; | 523 | struct GNUNET_PeerIdentity *dest; |
526 | 524 | ||
527 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 525 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
528 | "***************** test: peer %s connected\n", GNUNET_i2s (peer)); | 526 | "test: peer %s connected\n", GNUNET_i2s (peer)); |
529 | 527 | ||
530 | if (0 == memcmp (&d2->id, peer, sizeof (d2->id)) && (long) cls == 1L) | 528 | if (0 == memcmp (&d2->id, peer, sizeof (d2->id)) && (long) cls == 1L) |
531 | ok++; | 529 | ok++; |
@@ -554,7 +552,7 @@ ch (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
554 | disconnect_task = | 552 | disconnect_task = |
555 | GNUNET_SCHEDULER_add_delayed (SHORT_TIME, &disconnect_mesh_peers, NULL); | 553 | GNUNET_SCHEDULER_add_delayed (SHORT_TIME, &disconnect_mesh_peers, NULL); |
556 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 554 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
557 | "***************** test: Sending data...\n"); | 555 | "test: Sending data...\n"); |
558 | peers_responded = 0; | 556 | peers_responded = 0; |
559 | data_ack = 0; | 557 | data_ack = 0; |
560 | data_received = 0; | 558 | data_received = 0; |
@@ -568,9 +566,9 @@ ch (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
568 | else | 566 | else |
569 | { | 567 | { |
570 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 568 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
571 | "***************** test: Disconnect already run?\n"); | 569 | "test: Disconnect already run?\n"); |
572 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 570 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
573 | "***************** test: Aborting...\n"); | 571 | "test: Aborting...\n"); |
574 | } | 572 | } |
575 | return; | 573 | return; |
576 | } | 574 | } |
@@ -579,17 +577,17 @@ ch (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
579 | static void | 577 | static void |
580 | do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 578 | do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
581 | { | 579 | { |
582 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: test_task\n"); | 580 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: test_task\n"); |
583 | if (test == MULTICAST) | 581 | if (test == MULTICAST) |
584 | { | 582 | { |
585 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 583 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
586 | "***************** test: add peer 3\n"); | 584 | "test: add peer 3\n"); |
587 | GNUNET_MESH_peer_request_connect_add (t, &d3->id); | 585 | GNUNET_MESH_peer_request_connect_add (t, &d3->id); |
588 | } | 586 | } |
589 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: add peer 2\n"); | 587 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: add peer 2\n"); |
590 | GNUNET_MESH_peer_request_connect_add (t, &d2->id); | 588 | GNUNET_MESH_peer_request_connect_add (t, &d2->id); |
591 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 589 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
592 | "***************** test: schedule timeout in 90s\n"); | 590 | "test: schedule timeout in 90s\n"); |
593 | if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) | 591 | if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) |
594 | { | 592 | { |
595 | GNUNET_SCHEDULER_cancel (disconnect_task); | 593 | GNUNET_SCHEDULER_cancel (disconnect_task); |
@@ -600,61 +598,6 @@ do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
600 | 598 | ||
601 | 599 | ||
602 | /** | 600 | /** |
603 | * Prototype of a callback function indicating that two peers | ||
604 | * are currently connected. | ||
605 | * | ||
606 | * @param cls closure | ||
607 | * @param first peer id for first daemon | ||
608 | * @param second peer id for the second daemon | ||
609 | * @param distance distance between the connected peers | ||
610 | * @param emsg error message (NULL on success) | ||
611 | */ | ||
612 | void | ||
613 | topo_cb (void *cls, const struct GNUNET_PeerIdentity *first, | ||
614 | const struct GNUNET_PeerIdentity *second, const char *emsg) | ||
615 | { | ||
616 | GNUNET_PEER_Id p1; | ||
617 | GNUNET_PEER_Id p2; | ||
618 | struct GNUNET_PeerIdentity id; | ||
619 | |||
620 | GNUNET_PEER_resolve (1, &id); | ||
621 | p1 = GNUNET_PEER_search (first); | ||
622 | if (p1 == pid1) | ||
623 | { | ||
624 | p2 = GNUNET_PEER_search (second); | ||
625 | if (p2 == 0 || p2 > num_peers) | ||
626 | { | ||
627 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
628 | "***************** test: %s is UNKNOWN!? (%u)\n", | ||
629 | GNUNET_i2s (second), p2); | ||
630 | return; | ||
631 | } | ||
632 | mesh_peers[p2]++; | ||
633 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
634 | "***************** test: %s IS a neighbor\n", | ||
635 | GNUNET_i2s (second)); | ||
636 | return; | ||
637 | } | ||
638 | p1 = GNUNET_PEER_search (second); | ||
639 | if (p1 == pid1) | ||
640 | { | ||
641 | p2 = GNUNET_PEER_search (first); | ||
642 | if (p2 == 0 || p2 > num_peers) | ||
643 | { | ||
644 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
645 | "***************** test: %s is UNKNOWN!? (%u)\n", | ||
646 | GNUNET_i2s (first), p2); | ||
647 | return; | ||
648 | } | ||
649 | mesh_peers[p2]++; | ||
650 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
651 | "***************** test: %s IS a neighbor\n", | ||
652 | GNUNET_i2s (first)); | ||
653 | return; | ||
654 | } | ||
655 | } | ||
656 | |||
657 | /** | ||
658 | * connect_mesh_service: connect to the mesh service of one of the peers | 601 | * connect_mesh_service: connect to the mesh service of one of the peers |
659 | * | 602 | * |
660 | */ | 603 | */ |
@@ -662,51 +605,29 @@ static void | |||
662 | connect_mesh_service (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 605 | connect_mesh_service (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
663 | { | 606 | { |
664 | GNUNET_MESH_ApplicationType app; | 607 | GNUNET_MESH_ApplicationType app; |
665 | unsigned int i; | ||
666 | struct GNUNET_PeerIdentity id; | ||
667 | 608 | ||
668 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 609 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
669 | "***************** test: connect_mesh_service\n"); | 610 | "test: connect_mesh_service\n"); |
670 | 611 | ||
671 | for (i = 1; i <= num_peers; i++) | 612 | d2 = GNUNET_TESTING_daemon_get (pg, 4); |
672 | { | ||
673 | GNUNET_PEER_resolve (i, &id); | ||
674 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
675 | "***************** test: peer %s has %u conns to d1\n", | ||
676 | GNUNET_i2s (&id), mesh_peers[i]); | ||
677 | if (mesh_peers[i] == 0) | ||
678 | break; | ||
679 | } | ||
680 | GNUNET_assert (i < num_peers); | ||
681 | d2 = GNUNET_TESTING_daemon_get_by_id (pg, &id); | ||
682 | if (test == MULTICAST) | 613 | if (test == MULTICAST) |
683 | { | 614 | { |
684 | for (i++; i <= num_peers; i++) | 615 | d3 = GNUNET_TESTING_daemon_get (pg, 3); |
685 | { | ||
686 | GNUNET_PEER_resolve (i, &id); | ||
687 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
688 | "***************** test: peer %s has %u conns to d1\n", | ||
689 | GNUNET_i2s (&id), mesh_peers[i]); | ||
690 | if (mesh_peers[i] == 0) | ||
691 | break; | ||
692 | } | ||
693 | GNUNET_assert (i < num_peers); | ||
694 | d3 = GNUNET_TESTING_daemon_get_by_id (pg, &id); | ||
695 | } | 616 | } |
696 | app = (GNUNET_MESH_ApplicationType) 0; | 617 | app = (GNUNET_MESH_ApplicationType) 0; |
697 | 618 | ||
698 | #if VERBOSE | 619 | #if VERBOSE |
699 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 620 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
700 | "***************** test: connecting to mesh service of peer %s (%u)\n", | 621 | "test: connecting to mesh service of peer %s\n", |
701 | GNUNET_i2s (&d1->id), mesh_peers[0]); | 622 | GNUNET_i2s (&d1->id)); |
702 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 623 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
703 | "***************** test: connecting to mesh service of peer %s (%u)\n", | 624 | "test: connecting to mesh service of peer %s\n", |
704 | GNUNET_i2s (&d2->id), i); | 625 | GNUNET_i2s (&d2->id)); |
705 | if (test == MULTICAST) | 626 | if (test == MULTICAST) |
706 | { | 627 | { |
707 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 628 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
708 | "***************** test: connecting to mesh service of peer %s (%u)\n", | 629 | "test: connecting to mesh service of peer %s\n", |
709 | GNUNET_i2s (&d3->id), i); | 630 | GNUNET_i2s (&d3->id)); |
710 | } | 631 | } |
711 | #endif | 632 | #endif |
712 | h1 = GNUNET_MESH_connect (d1->cfg, 5, (void *) 1L, NULL, &tunnel_cleaner, | 633 | h1 = GNUNET_MESH_connect (d1->cfg, 5, (void *) 1L, NULL, &tunnel_cleaner, |
@@ -715,14 +636,14 @@ connect_mesh_service (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
715 | &tunnel_cleaner, handlers, &app); | 636 | &tunnel_cleaner, handlers, &app); |
716 | if (test == MULTICAST) | 637 | if (test == MULTICAST) |
717 | { | 638 | { |
718 | h3 = GNUNET_MESH_connect (d3->cfg, 10, (void *) 3L, &incoming_tunnel, | 639 | h3 = GNUNET_MESH_connect (d3->cfg, 5, (void *) 3L, &incoming_tunnel, |
719 | &tunnel_cleaner, handlers, &app); | 640 | &tunnel_cleaner, handlers, &app); |
720 | } | 641 | } |
721 | t = GNUNET_MESH_tunnel_create (h1, NULL, &ch, &dh, (void *) 1L); | 642 | t = GNUNET_MESH_tunnel_create (h1, NULL, &ch, &dh, (void *) 1L); |
722 | peers_in_tunnel = 0; | 643 | peers_in_tunnel = 0; |
723 | test_task = | 644 | test_task = |
724 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 645 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply |
725 | (GNUNET_TIME_UNIT_SECONDS, 6), &do_test, | 646 | (GNUNET_TIME_UNIT_SECONDS, 1), &do_test, |
726 | NULL); | 647 | NULL); |
727 | } | 648 | } |
728 | 649 | ||
@@ -743,9 +664,9 @@ peergroup_ready (void *cls, const char *emsg) | |||
743 | if (emsg != NULL) | 664 | if (emsg != NULL) |
744 | { | 665 | { |
745 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 666 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
746 | "***************** test: Peergroup callback called with error, aborting test!\n"); | 667 | "test: Peergroup callback called with error, aborting test!\n"); |
747 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 668 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
748 | "***************** test: Error from testing: `%s'\n", emsg); | 669 | "test: Error from testing: `%s'\n", emsg); |
749 | ok--; | 670 | ok--; |
750 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | 671 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
751 | return; | 672 | return; |
@@ -754,9 +675,9 @@ peergroup_ready (void *cls, const char *emsg) | |||
754 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 675 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
755 | "************************************************************\n"); | 676 | "************************************************************\n"); |
756 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 677 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
757 | "***************** test: Peer Group started successfully!\n"); | 678 | "test: Peer Group started successfully!\n"); |
758 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 679 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
759 | "***************** test: Have %u connections\n", | 680 | "test: Have %u connections\n", |
760 | total_connections); | 681 | total_connections); |
761 | #endif | 682 | #endif |
762 | 683 | ||
@@ -775,20 +696,16 @@ peergroup_ready (void *cls, const char *emsg) | |||
775 | 696 | ||
776 | d1 = GNUNET_TESTING_daemon_get (pg, i); | 697 | d1 = GNUNET_TESTING_daemon_get (pg, i); |
777 | peer_id = GNUNET_PEER_intern (&d1->id); | 698 | peer_id = GNUNET_PEER_intern (&d1->id); |
778 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: %u: %s\n", | 699 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: %u: %s\n", |
779 | peer_id, GNUNET_i2s (&d1->id)); | 700 | peer_id, GNUNET_i2s (&d1->id)); |
780 | } | 701 | } |
781 | d1 = GNUNET_TESTING_daemon_get (pg, 0); | 702 | d1 = GNUNET_TESTING_daemon_get (pg, 0); |
782 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 703 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
783 | "***************** test: Peer looking: %s\n", | 704 | "test: Peer looking: %s\n", |
784 | GNUNET_i2s (&d1->id)); | 705 | GNUNET_i2s (&d1->id)); |
785 | pid1 = GNUNET_PEER_intern (&d1->id); | 706 | pid1 = GNUNET_PEER_intern (&d1->id); |
786 | mesh_peers[pid1] = 100; | ||
787 | GNUNET_TESTING_get_topology (pg, &topo_cb, NULL); | ||
788 | 707 | ||
789 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 708 | GNUNET_SCHEDULER_add_now (&connect_mesh_service, NULL); |
790 | (GNUNET_TIME_UNIT_SECONDS, 4), | ||
791 | &connect_mesh_service, NULL); | ||
792 | disconnect_task = | 709 | disconnect_task = |
793 | GNUNET_SCHEDULER_add_delayed (wait_time, &disconnect_mesh_peers, NULL); | 710 | GNUNET_SCHEDULER_add_delayed (wait_time, &disconnect_mesh_peers, NULL); |
794 | 711 | ||
@@ -824,12 +741,10 @@ connect_cb (void *cls, const struct GNUNET_PeerIdentity *first, | |||
824 | else | 741 | else |
825 | { | 742 | { |
826 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 743 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
827 | "***************** test: Problem with new connection (%s)\n", | 744 | "test: Problem with new connection (%s)\n", |
828 | emsg); | 745 | emsg); |
829 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: (%s)\n", | 746 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: (%s)\n", GNUNET_i2s (first)); |
830 | GNUNET_i2s (first)); | 747 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: (%s)\n", GNUNET_i2s (second)); |
831 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: (%s)\n", | ||
832 | GNUNET_i2s (second)); | ||
833 | } | 748 | } |
834 | 749 | ||
835 | } | 750 | } |
@@ -863,7 +778,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
863 | 778 | ||
864 | #if VERBOSE | 779 | #if VERBOSE |
865 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 780 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
866 | "***************** test: Starting daemons.\n"); | 781 | "test: Starting daemons.\n"); |
867 | GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing", | 782 | GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing", |
868 | "use_progressbars", "YES"); | 783 | "use_progressbars", "YES"); |
869 | #endif | 784 | #endif |
@@ -877,8 +792,6 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
877 | return; | 792 | return; |
878 | } | 793 | } |
879 | 794 | ||
880 | mesh_peers = GNUNET_malloc (sizeof (uint16_t) * (num_peers + 1)); | ||
881 | |||
882 | if (GNUNET_OK != | 795 | if (GNUNET_OK != |
883 | GNUNET_CONFIGURATION_get_value_time (testing_cfg, "test_mesh_small", | 796 | GNUNET_CONFIGURATION_get_value_time (testing_cfg, "test_mesh_small", |
884 | "WAIT_TIME", &wait_time)) | 797 | "WAIT_TIME", &wait_time)) |
@@ -986,16 +899,16 @@ main (int argc, char *argv[]) | |||
986 | */ | 899 | */ |
987 | int ok_goal; | 900 | int ok_goal; |
988 | 901 | ||
989 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: Start\n"); | 902 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Start\n"); |
990 | if (strstr (argv[0], "test_mesh_small_unicast") != NULL) | 903 | if (strstr (argv[0], "test_mesh_small_unicast") != NULL) |
991 | { | 904 | { |
992 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: UNICAST\n"); | 905 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: UNICAST\n"); |
993 | test = UNICAST; | 906 | test = UNICAST; |
994 | ok_goal = 5; | 907 | ok_goal = 5; |
995 | } | 908 | } |
996 | else if (strstr (argv[0], "test_mesh_small_multicast") != NULL) | 909 | else if (strstr (argv[0], "test_mesh_small_multicast") != NULL) |
997 | { | 910 | { |
998 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: MULTICAST\n"); | 911 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: MULTICAST\n"); |
999 | test = MULTICAST; | 912 | test = MULTICAST; |
1000 | ok_goal = 10; | 913 | ok_goal = 10; |
1001 | } | 914 | } |
@@ -1010,7 +923,7 @@ main (int argc, char *argv[]) | |||
1010 | * _________________________________ | 923 | * _________________________________ |
1011 | * 5 x ok expected per peer | 924 | * 5 x ok expected per peer |
1012 | */ | 925 | */ |
1013 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: SPEED_ACK\n"); | 926 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: SPEED_ACK\n"); |
1014 | test = SPEED_ACK; | 927 | test = SPEED_ACK; |
1015 | ok_goal = 2003; | 928 | ok_goal = 2003; |
1016 | argv2 [3] = NULL; // remove -L DEBUG | 929 | argv2 [3] = NULL; // remove -L DEBUG |
@@ -1028,13 +941,13 @@ main (int argc, char *argv[]) | |||
1028 | * _________________________________ | 941 | * _________________________________ |
1029 | * 5 x ok expected per peer | 942 | * 5 x ok expected per peer |
1030 | */ | 943 | */ |
1031 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: SPEED\n"); | 944 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: SPEED\n"); |
1032 | test = SPEED; | 945 | test = SPEED; |
1033 | ok_goal = 1003; | 946 | ok_goal = 1003; |
1034 | } | 947 | } |
1035 | else | 948 | else |
1036 | { | 949 | { |
1037 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: UNKNOWN\n"); | 950 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: UNKNOWN\n"); |
1038 | test = SETUP; | 951 | test = SETUP; |
1039 | ok_goal = 0; | 952 | ok_goal = 0; |
1040 | } | 953 | } |
@@ -1049,10 +962,10 @@ main (int argc, char *argv[]) | |||
1049 | if (ok_goal > ok) | 962 | if (ok_goal > ok) |
1050 | { | 963 | { |
1051 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 964 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1052 | "***************** test: FAILED! (%d/%d)\n", ok, ok_goal); | 965 | "test: FAILED! (%d/%d)\n", ok, ok_goal); |
1053 | return 1; | 966 | return 1; |
1054 | } | 967 | } |
1055 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: success\n"); | 968 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: success\n"); |
1056 | return 0; | 969 | return 0; |
1057 | } | 970 | } |
1058 | 971 | ||
diff --git a/src/mesh/test_mesh_small.conf b/src/mesh/test_mesh_small.conf index 11cdc5a75..7df8e9afd 100644 --- a/src/mesh/test_mesh_small.conf +++ b/src/mesh/test_mesh_small.conf | |||
@@ -60,11 +60,11 @@ HOSTNAME = localhost | |||
60 | # PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args | 60 | # PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args |
61 | 61 | ||
62 | [testing] | 62 | [testing] |
63 | NUM_PEERS = 16 | 63 | NUM_PEERS = 5 |
64 | WEAKRANDOM = YES | 64 | WEAKRANDOM = YES |
65 | TOPOLOGY = NONE | 65 | TOPOLOGY = NONE |
66 | CONNECT_TOPOLOGY = 2D_TORUS | 66 | CONNECT_TOPOLOGY = LINE |
67 | BLACKLIST_TOPOLOGY = 2D_TORUS | 67 | BLACKLIST_TOPOLOGY = LINE |
68 | BLACKLIST_TRANSPORTS = tcp udp http unix | 68 | BLACKLIST_TRANSPORTS = tcp udp http unix |
69 | #TOPOLOGY_FILE = small.dat | 69 | #TOPOLOGY_FILE = small.dat |
70 | #CONNECT_TOPOLOGY_OPTION = CONNECT_MINIMUM | 70 | #CONNECT_TOPOLOGY_OPTION = CONNECT_MINIMUM |