From 3c6d81413f88a28c4cac0625af2ba9a5dc7239d6 Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Fri, 23 May 2014 00:37:47 +0000 Subject: [PATCH] - perform tests with only 2 peers for basic P2P test and with 5 peer line for testing of relay peers --- src/cadet/test_cadet.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c index ba636abc3..cd4c1c1df 100644 --- a/src/cadet/test_cadet.c +++ b/src/cadet/test_cadet.c @@ -820,15 +820,16 @@ tmain (void *cls, struct GNUNET_CADET_TEST_Context *ctx, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, - struct GNUNET_CADET_Handle **cadetes) + struct GNUNET_CADET_Handle **cadets) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test main\n"); ok = 0; test_ctx = ctx; peers_running = num_peers; + GNUNET_assert (peers_running == peers_requested); testbed_peers = peers; - h1 = cadetes[0]; - h2 = cadetes[num_peers - 1]; + h1 = cadets[0]; + h2 = cadets[num_peers - 1]; disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, &disconnect_cadet_peers, (void *) __LINE__); @@ -858,6 +859,22 @@ main (int argc, char *argv[]) config_file = "test_cadet.conf"; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Start\n"); + if (strstr (argv[0], "test_direct") != NULL) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "DIRECT CONNECTIONs\n"); + peers_requested = 2; + } + else if (strstr (argv[0], "test_small") != NULL) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "5 PEER LINE\n"); + peers_requested = 5; + } + else + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "SIZE UNKNOWN\n"); + return 1; + } + if (strstr (argv[0], "_cadet_forward") != NULL) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "FORWARD\n"); @@ -937,7 +954,7 @@ main (int argc, char *argv[]) ports[1] = 0; GNUNET_CADET_TEST_run ("test_cadet_small", config_file, - 5, + peers_requested, &tmain, NULL, /* tmain cls */ &incoming_channel, -- 2.25.1