diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-10-10 16:54:37 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-10-10 16:54:37 +0200 |
commit | 25618c561e55fb82ab2b3701a4e207106300711f (patch) | |
tree | 7b06f0989dfa5ba1ce7f22e28952c1a79c706266 /src/exchange-lib/test_exchange_api.c | |
parent | 808dc10bf4c0bffda06a2f617f361a0c2ea7ef58 (diff) |
check dbinit return value to not fail hard if DB not available
Diffstat (limited to 'src/exchange-lib/test_exchange_api.c')
-rw-r--r-- | src/exchange-lib/test_exchange_api.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/exchange-lib/test_exchange_api.c b/src/exchange-lib/test_exchange_api.c index c5efe459..541a621d 100644 --- a/src/exchange-lib/test_exchange_api.c +++ b/src/exchange-lib/test_exchange_api.c @@ -3047,6 +3047,8 @@ main (int argc, struct GNUNET_OS_Process *proc; struct GNUNET_OS_Process *exchanged; struct GNUNET_SIGNAL_Context *shc_chld; + enum GNUNET_OS_ProcessStatusType type; + unsigned long code; GNUNET_log_setup ("test-exchange-api", "WARNING", @@ -3071,8 +3073,30 @@ main (int argc, "-c", "test_exchange_api.conf", "-r", NULL); - GNUNET_OS_process_wait (proc); + if (GNUNET_SYSERR == + GNUNET_OS_process_wait_status (proc, + &type, + &code)) + { + GNUNET_break (0); + GNUNET_OS_process_destroy (proc); + return 1; + } GNUNET_OS_process_destroy (proc); + if ( (type == GNUNET_OS_PROCESS_EXITED) && + (0 != code) ) + { + fprintf (stderr, + "Failed to setup database\n"); + return 77; + } + if ( (type != GNUNET_OS_PROCESS_EXITED) || + (0 != code) ) + { + fprintf (stderr, + "Unexpected error running taler-exchange-dbinit!\n"); + return 1; + } exchanged = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL, NULL, NULL, @@ -3081,7 +3105,8 @@ main (int argc, "-c", "test_exchange_api.conf", NULL); /* give child time to start and bind against the socket */ - fprintf (stderr, "Waiting for taler-exchange-httpd to be ready"); + fprintf (stderr, + "Waiting for taler-exchange-httpd to be ready"); do { fprintf (stderr, "."); |