diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2015-02-04 08:08:16 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2015-02-04 08:08:16 +0000 |
commit | bf6a2c9deeff7a3b384eb029d8267d6099066df3 (patch) | |
tree | 9721a8f818f89de00c7ad04e0f9b014be0e41611 /src/transport/test_transport_address_switch.c | |
parent | a87cf92e5f1ae3ab380ea49aab3609a32ed88729 (diff) | |
download | gnunet-bf6a2c9deeff7a3b384eb029d8267d6099066df3.tar.gz gnunet-bf6a2c9deeff7a3b384eb029d8267d6099066df3.zip |
improved test description
Diffstat (limited to 'src/transport/test_transport_address_switch.c')
-rw-r--r-- | src/transport/test_transport_address_switch.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/transport/test_transport_address_switch.c b/src/transport/test_transport_address_switch.c index 9ffb6c297..5ecbaa9ed 100644 --- a/src/transport/test_transport_address_switch.c +++ b/src/transport/test_transport_address_switch.c | |||
@@ -21,8 +21,21 @@ | |||
21 | * @file transport/test_transport_address_switch.c | 21 | * @file transport/test_transport_address_switch.c |
22 | * @brief base test case for transport implementations | 22 | * @brief base test case for transport implementations |
23 | * | 23 | * |
24 | * This test case tests if peers can successfully switch address when | 24 | * This test case tests if peers can successfully switch addresses when |
25 | * connected by monitoring statistic values. | 25 | * connected for plugins supporting multiple addresses by monitoring transport's |
26 | * statistic values. | ||
27 | * | ||
28 | * This test starts 2 peers and connects them. When connected test messages | ||
29 | * are transmitted from peer 2 to peer 1. The test monitors transport's | ||
30 | * statistics values for information about address switch attempts. | ||
31 | * | ||
32 | * The test passes with success if one of the peers could successfully switch | ||
33 | * addresses in connected state and a test message was successfully transmitted | ||
34 | * after this switch. | ||
35 | * | ||
36 | * Since it is not possible to trigger an address switch from | ||
37 | * outside, the test still passes when no address switching attempt takes | ||
38 | * place. It fails if an address switch attempt fails. | ||
26 | */ | 39 | */ |
27 | #include "platform.h" | 40 | #include "platform.h" |
28 | #include "gnunet_transport_service.h" | 41 | #include "gnunet_transport_service.h" |
@@ -527,6 +540,7 @@ notify_disconnect (void *cls, | |||
527 | static void | 540 | static void |
528 | sendtask () | 541 | sendtask () |
529 | { | 542 | { |
543 | /* Transmit test messages */ | ||
530 | th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, | 544 | th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, |
531 | &p1->id, MSIZE, | 545 | &p1->id, MSIZE, |
532 | TIMEOUT_TRANSMIT, | 546 | TIMEOUT_TRANSMIT, |
@@ -572,9 +586,11 @@ testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) | |||
572 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 586 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
573 | "(i:s/+/-) \t i == peer 1/2, s/+/- : switch attempt/switch ok/switch fail\n"); | 587 | "(i:s/+/-) \t i == peer 1/2, s/+/- : switch attempt/switch ok/switch fail\n"); |
574 | 588 | ||
589 | /* Show progress */ | ||
575 | measure_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 590 | measure_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
576 | &progress_indicator, | 591 | &progress_indicator, |
577 | NULL); | 592 | NULL); |
593 | /* Peers are connected, start transmit test messages */ | ||
578 | GNUNET_SCHEDULER_add_now (&sendtask, NULL); | 594 | GNUNET_SCHEDULER_add_now (&sendtask, NULL); |
579 | } | 595 | } |
580 | 596 | ||
@@ -602,6 +618,8 @@ start_cb (struct PeerContext *p, void *cls) | |||
602 | sender->no, sender_c, | 618 | sender->no, sender_c, |
603 | receiver->no, GNUNET_i2s (&receiver->id)); | 619 | receiver->no, GNUNET_i2s (&receiver->id)); |
604 | GNUNET_free (sender_c); | 620 | GNUNET_free (sender_c); |
621 | |||
622 | /* Connect the peers */ | ||
605 | cc = GNUNET_TRANSPORT_TESTING_connect_peers (tth, p1, p2, | 623 | cc = GNUNET_TRANSPORT_TESTING_connect_peers (tth, p1, p2, |
606 | &testing_connect_cb, | 624 | &testing_connect_cb, |
607 | NULL); | 625 | NULL); |