2 This file is part of GNUnet.
3 Copyright (C) 2009, 2012 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero 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.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * @file topology/test_gnunet_daemon_topology.c
20 * @brief testcase for topology maintenance code
23 #include "gnunet_testbed_service.h"
29 * How long until we give up on connecting the peers?
31 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
36 static unsigned int connect_left;
40 notify_connect_complete (void *cls,
41 struct GNUNET_TESTBED_Operation *op,
44 GNUNET_TESTBED_operation_done (op);
47 FPRINTF (stderr, "Failed to connect two peers: %s\n", emsg);
48 GNUNET_SCHEDULER_shutdown ();
53 if (0 == connect_left)
55 /* FIXME: check that topology adds a few more links
56 * in addition to those that were seeded */
57 GNUNET_SCHEDULER_shutdown ();
63 do_connect (void *cls,
64 struct GNUNET_TESTBED_RunHandle *h,
65 unsigned int num_peers,
66 struct GNUNET_TESTBED_Peer **peers,
67 unsigned int links_succeeded,
68 unsigned int links_failed)
72 GNUNET_assert (NUM_PEERS == num_peers);
73 for (i=0;i<num_peers-1;i++)
76 GNUNET_TESTBED_overlay_connect (NULL,
77 ¬ify_connect_complete, NULL,
78 peers[i], peers[i+1]);
84 main (int argc, char *argv[])
86 (void) GNUNET_TESTBED_test_run ("test-gnunet-daemon-topology",
87 "test_gnunet_daemon_topology_data.conf",
91 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-topology");
95 /* end of test_gnunet_daemon_topology.c */