improve test case logging, fix process initialization of taler-auditor-exchange

This commit is contained in:
Christian Grothoff 2019-03-11 03:43:32 +01:00
parent a9268421d7
commit e235945df9
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
2 changed files with 31 additions and 17 deletions

View File

@ -86,6 +86,7 @@ main (int argc,
GNUNET_GETOPT_OPTION_END
};
TALER_gcrypt_init (); /* must trigger initialization manually at this point! */
GNUNET_assert (GNUNET_OK ==
GNUNET_log_setup ("taler-auditor-exchange",
"WARNING",

View File

@ -106,8 +106,7 @@ TALER_TESTING_run_keyup (const char *config_filename,
if (NULL == proc)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to run `taler-exchange-keyup`,"
" is your PATH correct?\n");
"Failed to run `taler-exchange-keyup`, is your PATH correct?\n");
return GNUNET_SYSERR;
}
GNUNET_OS_process_wait (proc);
@ -149,8 +148,7 @@ TALER_TESTING_run_auditor_sign (const char *config_filename,
if (NULL == proc)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to run `taler-auditor-sign`,"
" is your PATH correct?\n");
"Failed to run `taler-auditor-sign`, is your PATH correct?\n");
return GNUNET_SYSERR;
}
GNUNET_OS_process_wait (proc);
@ -175,6 +173,8 @@ TALER_TESTING_run_auditor_exchange (const char *config_filename,
int do_remove)
{
struct GNUNET_OS_Process *proc;
enum GNUNET_OS_ProcessStatusType type;
unsigned long code;
TALER_LOG_DEBUG ("Add exchange (%s,%s) to the auditor\n",
exchange_base_url,
@ -195,12 +195,23 @@ TALER_TESTING_run_auditor_exchange (const char *config_filename,
if (NULL == proc)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to run `taler-auditor-exchange`,"
" is your PATH correct?\n");
"Failed to run `taler-auditor-exchange`, is your PATH correct?\n");
return GNUNET_SYSERR;
}
GNUNET_OS_process_wait (proc);
GNUNET_assert (GNUNET_OK ==
GNUNET_OS_process_wait_status (proc,
&type,
&code));
GNUNET_OS_process_destroy (proc);
if ( (0 != code) ||
(GNUNET_OS_PROCESS_EXITED != type) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"taler-auditor-exchange terminated with error (%d/%d)\n",
(int) type,
(int) code);
return GNUNET_SYSERR;
}
return GNUNET_OK;
}
@ -229,8 +240,7 @@ TALER_TESTING_exchange_db_reset (const char *config_filename)
if (NULL == proc)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to run `taler-exchange-dbinit`,"
" is your PATH correct?\n");
"Failed to run `taler-exchange-dbinit`, is your PATH correct?\n");
return GNUNET_NO;
}
if (GNUNET_SYSERR ==
@ -247,15 +257,17 @@ TALER_TESTING_exchange_db_reset (const char *config_filename)
(0 != code) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to setup (exchange) database\n");
"Failed to setup (exchange) database, exit code %d\n",
(int) code);
return GNUNET_NO;
}
if ( (type != GNUNET_OS_PROCESS_EXITED) ||
(0 != code) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected error running"
" `taler-exchange-dbinit'!\n");
"Unexpected error (%d/%d) running `taler-exchange-dbinit'!\n",
(int) type,
(int) code);
return GNUNET_SYSERR;
}
return GNUNET_OK;
@ -286,8 +298,7 @@ TALER_TESTING_auditor_db_reset (const char *config_filename)
if (NULL == proc)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to run `taler-auditor-dbinit`,"
" is your PATH correct?\n");
"Failed to run `taler-auditor-dbinit`, is your PATH correct?\n");
return GNUNET_NO;
}
if (GNUNET_SYSERR ==
@ -304,15 +315,17 @@ TALER_TESTING_auditor_db_reset (const char *config_filename)
(0 != code) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to setup (auditor) database\n");
"Failed to setup (auditor) database, exit code %d\n",
(int) code);
return GNUNET_NO;
}
if ( (type != GNUNET_OS_PROCESS_EXITED) ||
(0 != code) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected error running"
" `taler-auditor-dbinit'!\n");
"Unexpected error (%d/%d) running `taler-auditor-dbinit'!\n",
(int) type,
(int) code);
return GNUNET_SYSERR;
}
return GNUNET_OK;