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 unsigned int num_peers,
67 struct GNUNET_TESTBED_Peer **peers)
71 GNUNET_assert (NUM_PEERS == num_peers);
72 for (i=0;i<num_peers-1;i++)
75 GNUNET_TESTBED_overlay_connect (NULL,
76 ¬ify_connect_complete, NULL,
77 peers[i], peers[i+1]);
83 main (int argc, char *argv[])
85 (void) GNUNET_TESTBED_test_run ("test-gnunet-daemon-topology",
86 "test_gnunet_daemon_topology_data.conf",
90 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-topology");
94 /* end of test_gnunet_daemon_topology.c */