2 This file is part of GNUnet
3 (C) 2008, 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.
22 * @file testing/testing_group.c
23 * @brief convenience API for writing testcases for GNUnet
24 * @author Christian Grothoff
27 #include "gnunet_arm_service.h"
28 #include "gnunet_testing_lib.h"
32 * Handle to a group of GNUnet peers.
34 struct GNUNET_TESTING_PeerGroup
40 * Start count gnunetd processes with the same set of transports and
41 * applications. The port numbers (any option called "PORT") will be
42 * adjusted to ensure that no two peers running on the same system
43 * have the same port(s) in their respective configurations.
45 * @param sched scheduler to use
46 * @param cfg configuration template to use
47 * @param total number of daemons to start
48 * @param cb function to call on each daemon that was started
49 * @param cb_cls closure for cb
50 * @param hostname where to run the peers; can be NULL (to run
51 * everything on localhost).
52 * @param va Additional hosts can be specified using a NULL-terminated list of
53 * varargs, hosts will then be used round-robin from that
54 * list; va only contains anything if hostname != NULL.
55 * @return NULL on error, otherwise handle to control peer group
57 struct GNUNET_TESTING_PeerGroup *
58 GNUNET_TESTING_daemons_start_va (struct GNUNET_SCHEDULER_Handle *sched,
59 const struct GNUNET_CONFIGURATION_Handle *cfg,
61 GNUNET_TESTING_NotifyDaemonRunning cb,
71 * Start count gnunetd processes with the same set of
72 * transports and applications. The port numbers will
73 * be computed by adding delta each time (zero
74 * times for the first peer).
76 * @param sched scheduler to use
77 * @param cfg configuration template to use
78 * @param total number of daemons to start
79 * @param timeout how long is this allowed to take?
80 * @param cb function to call on each daemon that was started
81 * @param cb_cls closure for cb
82 * @param hostname where to run the peers; can be NULL (to run
83 * everything on localhost). Additional
84 * hosts can be specified using a NULL-terminated list of
85 * varargs, hosts will then be used round-robin from that
87 * @return NULL on error, otherwise handle to control peer group
89 struct GNUNET_TESTING_PeerGroup *
90 GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
91 struct GNUNET_CONFIGURATION_Handle *cfg,
93 GNUNET_TESTING_NotifyDaemonRunning cb,
101 va_start (va, hostname);
102 GNUNET_TESTING_daemons_start_va (sched, cfg,
103 total, service_home_prefix,
104 transports, applications,
105 cb, cb_cls, cbe, cbe_cls, hostname,
113 * Shutdown all peers started in the given group.
115 * @param pg handle to the peer group
118 GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg)
124 /* end of testing_group.c */