2 This file is part of GNUnet.
3 (C) 2011 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 mesh/test_mesh_2dtorus.c
23 * @brief Test for creating a 2dtorus.
26 #include "mesh_test_lib.h"
27 #include "gnunet_mesh_service.h"
29 #define REMOVE_DIR GNUNET_YES
32 * How long until we give up on connecting the peers?
34 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1500)
37 * Time to wait for stuff that should be rather fast
39 #define SHORT_TIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
43 * How many events have happened
48 * Total number of currently running peers.
50 static unsigned long long peers_running;
55 static GNUNET_SCHEDULER_TaskIdentifier timeout_task;
59 shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
61 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutting down test\n");
66 * test main: start test when all peers are connected
69 * @param ctx Argument to give to GNUNET_MESH_TEST_cleanup on test end.
70 * @param num_peers Number of peers that are running.
71 * @param peers Array of peers.
72 * @param meshes Handle to each of the MESHs of the peers.
76 struct GNUNET_MESH_TEST_Context *ctx,
77 unsigned int num_peers,
78 struct GNUNET_TESTBED_Peer **peers,
79 struct GNUNET_MESH_Handle **meshes)
83 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
84 "running peers mismatch, aborting test!\n");
86 GNUNET_MESH_TEST_cleanup (ctx);
89 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
90 "testbed started successfully with ?? connections\n");
91 peers_running = num_peers;
92 timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
95 GNUNET_MESH_TEST_cleanup (ctx);
103 main (int argc, char *argv[])
105 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Start\n");
108 GNUNET_MESH_TEST_run ("test_mesh_2dtorus",
109 "test_mesh_2dtorus.conf",
121 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "FAILED!\n");
124 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "success\n");
128 /* end of test_mesh_2dtorus.c */