aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/test_mesh_small.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-07-08 13:39:50 +0000
committerBart Polot <bart@net.in.tum.de>2013-07-08 13:39:50 +0000
commit65b283ac0a99edc4eb0fb2f89f0b467d79dac5ff (patch)
tree0afe45d4b33f59297b7210edde7ee17eb88f70e2 /src/mesh/test_mesh_small.c
parentc4221ed2cbaac7c6bd5652e0577ac3f1c8cffbb4 (diff)
downloadgnunet-65b283ac0a99edc4eb0fb2f89f0b467d79dac5ff.tar.gz
gnunet-65b283ac0a99edc4eb0fb2f89f0b467d79dac5ff.zip
- add reliablity testcase, fix nobuf API use
Diffstat (limited to 'src/mesh/test_mesh_small.c')
-rw-r--r--src/mesh/test_mesh_small.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/src/mesh/test_mesh_small.c b/src/mesh/test_mesh_small.c
index 22b85986c..28d1dba60 100644
--- a/src/mesh/test_mesh_small.c
+++ b/src/mesh/test_mesh_small.c
@@ -52,6 +52,7 @@
52#define SPEED 3 52#define SPEED 3
53#define SPEED_ACK 4 53#define SPEED_ACK 4
54#define SPEED_NOBUF 6 54#define SPEED_NOBUF 6
55#define SPEED_REL 8
55#define P2P_SIGNAL 10 56#define P2P_SIGNAL 10
56 57
57/** 58/**
@@ -622,6 +623,9 @@ tunnel_cleaner (void *cls, const struct GNUNET_MESH_Tunnel *tunnel,
622static void 623static void
623do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 624do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
624{ 625{
626 int buf;
627 int rel;
628
625 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test_task\n"); 629 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test_task\n");
626 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "add peer 2\n"); 630 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "add peer 2\n");
627 631
@@ -631,12 +635,22 @@ do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
631 { 635 {
632 GNUNET_SCHEDULER_cancel (disconnect_task); 636 GNUNET_SCHEDULER_cancel (disconnect_task);
633 } 637 }
634 t = GNUNET_MESH_tunnel_create (h1, NULL, p_id[1], 1, GNUNET_YES, GNUNET_NO);
635 if (SPEED_NOBUF == test) 638 if (SPEED_NOBUF == test)
636 { 639 {
637 GNUNET_MESH_tunnel_buffer(t, GNUNET_NO);
638 test = SPEED; 640 test = SPEED;
641 buf = GNUNET_NO;
639 } 642 }
643 else
644 buf = GNUNET_YES;
645
646 if (SPEED_REL == test)
647 {
648 test = SPEED;
649 rel = GNUNET_YES;
650 }
651 else
652 rel = GNUNET_NO;
653 t = GNUNET_MESH_tunnel_create (h1, NULL, p_id[1], 1, buf, rel);
640 654
641 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, 655 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
642 &disconnect_mesh_peers, 656 &disconnect_mesh_peers,
@@ -732,22 +746,24 @@ main (int argc, char *argv[])
732{ 746{
733 initialized = GNUNET_NO; 747 initialized = GNUNET_NO;
734 uint32_t ports[2]; 748 uint32_t ports[2];
749 const char *config_file;
735 750
736 GNUNET_log_setup ("test", "DEBUG", NULL); 751 GNUNET_log_setup ("test", "DEBUG", NULL);
752 config_file = "test_mesh.conf";
737 753
738 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Start\n"); 754 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Start\n");
739 if (strstr (argv[0], "_small_forward") != NULL) 755 if (strstr (argv[0], "_small_forward") != NULL)
740 { 756 {
741 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "FORWARD\n"); 757 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "FORWARD\n");
742 test = FORWARD; 758 test = FORWARD;
743 test_name = "unicast2"; 759 test_name = "unicast";
744 ok_goal = 4; 760 ok_goal = 4;
745 } 761 }
746 else if (strstr (argv[0], "_small_signal") != NULL) 762 else if (strstr (argv[0], "_small_signal") != NULL)
747 { 763 {
748 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SIGNAL\n"); 764 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SIGNAL\n");
749 test = P2P_SIGNAL; 765 test = P2P_SIGNAL;
750 test_name = "signal2"; 766 test_name = "signal";
751 ok_goal = 4; 767 ok_goal = 4;
752 } 768 }
753 else if (strstr (argv[0], "_small_speed_ack") != NULL) 769 else if (strstr (argv[0], "_small_speed_ack") != NULL)
@@ -762,7 +778,7 @@ main (int argc, char *argv[])
762 */ 778 */
763 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SPEED_ACK\n"); 779 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SPEED_ACK\n");
764 test = SPEED_ACK; 780 test = SPEED_ACK;
765 test_name = "speed2 ack"; 781 test_name = "speed ack";
766 ok_goal = TOTAL_PACKETS * 2 + 2; 782 ok_goal = TOTAL_PACKETS * 2 + 2;
767 } 783 }
768 else if (strstr (argv[0], "_small_speed") != NULL) 784 else if (strstr (argv[0], "_small_speed") != NULL)
@@ -780,12 +796,18 @@ main (int argc, char *argv[])
780 if (strstr (argv[0], "_nobuf") != NULL) 796 if (strstr (argv[0], "_nobuf") != NULL)
781 { 797 {
782 test = SPEED_NOBUF; 798 test = SPEED_NOBUF;
783 test_name = "speed2 nobuf"; 799 test_name = "speed nobuf";
800 }
801 else if (strstr (argv[0], "_reliable") != NULL)
802 {
803 test = SPEED_REL;
804 test_name = "speed reliable";
805 config_file = "test_mesh_drop.conf";
784 } 806 }
785 else 807 else
786 { 808 {
787 test = SPEED; 809 test = SPEED;
788 test_name = "speed2"; 810 test_name = "speed";
789 } 811 }
790 } 812 }
791 else 813 else
@@ -810,7 +832,7 @@ main (int argc, char *argv[])
810 ports[0] = 1; 832 ports[0] = 1;
811 ports[1] = 0; 833 ports[1] = 0;
812 GNUNET_MESH_TEST_run ("test_mesh_small", 834 GNUNET_MESH_TEST_run ("test_mesh_small",
813 "test_mesh.conf", 835 config_file,
814 5, 836 5,
815 &tmain, 837 &tmain,
816 NULL, /* tmain cls */ 838 NULL, /* tmain cls */