From ade9098f026f851b7eea0b0d67c5a2e20c0c4501 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Wed, 25 Sep 2013 09:24:05 +0000 Subject: updated test --- src/dv/template_dv.conf | 1 + src/dv/test_transport_dv.c | 54 +++++++++++++++++++++++++++++++++++----------- 2 files changed, 43 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/dv/template_dv.conf b/src/dv/template_dv.conf index 812b6975c..69f5ca4f2 100644 --- a/src/dv/template_dv.conf +++ b/src/dv/template_dv.conf @@ -21,6 +21,7 @@ OVERLAY_TOPOLOGY = CLIQUE SETUP_TIMEOUT = 1 m OPERATION_TIMEOUT = 5 s +CACHE_SIZE = 0 [transport-blacklist-OF84RAOAU2B1SOSEHJH6350MA0F7C98U55RI76LGIQOM7O33TFHPNUFB47CDBSCOLIINMVJ2U82445ABOBQRIVREG20L31KVDV5HG60] 548J7M14O4I0F8I84U0UFARVJ97DB6QOT3MCA8O8SNAIT5JJ8TR95LUVAP3N5L7DN33IB49SNMF3Q3C0VPLTGP9ASCULA9S2OIMHHH8 = tcp diff --git a/src/dv/test_transport_dv.c b/src/dv/test_transport_dv.c index 0b021e92e..898ea7fd5 100644 --- a/src/dv/test_transport_dv.c +++ b/src/dv/test_transport_dv.c @@ -30,6 +30,28 @@ */ static int ok; +struct GNUNET_TESTBED_Operation *topology_op; + +static void topology_completed (void *cls, + unsigned int nsuccess, + unsigned int nfailures) +{ + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Links successful %u / %u failed\n", nsuccess, nfailures); + GNUNET_TESTBED_operation_done (topology_op); + topology_op = NULL; + + if (nfailures > 0) + { + fprintf (stderr, "Error: links successful %u but %u failed\n", nsuccess, nfailures); + ok = 1; + } + else + ok = 0; + + GNUNET_SCHEDULER_shutdown (); +} + + static void test_connection (void *cls, struct GNUNET_TESTBED_RunHandle *h, @@ -38,22 +60,29 @@ test_connection (void *cls, unsigned int links_succeeded, unsigned int links_failed) { - int c; - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Links successful %u / %u failed\n", links_succeeded, links_failed); - - if ( (4 != num_peers) || (0 != links_failed) ) + if (4 != num_peers) { - fprintf (stderr, "Testbed failed to connect peers\n"); - GNUNET_SCHEDULER_shutdown (); - return; + ok = 1; + fprintf (stderr, "Only %u out of 4 peers were started ...\n", + num_peers); } - ok = 0; - if (1) + + if (0 != links_failed) { - GNUNET_SCHEDULER_shutdown (); + /* All peers except DV peers are connected */ + fprintf (stderr, "Testbed failed to connect peers,\n"); + + topology_op = GNUNET_TESTBED_overlay_configure_topology(NULL, num_peers, peers, NULL, + &topology_completed, NULL, + GNUNET_TESTBED_TOPOLOGY_CLIQUE, + GNUNET_TESTBED_TOPOLOGY_OPTION_END); + return; } - else - fprintf (stderr, "Test passed, press CTRL-C to shut down\n"); + + ok = 1; + fprintf (stderr, "Testbed connected peers, should not happen...\n"); + GNUNET_SCHEDULER_shutdown (); + } @@ -61,6 +90,7 @@ int main (int argc, char *argv[]) { ok = 1; + /* Connecting initial topology */ (void) GNUNET_TESTBED_test_run ("test-transport-dv", "test_transport_dv_data.conf", 4, -- cgit v1.2.3