aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/test_testbed_api.c
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-07-18 13:03:17 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-07-18 13:03:17 +0000
commit1a956f969b0166ee609a88d37ace19486bd6bcee (patch)
tree8a027bd38fa951dbe4f5273bdc3c33243d2a8342 /src/testbed/test_testbed_api.c
parent41f993ffa4aeb530a26fba43a1e69c776633ed11 (diff)
downloadgnunet-1a956f969b0166ee609a88d37ace19486bd6bcee.tar.gz
gnunet-1a956f969b0166ee609a88d37ace19486bd6bcee.zip
fix; modified testcase for test_testbed_api; valigrind suppression for zlib
Diffstat (limited to 'src/testbed/test_testbed_api.c')
-rw-r--r--src/testbed/test_testbed_api.c44
1 files changed, 31 insertions, 13 deletions
diff --git a/src/testbed/test_testbed_api.c b/src/testbed/test_testbed_api.c
index 9bdae1fb0..6378fd9cc 100644
--- a/src/testbed/test_testbed_api.c
+++ b/src/testbed/test_testbed_api.c
@@ -171,23 +171,21 @@ registration_comp (void *cls, const char *emsg)
171 171
172 172
173/** 173/**
174 * Main run function. 174 * Callback to signal successfull startup of the controller process
175 * 175 *
176 * @param cls NULL 176 * @param cls the closure from GNUNET_TESTBED_controller_start()
177 * @param args arguments passed to GNUNET_PROGRAM_run 177 * @param cfg the configuration with which the controller has been started;
178 * @param cfgfile the path to configuration file 178 * NULL if status is not GNUNET_OK
179 * @param cfg the configuration file handle 179 * @param status GNUNET_OK if the startup is successfull; GNUNET_SYSERR if not,
180 * GNUNET_TESTBED_controller_stop() shouldn't be called in this case
180 */ 181 */
181static void 182static void
182run (void *cls, char *const *args, const char *cfgfile, 183status_cb (void *cls,
183 const struct GNUNET_CONFIGURATION_Handle *config) 184 const struct GNUNET_CONFIGURATION_Handle *cfg, int status)
184{ 185{
185 uint64_t event_mask; 186 uint64_t event_mask;
186 187
187 host = GNUNET_TESTBED_host_create (NULL, NULL, 0); 188 GNUNET_assert (GNUNET_OK == status);
188 GNUNET_assert (NULL != host);
189 cfg = GNUNET_CONFIGURATION_dup (config);
190 cp = GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, NULL, NULL);
191 event_mask = 0; 189 event_mask = 0;
192 event_mask |= (1L << GNUNET_TESTBED_ET_PEER_START); 190 event_mask |= (1L << GNUNET_TESTBED_ET_PEER_START);
193 event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP); 191 event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP);
@@ -201,7 +199,27 @@ run (void *cls, char *const *args, const char *cfgfile,
201 reg_handle = 199 reg_handle =
202 GNUNET_TESTBED_register_host (controller, neighbour, &registration_comp, 200 GNUNET_TESTBED_register_host (controller, neighbour, &registration_comp,
203 neighbour); 201 neighbour);
204 GNUNET_assert (NULL != reg_handle); 202 GNUNET_assert (NULL != reg_handle);
203}
204
205
206
207/**
208 * Main run function.
209 *
210 * @param cls NULL
211 * @param args arguments passed to GNUNET_PROGRAM_run
212 * @param cfgfile the path to configuration file
213 * @param cfg the configuration file handle
214 */
215static void
216run (void *cls, char *const *args, const char *cfgfile,
217 const struct GNUNET_CONFIGURATION_Handle *config)
218{
219 host = GNUNET_TESTBED_host_create (NULL, NULL, 0);
220 GNUNET_assert (NULL != host);
221 cfg = GNUNET_CONFIGURATION_dup (config);
222 cp = GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb, NULL);
205 abort_task = GNUNET_SCHEDULER_add_delayed 223 abort_task = GNUNET_SCHEDULER_add_delayed
206 (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5), &do_abort, NULL); 224 (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5), &do_abort, NULL);
207} 225}