aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/test_testbed_api_2peers_1controller.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testbed/test_testbed_api_2peers_1controller.c')
-rw-r--r--src/testbed/test_testbed_api_2peers_1controller.c396
1 files changed, 201 insertions, 195 deletions
diff --git a/src/testbed/test_testbed_api_2peers_1controller.c b/src/testbed/test_testbed_api_2peers_1controller.c
index dcb6a174f..23d9823f5 100644
--- a/src/testbed/test_testbed_api_2peers_1controller.c
+++ b/src/testbed/test_testbed_api_2peers_1controller.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -34,20 +34,19 @@
34/** 34/**
35 * Generic logging shortcut 35 * Generic logging shortcut
36 */ 36 */
37#define LOG(kind,...) \ 37#define LOG(kind, ...) \
38 GNUNET_log (kind, __VA_ARGS__) 38 GNUNET_log(kind, __VA_ARGS__)
39 39
40/** 40/**
41 * Relative time seconds shorthand 41 * Relative time seconds shorthand
42 */ 42 */
43#define TIME_REL_SECS(sec) \ 43#define TIME_REL_SECS(sec) \
44 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, sec) 44 GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, sec)
45 45
46/** 46/**
47 * Peer context 47 * Peer context
48 */ 48 */
49struct PeerContext 49struct PeerContext {
50{
51 /** 50 /**
52 * The peer handle 51 * The peer handle
53 */ 52 */
@@ -122,9 +121,7 @@ static struct GNUNET_SCHEDULER_Task * delayed_connect_task;
122/** 121/**
123 * Different stages in testing 122 * Different stages in testing
124 */ 123 */
125enum Stage 124enum Stage {
126{
127
128 /** 125 /**
129 * Initial stage 126 * Initial stage
130 */ 127 */
@@ -171,14 +168,14 @@ static enum Stage result;
171 * shortcut to exit during failure 168 * shortcut to exit during failure
172 */ 169 */
173#define FAIL_TEST(cond) do { \ 170#define FAIL_TEST(cond) do { \
174 if (!(cond)) { \ 171 if (!(cond)) { \
175 GNUNET_break(0); \ 172 GNUNET_break(0); \
176 if (NULL != abort_task) \ 173 if (NULL != abort_task) \
177 GNUNET_SCHEDULER_cancel (abort_task); \ 174 GNUNET_SCHEDULER_cancel (abort_task); \
178 abort_task = NULL; \ 175 abort_task = NULL; \
179 GNUNET_SCHEDULER_add_now (do_shutdown, NULL); \ 176 GNUNET_SCHEDULER_add_now(do_shutdown, NULL); \
180 return; \ 177 return; \
181 } \ 178 } \
182 } while (0) 179 } while (0)
183 180
184 181
@@ -188,20 +185,20 @@ static enum Stage result;
188 * @param cls NULL 185 * @param cls NULL
189 */ 186 */
190static void 187static void
191do_shutdown (void *cls) 188do_shutdown(void *cls)
192{ 189{
193 if (NULL != abort_task) 190 if (NULL != abort_task)
194 GNUNET_SCHEDULER_cancel (abort_task); 191 GNUNET_SCHEDULER_cancel(abort_task);
195 if (NULL != delayed_connect_task) 192 if (NULL != delayed_connect_task)
196 GNUNET_SCHEDULER_cancel (delayed_connect_task); 193 GNUNET_SCHEDULER_cancel(delayed_connect_task);
197 if (NULL != reg_handle) 194 if (NULL != reg_handle)
198 GNUNET_TESTBED_cancel_registration (reg_handle); 195 GNUNET_TESTBED_cancel_registration(reg_handle);
199 GNUNET_TESTBED_controller_disconnect (controller); 196 GNUNET_TESTBED_controller_disconnect(controller);
200 GNUNET_CONFIGURATION_destroy (cfg); 197 GNUNET_CONFIGURATION_destroy(cfg);
201 if (NULL != cp) 198 if (NULL != cp)
202 GNUNET_TESTBED_controller_stop (cp); 199 GNUNET_TESTBED_controller_stop(cp);
203 GNUNET_TESTBED_host_destroy (neighbour); 200 GNUNET_TESTBED_host_destroy(neighbour);
204 GNUNET_TESTBED_host_destroy (host); 201 GNUNET_TESTBED_host_destroy(host);
205} 202}
206 203
207 204
@@ -211,11 +208,11 @@ do_shutdown (void *cls)
211 * @param cls NULL 208 * @param cls NULL
212 */ 209 */
213static void 210static void
214do_abort (void *cls) 211do_abort(void *cls)
215{ 212{
216 LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); 213 LOG(GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n");
217 abort_task = NULL; 214 abort_task = NULL;
218 do_shutdown (cls); 215 do_shutdown(cls);
219} 216}
220 217
221 218
@@ -228,7 +225,7 @@ do_abort (void *cls)
228 * operation has executed successfully. 225 * operation has executed successfully.
229 */ 226 */
230static void 227static void
231op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg); 228op_comp_cb(void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg);
232 229
233 230
234/** 231/**
@@ -237,13 +234,13 @@ op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg);
237 * @param cls NULL 234 * @param cls NULL
238 */ 235 */
239static void 236static void
240do_delayed_connect (void *cls) 237do_delayed_connect(void *cls)
241{ 238{
242 delayed_connect_task = NULL; 239 delayed_connect_task = NULL;
243 FAIL_TEST (NULL == common_operation); 240 FAIL_TEST(NULL == common_operation);
244 common_operation = 241 common_operation =
245 GNUNET_TESTBED_overlay_connect (NULL, &op_comp_cb, NULL, peer1.peer, 242 GNUNET_TESTBED_overlay_connect(NULL, &op_comp_cb, NULL, peer1.peer,
246 peer2.peer); 243 peer2.peer);
247} 244}
248 245
249 246
@@ -256,24 +253,26 @@ do_delayed_connect (void *cls)
256 * operation has executed successfully. 253 * operation has executed successfully.
257 */ 254 */
258static void 255static void
259op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg) 256op_comp_cb(void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
260{ 257{
261 FAIL_TEST (common_operation == op); 258 FAIL_TEST(common_operation == op);
262 switch (result) 259 switch (result)
263 { 260 {
264 case PEERS_STARTED: 261 case PEERS_STARTED:
265 FAIL_TEST (NULL == peer1.operation); 262 FAIL_TEST(NULL == peer1.operation);
266 FAIL_TEST (NULL == peer2.operation); 263 FAIL_TEST(NULL == peer2.operation);
267 FAIL_TEST (NULL != common_operation); 264 FAIL_TEST(NULL != common_operation);
268 break; 265 break;
269 case PEERS_CONNECTED: 266
270 FAIL_TEST (NULL == peer1.operation); 267 case PEERS_CONNECTED:
271 FAIL_TEST (NULL == peer2.operation); 268 FAIL_TEST(NULL == peer1.operation);
272 FAIL_TEST (NULL != common_operation); 269 FAIL_TEST(NULL == peer2.operation);
273 break; 270 FAIL_TEST(NULL != common_operation);
274 default: 271 break;
275 FAIL_TEST (0); 272
276 } 273 default:
274 FAIL_TEST(0);
275 }
277} 276}
278 277
279 278
@@ -285,114 +284,121 @@ op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
285 * @param event information about the event 284 * @param event information about the event
286 */ 285 */
287static void 286static void
288controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) 287controller_cb(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
289{ 288{
290 switch (event->type) 289 switch (event->type)
291 {
292 case GNUNET_TESTBED_ET_OPERATION_FINISHED: /* Will be reached when we destroy peers */
293 FAIL_TEST (PEERS_STOPPED == result);
294 FAIL_TEST (NULL == event->op_cls);
295 FAIL_TEST (NULL == event->details.operation_finished.emsg);
296 FAIL_TEST (NULL == event->details.operation_finished.generic);
297 if (event->op == peer1.operation)
298 {
299 GNUNET_TESTBED_operation_done (peer1.operation);
300 peer1.operation = NULL;
301 peer1.peer = NULL;
302 }
303 else if (event->op == peer2.operation)
304 {
305 GNUNET_TESTBED_operation_done (peer2.operation);
306 peer2.operation = NULL;
307 peer2.peer = NULL;
308 }
309 else
310 FAIL_TEST (0);
311 if ((NULL == peer1.peer) && (NULL == peer2.peer))
312 {
313 result = SUCCESS;
314 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
315 }
316 break;
317 case GNUNET_TESTBED_ET_PEER_START:
318 FAIL_TEST (INIT == result);
319 FAIL_TEST (event->details.peer_start.host == host);
320 if (event->details.peer_start.peer == peer1.peer)
321 {
322 peer1.is_running = GNUNET_YES;
323 GNUNET_TESTBED_operation_done (peer1.operation);
324 peer1.operation = NULL;
325 }
326 else if (event->details.peer_start.peer == peer2.peer)
327 {
328 peer2.is_running = GNUNET_YES;
329 GNUNET_TESTBED_operation_done (peer2.operation);
330 peer2.operation = NULL;
331 }
332 else
333 FAIL_TEST (0);
334 if ((GNUNET_YES == peer1.is_running) && (GNUNET_YES == peer2.is_running))
335 {
336 result = PEERS_STARTED;
337 common_operation =
338 GNUNET_TESTBED_overlay_connect (NULL, &op_comp_cb, NULL, peer1.peer,
339 peer2.peer);
340 }
341 break;
342 case GNUNET_TESTBED_ET_PEER_STOP:
343 FAIL_TEST (PEERS_CONNECTED_2 == result);
344 if (event->details.peer_stop.peer == peer1.peer)
345 { 290 {
346 peer1.is_running = GNUNET_NO; 291 case GNUNET_TESTBED_ET_OPERATION_FINISHED: /* Will be reached when we destroy peers */
347 GNUNET_TESTBED_operation_done (peer1.operation); 292 FAIL_TEST(PEERS_STOPPED == result);
348 peer1.operation = GNUNET_TESTBED_peer_destroy (peer1.peer); 293 FAIL_TEST(NULL == event->op_cls);
349 } 294 FAIL_TEST(NULL == event->details.operation_finished.emsg);
350 else if (event->details.peer_stop.peer == peer2.peer) 295 FAIL_TEST(NULL == event->details.operation_finished.generic);
351 { 296 if (event->op == peer1.operation)
352 peer2.is_running = GNUNET_NO; 297 {
353 GNUNET_TESTBED_operation_done (peer2.operation); 298 GNUNET_TESTBED_operation_done(peer1.operation);
354 peer2.operation = GNUNET_TESTBED_peer_destroy (peer2.peer); 299 peer1.operation = NULL;
355 } 300 peer1.peer = NULL;
356 else 301 }
357 FAIL_TEST (0); 302 else if (event->op == peer2.operation)
358 if ((GNUNET_NO == peer1.is_running) && (GNUNET_NO == peer2.is_running)) 303 {
359 result = PEERS_STOPPED; 304 GNUNET_TESTBED_operation_done(peer2.operation);
360 break; 305 peer2.operation = NULL;
361 case GNUNET_TESTBED_ET_CONNECT: 306 peer2.peer = NULL;
362 switch (result) 307 }
363 { 308 else
364 case PEERS_STARTED: 309 FAIL_TEST(0);
365 FAIL_TEST (NULL == peer1.operation); 310 if ((NULL == peer1.peer) && (NULL == peer2.peer))
366 FAIL_TEST (NULL == peer2.operation); 311 {
367 FAIL_TEST (NULL != common_operation); 312 result = SUCCESS;
368 FAIL_TEST ((event->details.peer_connect.peer1 == peer1.peer) && 313 GNUNET_SCHEDULER_add_now(&do_shutdown, NULL);
369 (event->details.peer_connect.peer2 == peer2.peer)); 314 }
370 GNUNET_TESTBED_operation_done (common_operation);
371 common_operation = NULL;
372 result = PEERS_CONNECTED;
373 LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected\n");
374 delayed_connect_task =
375 GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS (3), &do_delayed_connect,
376 NULL);
377 break; 315 break;
378 case PEERS_CONNECTED: 316
379 FAIL_TEST (NULL == peer1.operation); 317 case GNUNET_TESTBED_ET_PEER_START:
380 FAIL_TEST (NULL == peer2.operation); 318 FAIL_TEST(INIT == result);
381 FAIL_TEST (NULL != common_operation); 319 FAIL_TEST(event->details.peer_start.host == host);
382 GNUNET_TESTBED_operation_done (common_operation); 320 if (event->details.peer_start.peer == peer1.peer)
383 common_operation = NULL; 321 {
384 result = PEERS_CONNECTED_2; 322 peer1.is_running = GNUNET_YES;
385 LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected again\n"); 323 GNUNET_TESTBED_operation_done(peer1.operation);
386 peer1.operation = GNUNET_TESTBED_peer_stop (NULL, peer1.peer, NULL, NULL); 324 peer1.operation = NULL;
387 peer2.operation = GNUNET_TESTBED_peer_stop (NULL, peer2.peer, NULL, NULL); 325 }
326 else if (event->details.peer_start.peer == peer2.peer)
327 {
328 peer2.is_running = GNUNET_YES;
329 GNUNET_TESTBED_operation_done(peer2.operation);
330 peer2.operation = NULL;
331 }
332 else
333 FAIL_TEST(0);
334 if ((GNUNET_YES == peer1.is_running) && (GNUNET_YES == peer2.is_running))
335 {
336 result = PEERS_STARTED;
337 common_operation =
338 GNUNET_TESTBED_overlay_connect(NULL, &op_comp_cb, NULL, peer1.peer,
339 peer2.peer);
340 }
341 break;
342
343 case GNUNET_TESTBED_ET_PEER_STOP:
344 FAIL_TEST(PEERS_CONNECTED_2 == result);
345 if (event->details.peer_stop.peer == peer1.peer)
346 {
347 peer1.is_running = GNUNET_NO;
348 GNUNET_TESTBED_operation_done(peer1.operation);
349 peer1.operation = GNUNET_TESTBED_peer_destroy(peer1.peer);
350 }
351 else if (event->details.peer_stop.peer == peer2.peer)
352 {
353 peer2.is_running = GNUNET_NO;
354 GNUNET_TESTBED_operation_done(peer2.operation);
355 peer2.operation = GNUNET_TESTBED_peer_destroy(peer2.peer);
356 }
357 else
358 FAIL_TEST(0);
359 if ((GNUNET_NO == peer1.is_running) && (GNUNET_NO == peer2.is_running))
360 result = PEERS_STOPPED;
361 break;
362
363 case GNUNET_TESTBED_ET_CONNECT:
364 switch (result)
365 {
366 case PEERS_STARTED:
367 FAIL_TEST(NULL == peer1.operation);
368 FAIL_TEST(NULL == peer2.operation);
369 FAIL_TEST(NULL != common_operation);
370 FAIL_TEST((event->details.peer_connect.peer1 == peer1.peer) &&
371 (event->details.peer_connect.peer2 == peer2.peer));
372 GNUNET_TESTBED_operation_done(common_operation);
373 common_operation = NULL;
374 result = PEERS_CONNECTED;
375 LOG(GNUNET_ERROR_TYPE_DEBUG, "Peers connected\n");
376 delayed_connect_task =
377 GNUNET_SCHEDULER_add_delayed(TIME_REL_SECS(3), &do_delayed_connect,
378 NULL);
379 break;
380
381 case PEERS_CONNECTED:
382 FAIL_TEST(NULL == peer1.operation);
383 FAIL_TEST(NULL == peer2.operation);
384 FAIL_TEST(NULL != common_operation);
385 GNUNET_TESTBED_operation_done(common_operation);
386 common_operation = NULL;
387 result = PEERS_CONNECTED_2;
388 LOG(GNUNET_ERROR_TYPE_DEBUG, "Peers connected again\n");
389 peer1.operation = GNUNET_TESTBED_peer_stop(NULL, peer1.peer, NULL, NULL);
390 peer2.operation = GNUNET_TESTBED_peer_stop(NULL, peer2.peer, NULL, NULL);
391 break;
392
393 default:
394 FAIL_TEST(0);
395 }
388 break; 396 break;
397
389 default: 398 default:
390 FAIL_TEST (0); 399 FAIL_TEST(0);
391 } 400 }
392 break; 401 ;
393 default:
394 FAIL_TEST (0);
395 };
396} 402}
397 403
398 404
@@ -406,16 +412,16 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
406 * @param emsg NULL if peer is not NULL; else MAY contain the error description 412 * @param emsg NULL if peer is not NULL; else MAY contain the error description
407 */ 413 */
408static void 414static void
409peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) 415peer_create_cb(void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
410{ 416{
411 struct PeerContext *pc = cls; 417 struct PeerContext *pc = cls;
412 418
413 FAIL_TEST (NULL != pc->operation); 419 FAIL_TEST(NULL != pc->operation);
414 FAIL_TEST (NULL != peer); 420 FAIL_TEST(NULL != peer);
415 FAIL_TEST (NULL == pc->peer); 421 FAIL_TEST(NULL == pc->peer);
416 pc->peer = peer; 422 pc->peer = peer;
417 GNUNET_TESTBED_operation_done (pc->operation); 423 GNUNET_TESTBED_operation_done(pc->operation);
418 pc->operation = GNUNET_TESTBED_peer_start (NULL, pc->peer, NULL, NULL); 424 pc->operation = GNUNET_TESTBED_peer_start(NULL, pc->peer, NULL, NULL);
419} 425}
420 426
421 427
@@ -426,18 +432,18 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
426 * @param emsg the error message; NULL if host registration is successful 432 * @param emsg the error message; NULL if host registration is successful
427 */ 433 */
428static void 434static void
429registration_comp (void *cls, const char *emsg) 435registration_comp(void *cls, const char *emsg)
430{ 436{
431 FAIL_TEST (cls == neighbour); 437 FAIL_TEST(cls == neighbour);
432 reg_handle = NULL; 438 reg_handle = NULL;
433 peer1.operation = 439 peer1.operation =
434 GNUNET_TESTBED_peer_create (controller, host, cfg, &peer_create_cb, 440 GNUNET_TESTBED_peer_create(controller, host, cfg, &peer_create_cb,
435 &peer1); 441 &peer1);
436 peer2.operation = 442 peer2.operation =
437 GNUNET_TESTBED_peer_create (controller, host, cfg, &peer_create_cb, 443 GNUNET_TESTBED_peer_create(controller, host, cfg, &peer_create_cb,
438 &peer2); 444 &peer2);
439 FAIL_TEST (NULL != peer1.operation); 445 FAIL_TEST(NULL != peer1.operation);
440 FAIL_TEST (NULL != peer2.operation); 446 FAIL_TEST(NULL != peer2.operation);
441} 447}
442 448
443 449
@@ -451,30 +457,30 @@ registration_comp (void *cls, const char *emsg)
451 * GNUNET_TESTBED_controller_stop() shouldn't be called in this case 457 * GNUNET_TESTBED_controller_stop() shouldn't be called in this case
452 */ 458 */
453static void 459static void
454status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg_, int status) 460status_cb(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg_, int status)
455{ 461{
456 uint64_t event_mask; 462 uint64_t event_mask;
457 463
458 if (GNUNET_OK != status) 464 if (GNUNET_OK != status)
459 { 465 {
460 cp = NULL; 466 cp = NULL;
461 FAIL_TEST (0); 467 FAIL_TEST(0);
462 } 468 }
463 event_mask = 0; 469 event_mask = 0;
464 event_mask |= (1L << GNUNET_TESTBED_ET_PEER_START); 470 event_mask |= (1L << GNUNET_TESTBED_ET_PEER_START);
465 event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP); 471 event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP);
466 event_mask |= (1L << GNUNET_TESTBED_ET_CONNECT); 472 event_mask |= (1L << GNUNET_TESTBED_ET_CONNECT);
467 event_mask |= (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED); 473 event_mask |= (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED);
468 controller = 474 controller =
469 GNUNET_TESTBED_controller_connect (host, event_mask, &controller_cb, 475 GNUNET_TESTBED_controller_connect(host, event_mask, &controller_cb,
470 NULL); 476 NULL);
471 FAIL_TEST (NULL != controller); 477 FAIL_TEST(NULL != controller);
472 neighbour = GNUNET_TESTBED_host_create ("localhost", NULL, cfg, 0); 478 neighbour = GNUNET_TESTBED_host_create("localhost", NULL, cfg, 0);
473 FAIL_TEST (NULL != neighbour); 479 FAIL_TEST(NULL != neighbour);
474 reg_handle = 480 reg_handle =
475 GNUNET_TESTBED_register_host (controller, neighbour, &registration_comp, 481 GNUNET_TESTBED_register_host(controller, neighbour, &registration_comp,
476 neighbour); 482 neighbour);
477 FAIL_TEST (NULL != reg_handle); 483 FAIL_TEST(NULL != reg_handle);
478} 484}
479 485
480 486
@@ -488,18 +494,18 @@ status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg_, int status
488 * @param cfg the configuration file handle 494 * @param cfg the configuration file handle
489 */ 495 */
490static void 496static void
491run (void *cls, char *const *args, const char *cfgfile, 497run(void *cls, char *const *args, const char *cfgfile,
492 const struct GNUNET_CONFIGURATION_Handle *config) 498 const struct GNUNET_CONFIGURATION_Handle *config)
493{ 499{
494 cfg = GNUNET_CONFIGURATION_dup (config); 500 cfg = GNUNET_CONFIGURATION_dup(config);
495 host = GNUNET_TESTBED_host_create (NULL, NULL, cfg, 0); 501 host = GNUNET_TESTBED_host_create(NULL, NULL, cfg, 0);
496 FAIL_TEST (NULL != host); 502 FAIL_TEST(NULL != host);
497 cp = GNUNET_TESTBED_controller_start ("127.0.0.1", host, status_cb, 503 cp = GNUNET_TESTBED_controller_start("127.0.0.1", host, status_cb,
498 NULL); 504 NULL);
499 abort_task = 505 abort_task =
500 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 506 GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply
501 (GNUNET_TIME_UNIT_MINUTES, 3), &do_abort, 507 (GNUNET_TIME_UNIT_MINUTES, 3), &do_abort,
502 NULL); 508 NULL);
503} 509}
504 510
505 511
@@ -507,22 +513,22 @@ run (void *cls, char *const *args, const char *cfgfile,
507 * Main function 513 * Main function
508 */ 514 */
509int 515int
510main (int argc, char **argv) 516main(int argc, char **argv)
511{ 517{
512 int ret; 518 int ret;
513 519
514 char *const argv2[] = { "test_testbed_api_2peers_1controller", 520 char *const argv2[] = { "test_testbed_api_2peers_1controller",
515 "-c", "test_testbed_api.conf", 521 "-c", "test_testbed_api.conf",
516 NULL 522 NULL };
517 };
518 struct GNUNET_GETOPT_CommandLineOption options[] = { 523 struct GNUNET_GETOPT_CommandLineOption options[] = {
519 GNUNET_GETOPT_OPTION_END 524 GNUNET_GETOPT_OPTION_END
520 }; 525 };
526
521 result = INIT; 527 result = INIT;
522 ret = 528 ret =
523 GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2, 529 GNUNET_PROGRAM_run((sizeof(argv2) / sizeof(char *)) - 1, argv2,
524 "test_testbed_api_2peers_1controller", "nohelp", 530 "test_testbed_api_2peers_1controller", "nohelp",
525 options, &run, NULL); 531 options, &run, NULL);
526 if ((GNUNET_OK != ret) || (SUCCESS != result)) 532 if ((GNUNET_OK != ret) || (SUCCESS != result))
527 return 1; 533 return 1;
528 return 0; 534 return 0;