aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing_group.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_group.c')
-rw-r--r--src/testing/testing_group.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c
index 57cea8007..eb83c9b78 100644
--- a/src/testing/testing_group.c
+++ b/src/testing/testing_group.c
@@ -240,6 +240,10 @@ struct GNUNET_TESTING_PeerGroup
240 */ 240 */
241 unsigned int total; 241 unsigned int total;
242 242
243 /**
244 * At what time should we fail the peer startup process?
245 */
246 struct GNUNET_TIME_Absolute max_timeout;
243}; 247};
244 248
245/** 249/**
@@ -2380,6 +2384,7 @@ GNUNET_TESTING_daemons_continue_startup(struct GNUNET_TESTING_PeerGroup *pg)
2380 * @param sched scheduler to use 2384 * @param sched scheduler to use
2381 * @param cfg configuration template to use 2385 * @param cfg configuration template to use
2382 * @param total number of daemons to start 2386 * @param total number of daemons to start
2387 * @param timeout total time allowed for peers to start
2383 * @param hostkey_callback function to call on each peers hostkey generation 2388 * @param hostkey_callback function to call on each peers hostkey generation
2384 * if NULL, peers will be started by this call, if non-null, 2389 * if NULL, peers will be started by this call, if non-null,
2385 * GNUNET_TESTING_daemons_continue_startup must be called after 2390 * GNUNET_TESTING_daemons_continue_startup must be called after
@@ -2397,6 +2402,7 @@ struct GNUNET_TESTING_PeerGroup *
2397GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched, 2402GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
2398 const struct GNUNET_CONFIGURATION_Handle *cfg, 2403 const struct GNUNET_CONFIGURATION_Handle *cfg,
2399 unsigned int total, 2404 unsigned int total,
2405 struct GNUNET_TIME_Relative timeout,
2400 GNUNET_TESTING_NotifyHostkeyCreated hostkey_callback, 2406 GNUNET_TESTING_NotifyHostkeyCreated hostkey_callback,
2401 void *hostkey_cls, 2407 void *hostkey_cls,
2402 GNUNET_TESTING_NotifyDaemonRunning cb, 2408 GNUNET_TESTING_NotifyDaemonRunning cb,
@@ -2432,6 +2438,7 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
2432 pg->notify_connection = connect_callback; 2438 pg->notify_connection = connect_callback;
2433 pg->notify_connection_cls = connect_callback_cls; 2439 pg->notify_connection_cls = connect_callback_cls;
2434 pg->total = total; 2440 pg->total = total;
2441 pg->max_timeout = GNUNET_TIME_relative_to_absolute(timeout);
2435 pg->peers = GNUNET_malloc (total * sizeof (struct PeerData)); 2442 pg->peers = GNUNET_malloc (total * sizeof (struct PeerData));
2436 if (NULL != hostnames) 2443 if (NULL != hostnames)
2437 { 2444 {
@@ -2533,6 +2540,7 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
2533 pg->peers[off].pg = pg; 2540 pg->peers[off].pg = pg;
2534 pg->peers[off].daemon = GNUNET_TESTING_daemon_start (sched, 2541 pg->peers[off].daemon = GNUNET_TESTING_daemon_start (sched,
2535 pcfg, 2542 pcfg,
2543 timeout,
2536 hostname, 2544 hostname,
2537 hostkey_callback, 2545 hostkey_callback,
2538 hostkey_cls, 2546 hostkey_cls,
@@ -2628,9 +2636,11 @@ GNUNET_TESTING_daemons_restart (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TEST
2628 * Shutdown all peers started in the given group. 2636 * Shutdown all peers started in the given group.
2629 * 2637 *
2630 * @param pg handle to the peer group 2638 * @param pg handle to the peer group
2639 * @param timeout how long to wait for shutdown
2640 *
2631 */ 2641 */
2632void 2642void
2633GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg) 2643GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg, struct GNUNET_TIME_Relative timeout)
2634{ 2644{
2635 unsigned int off; 2645 unsigned int off;
2636 2646
@@ -2642,7 +2652,7 @@ GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg)
2642 as well... */ 2652 as well... */
2643 2653
2644 if (NULL != pg->peers[off].daemon) 2654 if (NULL != pg->peers[off].daemon)
2645 GNUNET_TESTING_daemon_stop (pg->peers[off].daemon, NULL, NULL, GNUNET_YES); 2655 GNUNET_TESTING_daemon_stop (pg->peers[off].daemon, timeout, NULL, NULL, GNUNET_YES);
2646 if (NULL != pg->peers[off].cfg) 2656 if (NULL != pg->peers[off].cfg)
2647 GNUNET_CONFIGURATION_destroy (pg->peers[off].cfg); 2657 GNUNET_CONFIGURATION_destroy (pg->peers[off].cfg);
2648 2658