testing-update
[oweals/gnunet.git] / src / testing / testing_group.c
1 /*
2       This file is part of GNUnet
3       (C) 2008, 2009 Christian Grothoff (and other contributing authors)
4
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.
9
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.
14
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.
19  */
20
21 /**
22  * @file testing/testing_group.c
23  * @brief convenience API for writing testcases for GNUnet
24  * @author Christian Grothoff
25  */
26 #include "platform.h"
27 #include "gnunet_arm_service.h"
28 #include "gnunet_testing_lib.h"
29
30
31 /**
32  * Handle to a group of GNUnet peers.
33  */
34 struct GNUNET_TESTING_PeerGroup
35 {
36 };
37
38
39 /**
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.
44  *
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
56  */
57 struct GNUNET_TESTING_PeerGroup *
58 GNUNET_TESTING_daemons_start_va (struct GNUNET_SCHEDULER_Handle *sched,
59                                  const struct GNUNET_CONFIGURATION_Handle *cfg,
60                                  unsigned int total,
61                                  GNUNET_TESTING_NotifyDaemonRunning cb,
62                                  void *cb_cls,
63                                  const char *hostname,
64                                  va_list va)
65 {
66   return NULL;
67 }
68
69
70 /**
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).
75  *
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
86  *        list.
87  * @return NULL on error, otherwise handle to control peer group
88  */
89 struct GNUNET_TESTING_PeerGroup *
90 GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
91                               struct GNUNET_CONFIGURATION_Handle *cfg,
92                               unsigned int total,
93                               GNUNET_TESTING_NotifyDaemonRunning cb,
94                               void *cb_cls,
95                               const char *hostname,
96                               ...)
97
98 {
99   va_list va;
100   
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,
106                                    va);
107   va_end (va);
108 }
109
110
111
112 /**
113  * Shutdown all peers started in the given group.
114  * 
115  * @param pg handle to the peer group
116  */
117 void
118 GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg)
119
120 {
121 }
122
123
124 /* end of testing_group.c */