aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxrs <xrs@mail36.net>2017-08-02 23:37:07 +0200
committerxrs <xrs@mail36.net>2017-08-02 23:37:07 +0200
commit2ee79796bd4693a43f20f984a781ffcaf0e4df10 (patch)
tree0b561fd03327e845f07f730d97cc43f824580b9d
parent09d06d08c6a55abc81557a87a778660f739ba327 (diff)
downloadgnunet-2ee79796bd4693a43f20f984a781ffcaf0e4df10.tar.gz
gnunet-2ee79796bd4693a43f20f984a781ffcaf0e4df10.zip
test_multicast: test 12 peers in line and star topology
-rw-r--r--src/multicast/Makefile.am14
-rw-r--r--src/multicast/test_multicast_line.conf60
-rw-r--r--src/multicast/test_multicast_multipeer.c46
-rw-r--r--src/multicast/test_multicast_star.conf (renamed from src/multicast/test_multicast.conf)14
4 files changed, 109 insertions, 25 deletions
diff --git a/src/multicast/Makefile.am b/src/multicast/Makefile.am
index f26c6ef4b..13212bca3 100644
--- a/src/multicast/Makefile.am
+++ b/src/multicast/Makefile.am
@@ -51,7 +51,8 @@ gnunet_service_multicast_LDADD = \
51 51
52check_PROGRAMS = \ 52check_PROGRAMS = \
53 test_multicast \ 53 test_multicast \
54 test_multicast_multipeer 54 test_multicast_multipeer_star \
55 test_multicast_multipeer_line
55# test_multicast_2peers 56# test_multicast_2peers
56 57
57if ENABLE_TEST_RUN 58if ENABLE_TEST_RUN
@@ -65,10 +66,15 @@ test_multicast_LDADD = \
65 libgnunetmulticast.la \ 66 libgnunetmulticast.la \
66 $(top_builddir)/src/testing/libgnunettesting.la \ 67 $(top_builddir)/src/testing/libgnunettesting.la \
67 $(top_builddir)/src/util/libgnunetutil.la 68 $(top_builddir)/src/util/libgnunetutil.la
68 69test_multicast_multipeer_star_SOURCES = \
69test_multicast_multipeer_SOURCES = \ 70 test_multicast_multipeer.c
71test_multicast_multipeer_star_LDADD = \
72 libgnunetmulticast.la \
73 $(top_builddir)/src/testbed/libgnunettestbed.la \
74 $(top_builddir)/src/util/libgnunetutil.la
75test_multicast_multipeer_line_SOURCES = \
70 test_multicast_multipeer.c 76 test_multicast_multipeer.c
71test_multicast_multipeer_LDADD = \ 77test_multicast_multipeer_line_LDADD = \
72 libgnunetmulticast.la \ 78 libgnunetmulticast.la \
73 $(top_builddir)/src/testbed/libgnunettestbed.la \ 79 $(top_builddir)/src/testbed/libgnunettestbed.la \
74 $(top_builddir)/src/util/libgnunetutil.la 80 $(top_builddir)/src/util/libgnunetutil.la
diff --git a/src/multicast/test_multicast_line.conf b/src/multicast/test_multicast_line.conf
new file mode 100644
index 000000000..23358e565
--- /dev/null
+++ b/src/multicast/test_multicast_line.conf
@@ -0,0 +1,60 @@
1[testbed]
2HOSTNAME = localhost
3OVERLAY_TOPOLOGY = LINE
4
5[arm]
6GLOBAL_POSTFIX=-L ERROR
7
8[multicast]
9#PREFIX = tmux new-window gdb -x ./cmd.gdb --args
10#PREFIX = valgrind --leak-check=full
11UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-multicast.sock
12
13[vpn]
14AUTOSTART = NO
15
16[peerinfo]
17# Do not use shipped gnunet HELLOs
18USE_INCLUDED_HELLOS = NO
19
20# Option to disable all disk IO; only useful for testbed runs
21# (large-scale experiments); disables persistence of HELLOs!
22NO_IO = YES
23
24[cadet]
25ID_ANNOUNCE_TIME = 5 s
26
27[hostlist]
28FORCESTART = NO
29AUTOSTART = NO
30
31[nat]
32ENABLE_UPNP = NO
33
34[fs]
35FORCESTART = NO
36AUTOSTART = NO
37
38[vpn]
39FORCESTART = NO
40AUTOSTART = NO
41
42[revocation]
43FORCESTART = NO
44AUTOSTART = NO
45
46[gns]
47FORCESTART = NO
48AUTOSTART = NO
49
50[namestore]
51FORCESTART = NO
52AUTOSTART = NO
53
54[namecache]
55FORCESTART = NO
56AUTOSTART = NO
57
58[topology]
59FORCESTART = NO
60AUTOSTART = NO
diff --git a/src/multicast/test_multicast_multipeer.c b/src/multicast/test_multicast_multipeer.c
index 29ee1e48f..5f4493993 100644
--- a/src/multicast/test_multicast_multipeer.c
+++ b/src/multicast/test_multicast_multipeer.c
@@ -33,7 +33,7 @@
33#include "gnunet_testbed_service.h" 33#include "gnunet_testbed_service.h"
34#include "gnunet_multicast_service.h" 34#include "gnunet_multicast_service.h"
35 35
36#define NUM_PEERS 10 36#define PEERS_REQUESTED 12
37 37
38struct multicast_peer 38struct multicast_peer
39{ 39{
@@ -65,11 +65,11 @@ static struct multicast_peer **mc_peers;
65static struct GNUNET_TESTBED_Peer **peers; 65static struct GNUNET_TESTBED_Peer **peers;
66 66
67// FIXME: refactor 67// FIXME: refactor
68static struct GNUNET_TESTBED_Operation *op[NUM_PEERS]; 68static struct GNUNET_TESTBED_Operation *op[PEERS_REQUESTED];
69static struct GNUNET_TESTBED_Operation *pi_op[NUM_PEERS]; 69static struct GNUNET_TESTBED_Operation *pi_op[PEERS_REQUESTED];
70 70
71static struct GNUNET_MULTICAST_Origin *origin; 71static struct GNUNET_MULTICAST_Origin *origin;
72static struct GNUNET_MULTICAST_Member *member[NUM_PEERS]; /* first element always empty */ 72static struct GNUNET_MULTICAST_Member *member[PEERS_REQUESTED]; /* first element always empty */
73 73
74static struct GNUNET_SCHEDULER_Task *timeout_tid; 74static struct GNUNET_SCHEDULER_Task *timeout_tid;
75 75
@@ -77,8 +77,8 @@ static struct GNUNET_CRYPTO_EddsaPrivateKey group_key;
77static struct GNUNET_CRYPTO_EddsaPublicKey group_pub_key; 77static struct GNUNET_CRYPTO_EddsaPublicKey group_pub_key;
78static struct GNUNET_HashCode group_pub_key_hash; 78static struct GNUNET_HashCode group_pub_key_hash;
79 79
80static struct GNUNET_CRYPTO_EcdsaPrivateKey *member_key[NUM_PEERS]; 80static struct GNUNET_CRYPTO_EcdsaPrivateKey *member_key[PEERS_REQUESTED];
81static struct GNUNET_CRYPTO_EcdsaPublicKey *member_pub_key[NUM_PEERS]; 81static struct GNUNET_CRYPTO_EcdsaPublicKey *member_pub_key[PEERS_REQUESTED];
82 82
83 83
84/** 84/**
@@ -93,7 +93,7 @@ static int result;
93static void 93static void
94shutdown_task (void *cls) 94shutdown_task (void *cls)
95{ 95{
96 for (int i=0;i<NUM_PEERS;i++) 96 for (int i=0;i<PEERS_REQUESTED;i++)
97 { 97 {
98 if (NULL != op[i]) 98 if (NULL != op[i])
99 { 99 {
@@ -109,7 +109,7 @@ shutdown_task (void *cls)
109 109
110 if (NULL != mc_peers) 110 if (NULL != mc_peers)
111 { 111 {
112 for (int i=0; i < NUM_PEERS; i++) 112 for (int i=0; i < PEERS_REQUESTED; i++)
113 { 113 {
114 GNUNET_free (mc_peers[i]); 114 GNUNET_free (mc_peers[i]);
115 mc_peers[i] = NULL; 115 mc_peers[i] = NULL;
@@ -232,7 +232,7 @@ member_message (void *cls,
232 } 232 }
233 233
234 // Test for completeness of received PONGs 234 // Test for completeness of received PONGs
235 for (int i=1; i<NUM_PEERS; i++) 235 for (int i=1; i<PEERS_REQUESTED; i++)
236 if (GNUNET_NO == mc_peers[i]->test_ok) 236 if (GNUNET_NO == mc_peers[i]->test_ok)
237 return; 237 return;
238 238
@@ -313,7 +313,7 @@ origin_notify (void *cls,
313 *data_size = sizeof (struct pingpong_msg); 313 *data_size = sizeof (struct pingpong_msg);
314 memcpy(data, pp_msg, *data_size); 314 memcpy(data, pp_msg, *data_size);
315 315
316 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin sends pong (to all)\n"); 316 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin sends pong\n");
317 317
318 return GNUNET_YES; 318 return GNUNET_YES;
319} 319}
@@ -520,7 +520,7 @@ service_connect (void *cls,
520 if (0 == mc_peer->peer) 520 if (0 == mc_peer->peer)
521 { 521 {
522 // Get GNUnet identity of members 522 // Get GNUnet identity of members
523 for (int i = 0; i<NUM_PEERS; i++) 523 for (int i = 0; i<PEERS_REQUESTED; i++)
524 { 524 {
525 pi_op[i] = GNUNET_TESTBED_peer_get_information (peers[i], 525 pi_op[i] = GNUNET_TESTBED_peer_get_information (peers[i],
526 GNUNET_TESTBED_PIT_IDENTITY, 526 GNUNET_TESTBED_PIT_IDENTITY,
@@ -544,7 +544,7 @@ service_connect (void *cls,
544 * @param cls closure 544 * @param cls closure
545 * @param h the run handle 545 * @param h the run handle
546 * @param peers started peers for the test 546 * @param peers started peers for the test
547 * @param num_peers size of the 'peers' array 547 * @param PEERS_REQUESTED size of the 'peers' array
548 * @param links_succeeded number of links between peers that were created 548 * @param links_succeeded number of links between peers that were created
549 * @param links_failed number of links testbed was unable to establish 549 * @param links_failed number of links testbed was unable to establish
550 */ static void 550 */ static void
@@ -563,10 +563,10 @@ testbed_master (void *cls,
563 563
564 peers = p; 564 peers = p;
565 565
566 mc_peers = GNUNET_new_array (NUM_PEERS, struct multicast_peer*); 566 mc_peers = GNUNET_new_array (PEERS_REQUESTED, struct multicast_peer*);
567 567
568 // Create test contexts for members 568 // Create test contexts for members
569 for (int i = 0; i<NUM_PEERS; i++) 569 for (int i = 0; i<PEERS_REQUESTED; i++)
570 { 570 {
571 mc_peers[i] = GNUNET_new (struct multicast_peer); 571 mc_peers[i] = GNUNET_new (struct multicast_peer);
572 mc_peers[i]->peer = i; 572 mc_peers[i]->peer = i;
@@ -600,12 +600,26 @@ int
600main (int argc, char *argv[]) 600main (int argc, char *argv[])
601{ 601{
602 int ret; 602 int ret;
603 char const *config_file;
604
605 if (strstr (argv[0], "_line") != NULL)
606 {
607 config_file = "test_multicast_line.conf";
608 }
609 else if (strstr(argv[0], "_star") != NULL)
610 {
611 config_file = "test_multicast_star.conf";
612 }
613 else
614 {
615 config_file = "test_multicast_star.conf";
616 }
603 617
604 result = GNUNET_SYSERR; 618 result = GNUNET_SYSERR;
605 ret = GNUNET_TESTBED_test_run 619 ret = GNUNET_TESTBED_test_run
606 ("test-multicast-multipeer", /* test case name */ 620 ("test-multicast-multipeer", /* test case name */
607 "test_multicast.conf", /* template configuration */ 621 config_file, /* template configuration */
608 NUM_PEERS, /* number of peers to start */ 622 PEERS_REQUESTED, /* number of peers to start */
609 0LL, /* Event mask - set to 0 for no event notifications */ 623 0LL, /* Event mask - set to 0 for no event notifications */
610 NULL, /* Controller event callback */ 624 NULL, /* Controller event callback */
611 NULL, /* Closure for controller event callback */ 625 NULL, /* Closure for controller event callback */
diff --git a/src/multicast/test_multicast.conf b/src/multicast/test_multicast_star.conf
index 45bf39618..8eb98d986 100644
--- a/src/multicast/test_multicast.conf
+++ b/src/multicast/test_multicast_star.conf
@@ -5,12 +5,9 @@ OVERLAY_TOPOLOGY = STAR
5[arm] 5[arm]
6GLOBAL_POSTFIX=-L ERROR 6GLOBAL_POSTFIX=-L ERROR
7 7
8[hostlist]
9# Do not use a hostlist server
10SERVERS =
11
12[multicast] 8[multicast]
13#PREFIX = tmux split-window -v gdb -x ./cmd.gdb --args 9#PREFIX = tmux new-window gdb -x ./cmd.gdb --args
10#PREFIX = valgrind --leak-check=full
14UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-multicast.sock 11UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-multicast.sock
15 12
16[vpn] 13[vpn]
@@ -24,6 +21,13 @@ USE_INCLUDED_HELLOS = NO
24# (large-scale experiments); disables persistence of HELLOs! 21# (large-scale experiments); disables persistence of HELLOs!
25NO_IO = YES 22NO_IO = YES
26 23
24[cadet]
25ID_ANNOUNCE_TIME = 5 s
26
27[hostlist]
28FORCESTART = NO
29AUTOSTART = NO
30
27[nat] 31[nat]
28ENABLE_UPNP = NO 32ENABLE_UPNP = NO
29 33