2 This file is part of GNUnet.
3 (C) 2009 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 2, 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 testing/test_testing_group_remote.c
22 * @brief testcase for testing remote and local starting and connecting
23 * of hosts from the testing library. The test_testing_data_remote.conf
24 * file should be modified if this testcase is intended to be used.
27 #include "gnunet_testing_lib.h"
29 #define VERBOSE GNUNET_YES
33 * How long until we give up on connecting the peers?
35 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
37 #define DEFAULT_NUM_PEERS 8;
41 static int peers_left;
43 static struct GNUNET_TESTING_PeerGroup *pg;
45 static struct GNUNET_SCHEDULER_Handle *sched;
47 static unsigned long long num_peers;
49 static char *hostnames;
54 const struct GNUNET_PeerIdentity *id,
55 const struct GNUNET_CONFIGURATION_Handle *cfg,
56 struct GNUNET_TESTING_Daemon *d, const char *emsg)
58 GNUNET_assert (id != NULL);
62 GNUNET_TESTING_daemons_stop (pg);
70 struct GNUNET_SCHEDULER_Handle *s,
72 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
77 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting daemons.\n");
81 GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers",
83 num_peers = DEFAULT_NUM_PEERS;
85 GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "hosts",
88 peers_left = num_peers;
89 pg = GNUNET_TESTING_daemons_start (sched, cfg,
91 &my_cb, NULL, NULL, NULL, hostnames);
92 GNUNET_assert (pg != NULL);
98 char *const argv[] = { "test-testing",
100 "test_testing_data_remote.conf",
106 struct GNUNET_GETOPT_CommandLineOption options[] = {
107 GNUNET_GETOPT_OPTION_END
109 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
110 argv, "test-testing-group", "nohelp",
116 main (int argc, char *argv[])
120 GNUNET_log_setup ("test-testing-group",
129 * Still need to remove the base testing directory here,
130 * because group starts will create subdirectories under this
131 * main dir. However, we no longer need to sleep, as the
132 * shutdown sequence won't return until everything is cleaned
135 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-testing");
139 /* end of test_testing_group.c */