2 This file is part of GNUnet.
3 (C) 2009, 2012 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
21 * @file topology/test_gnunet_daemon_topology.c
22 * @brief testcase for topology maintenance code
25 #include "gnunet_testbed_service.h"
31 * How long until we give up on connecting the peers?
33 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
38 static unsigned int connect_left;
42 notify_connect_complete (void *cls,
43 struct GNUNET_TESTBED_Operation *op,
46 GNUNET_TESTBED_operation_done (op);
49 FPRINTF (stderr, "Failed to connect two peers: %s\n", emsg);
50 GNUNET_SCHEDULER_shutdown ();
55 if (0 == connect_left)
57 /* FIXME: check that topology adds a few more links
58 * in addition to those that were seeded */
59 GNUNET_SCHEDULER_shutdown ();
65 do_connect (void *cls,
66 struct GNUNET_TESTBED_RunHandle *h,
67 unsigned int num_peers,
68 struct GNUNET_TESTBED_Peer **peers,
69 unsigned int links_succeeded,
70 unsigned int links_failed)
74 GNUNET_assert (NUM_PEERS == num_peers);
75 for (i=0;i<num_peers-1;i++)
78 GNUNET_TESTBED_overlay_connect (NULL,
79 ¬ify_connect_complete, NULL,
80 peers[i], peers[i+1]);
86 main (int argc, char *argv[])
88 (void) GNUNET_TESTBED_test_run ("test-gnunet-daemon-topology",
89 "test_gnunet_daemon_topology_data.conf",
93 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-topology");
97 /* end of test_gnunet_daemon_topology.c */