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.
16 * @file topology/test_gnunet_daemon_topology.c
17 * @brief testcase for topology maintenance code
20 #include "gnunet_testbed_service.h"
26 * How long until we give up on connecting the peers?
28 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
33 static unsigned int connect_left;
37 notify_connect_complete (void *cls,
38 struct GNUNET_TESTBED_Operation *op,
41 GNUNET_TESTBED_operation_done (op);
44 FPRINTF (stderr, "Failed to connect two peers: %s\n", emsg);
45 GNUNET_SCHEDULER_shutdown ();
50 if (0 == connect_left)
52 /* FIXME: check that topology adds a few more links
53 * in addition to those that were seeded */
54 GNUNET_SCHEDULER_shutdown ();
60 do_connect (void *cls,
61 struct GNUNET_TESTBED_RunHandle *h,
62 unsigned int num_peers,
63 struct GNUNET_TESTBED_Peer **peers,
64 unsigned int links_succeeded,
65 unsigned int links_failed)
69 GNUNET_assert (NUM_PEERS == num_peers);
70 for (i=0;i<num_peers-1;i++)
73 GNUNET_TESTBED_overlay_connect (NULL,
74 ¬ify_connect_complete, NULL,
75 peers[i], peers[i+1]);
81 main (int argc, char *argv[])
83 (void) GNUNET_TESTBED_test_run ("test-gnunet-daemon-topology",
84 "test_gnunet_daemon_topology_data.conf",
88 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-topology");
92 /* end of test_gnunet_daemon_topology.c */