2 This file is part of GNUnet.
3 Copyright (C) 2009, 2013 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
16 * @file dv/test_transport_dv.c
17 * @brief base testcase for testing distance vector transport
20 #include "gnunet_core_service.h"
21 #include "gnunet_testbed_service.h"
24 * Return value from main, set to 0 on success.
28 struct GNUNET_TESTBED_Operation *topology_op;
30 static struct GNUNET_SCHEDULER_Task * shutdown_task;
34 do_shutdown (void *cls)
37 if (NULL != topology_op)
39 GNUNET_TESTBED_operation_done (topology_op);
46 topology_completed (void *cls,
47 unsigned int nsuccess,
48 unsigned int nfailures)
50 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
51 "Links successful %u / %u failed\n",
54 GNUNET_TESTBED_operation_done (topology_op);
60 "Error: links successful %u but %u failed\n",
68 GNUNET_SCHEDULER_shutdown ();
73 test_connection (void *cls,
74 struct GNUNET_TESTBED_RunHandle *h,
75 unsigned int num_peers,
76 struct GNUNET_TESTBED_Peer **peers,
77 unsigned int links_succeeded,
78 unsigned int links_failed)
80 shutdown_task = GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
86 "Only %u out of 4 peers were started ...\n",
90 if (0 != links_failed)
92 /* All peers except DV peers are connected */
94 "Testbed failed to connect peers (%u links OK, %u links failed)\n",
98 topology_op = GNUNET_TESTBED_overlay_configure_topology
99 (NULL, num_peers, peers, NULL,
100 &topology_completed, NULL,
101 GNUNET_TESTBED_TOPOLOGY_CLIQUE,
102 GNUNET_TESTBED_TOPOLOGY_OPTION_END);
108 "Testbed connected peers, should not happen...\n");
109 GNUNET_SCHEDULER_shutdown ();
114 main (int argc, char *argv[])
117 /* Connecting initial topology */
118 (void) GNUNET_TESTBED_test_run ("test-transport-dv",
119 "test_transport_dv_data.conf",
122 &test_connection, NULL);
126 /* end of test_transport_dv.c */