diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-03-23 10:06:41 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-03-23 10:06:41 +0100 |
commit | 7f7ac5d92c6e29b80ec2055f2023657d330ffd1c (patch) | |
tree | 31020d0a96dca1ed1cbadbb4069614378e707806 /src | |
parent | d57576d5dd404ca6c35795f4823eae2d55154293 (diff) |
avoid waiting forever
Diffstat (limited to 'src')
-rw-r--r-- | src/bank-lib/test_bank_api.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/bank-lib/test_bank_api.c b/src/bank-lib/test_bank_api.c index b9b9eae5a..232900f20 100644 --- a/src/bank-lib/test_bank_api.c +++ b/src/bank-lib/test_bank_api.c @@ -510,6 +510,7 @@ main (int argc, char * const *argv) { struct GNUNET_OS_Process *bankd; + unsigned int cnt; GNUNET_log_setup ("test-bank-api", "WARNING", @@ -530,19 +531,30 @@ main (int argc, /* give child time to start and bind against the socket */ fprintf (stderr, "Waiting for taler-bank-manage to be ready"); + cnt = 0; do { fprintf (stderr, "."); sleep (1); + cnt++; + if (cnt > 30) + break; } while (0 != system ("wget -q -t 1 -T 1 http://127.0.0.1:8081/ -o /dev/null -O /dev/null")); fprintf (stderr, "\n"); result = GNUNET_SYSERR; - GNUNET_SCHEDULER_run (&run, NULL); + if (cnt <= 30) + GNUNET_SCHEDULER_run (&run, NULL); GNUNET_OS_process_kill (bankd, SIGTERM); GNUNET_OS_process_wait (bankd); GNUNET_OS_process_destroy (bankd); + if (cnt > 30) + { + fprintf (stderr, + "taler-bank-manage failed to start properly.\n"); + return 77; + } return (GNUNET_OK == result) ? 0 : 1; } |