report ore precisely where commands went wrong

This commit is contained in:
Christian Grothoff 2018-08-09 21:10:56 +02:00
parent e3f7083b3e
commit c51b19512b
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
11 changed files with 78 additions and 50 deletions

View File

@ -1,5 +1,5 @@
{ {
"url": "payto://x-taler-bank/localhost:8082/2", "url": "payto://x-taler-bank/localhost:8082/2",
"salt": "S8SBYSZE4CAWMJRWGMS25XYVSVM6KXN4BJYZ34M975MPDDXZ01WAZEMB2139G8VVD8K6FVCR3GSZKNGEQ76XX27HQSM1PPX54SCFYER", "salt": "08QX35Z1DA877F14N865D7GKEQ6B4M1HPQHHHZFAWN6Y64AZ6Y34NJEM6W0H7PES2B3V3QPGGXYDWCJ7181JK55ESB5FTK99Q1PF88G",
"master_sig": "J0DHVTAPFB3MY6RRVBX0WGKK7K32XZ7HPKR5JBB6GSQ29AXXFTWM8A1P7STBGKT14YQMYAM4X4EM8GD4FKNDR1MVGK6ANMQYCP9WE0G" "master_sig": "KAAGPE2A9GD1N0EFQHRAXNCV0EVENS51SJAX91403F8DTPJZS1BFHA330QEZQP235R1XAND6HT1AVK4FVAC5H2BFSAWCVF0AGTS3T38"
} }

View File

@ -741,21 +741,23 @@ main (int argc,
exchange_url); exchange_url);
GNUNET_free (exchange_url); GNUNET_free (exchange_url);
duration = GNUNET_TIME_absolute_get_duration (start_time); duration = GNUNET_TIME_absolute_get_duration (start_time);
if (GNUNET_OK == result)
fprintf (stdout, {
"Executed (W=%u, D=%u, R~=%5.2f) * P=%u, operations in %s\n", fprintf (stdout,
howmany_coins, "Executed (W=%u, D=%u, R~=%5.2f) * P=%u, operations in %s\n",
howmany_coins, howmany_coins,
(float) howmany_coins * REFRESH_PROBABILITY, howmany_coins,
howmany_clients, (float) howmany_coins * REFRESH_PROBABILITY,
GNUNET_STRINGS_relative_time_to_string howmany_clients,
(duration, GNUNET_STRINGS_relative_time_to_string
GNUNET_NO)); (duration,
fprintf (stdout, GNUNET_NO));
"(approximately %s/coin)\n", fprintf (stdout,
GNUNET_STRINGS_relative_time_to_string "(approximately %s/coin)\n",
(GNUNET_TIME_relative_divide (duration, GNUNET_STRINGS_relative_time_to_string
howmany_coins * howmany_clients), (GNUNET_TIME_relative_divide (duration,
GNUNET_YES)); howmany_coins * howmany_clients),
GNUNET_YES));
}
return (GNUNET_OK == result) ? 0 : result; return (GNUNET_OK == result) ? 0 : result;
} }

View File

@ -33,10 +33,14 @@
*/ */
struct BatchState struct BatchState
{ {
/* CMDs batch. */ /**
* CMDs batch.
*/
struct TALER_TESTING_Command *batch; struct TALER_TESTING_Command *batch;
/* Internal comand pointer. */ /**
* Internal comand pointer.
*/
int batch_ip; int batch_ip;
}; };
@ -56,7 +60,6 @@ batch_run (void *cls,
struct BatchState *bs = cls; struct BatchState *bs = cls;
bs->batch_ip++; bs->batch_ip++;
TALER_LOG_DEBUG ("Running batched command: %s\n", TALER_LOG_DEBUG ("Running batched command: %s\n",
bs->batch[bs->batch_ip].label); bs->batch[bs->batch_ip].label);
@ -113,8 +116,8 @@ batch_traits (void *cls,
const char *trait, const char *trait,
unsigned int index) unsigned int index)
{ {
#define CURRENT_CMD_INDEX 0 #define CURRENT_CMD_INDEX 0
#define BATCH_INDEX 1 #define BATCH_INDEX 1
struct BatchState *bs = cls; struct BatchState *bs = cls;

View File

@ -121,9 +121,11 @@ deposit_cb (void *cls,
if (ds->expected_response_code != http_status) if (ds->expected_response_code != http_status)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u to command %s\n", "Unexpected response code %u to command %s in %s:%u\n",
http_status, http_status,
ds->is->commands[ds->is->ip].label); ds->is->commands[ds->is->ip].label,
__FILE__,
__LINE__);
json_dumpf (obj, stderr, 0); json_dumpf (obj, stderr, 0);
TALER_TESTING_interpreter_fail (ds->is); TALER_TESTING_interpreter_fail (ds->is);
return; return;

View File

@ -142,9 +142,11 @@ payback_cb (void *cls,
if (ps->expected_response_code != http_status) if (ps->expected_response_code != http_status)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u to command %s\n", "Unexpected response code %u to command %s in %s:%u\n",
http_status, http_status,
cmd->label); cmd->label,
__FILE__,
__LINE__);
json_dumpf (full_response, stderr, 0); json_dumpf (full_response, stderr, 0);
fprintf (stderr, "\n"); fprintf (stderr, "\n");
TALER_TESTING_interpreter_fail (is); TALER_TESTING_interpreter_fail (is);

View File

@ -232,9 +232,11 @@ reveal_cb (void *cls,
if (rrs->expected_response_code != http_status) if (rrs->expected_response_code != http_status)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u to command %s\n", "Unexpected response code %u to command %s in %s:%u\n",
http_status, http_status,
rrs->is->commands[rrs->is->ip].label); rrs->is->commands[rrs->is->ip].label,
__FILE__,
__LINE__);
json_dumpf (full_response, stderr, 0); json_dumpf (full_response, stderr, 0);
TALER_TESTING_interpreter_fail (rrs->is); TALER_TESTING_interpreter_fail (rrs->is);
return; return;
@ -400,9 +402,11 @@ link_cb (void *cls,
if (rls->expected_response_code != http_status) if (rls->expected_response_code != http_status)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u to command %s\n", "Unexpected response code %u to command %s in %s:%u\n",
http_status, http_status,
link_cmd->label); link_cmd->label,
__FILE__,
__LINE__);
json_dumpf (full_response, stderr, 0); json_dumpf (full_response, stderr, 0);
TALER_TESTING_interpreter_fail (rls->is); TALER_TESTING_interpreter_fail (rls->is);
return; return;
@ -431,8 +435,11 @@ link_cb (void *cls,
if (num_coins != *num_fresh_coins) if (num_coins != *num_fresh_coins)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected number of fresh coins: %d vs %d\n", "Unexpected number of fresh coins: %d vs %d in %s:%u\n",
num_coins, *num_fresh_coins); num_coins,
*num_fresh_coins,
__FILE__,
__LINE__);
TALER_TESTING_interpreter_fail (rls->is); TALER_TESTING_interpreter_fail (rls->is);
return; return;
} }
@ -626,9 +633,11 @@ melt_cb (void *cls,
if (rms->expected_response_code != http_status) if (rms->expected_response_code != http_status)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u to command %s\n", "Unexpected response code %u to command %s in %s:%u\n",
http_status, http_status,
rms->is->commands[rms->is->ip].label); rms->is->commands[rms->is->ip].label,
__FILE__,
__LINE__);
json_dumpf (full_response, stderr, 0); json_dumpf (full_response, stderr, 0);
TALER_TESTING_interpreter_fail (rms->is); TALER_TESTING_interpreter_fail (rms->is);
return; return;

View File

@ -105,9 +105,11 @@ refund_cb (void *cls,
if (rs->expected_response_code != http_status) if (rs->expected_response_code != http_status)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u to command %s\n", "Unexpected response code %u to command %s in %s:%u\n",
http_status, http_status,
refund_cmd->label); refund_cmd->label,
__FILE__,
__LINE__);
json_dumpf (obj, stderr, 0); json_dumpf (obj, stderr, 0);
TALER_TESTING_interpreter_fail (rs->is); TALER_TESTING_interpreter_fail (rs->is);
return; return;

View File

@ -95,8 +95,10 @@ reserve_status_cb
if (ss->expected_response_code != http_status) if (ss->expected_response_code != http_status)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected HTTP response code: %d\n", "Unexpected HTTP response code: %d in %s:%u\n",
http_status); http_status,
__FILE__,
__LINE__);
TALER_TESTING_interpreter_fail (ss->is); TALER_TESTING_interpreter_fail (ss->is);
return; return;
} }

View File

@ -184,9 +184,11 @@ deposit_wtid_cb
if (tts->expected_response_code != http_status) if (tts->expected_response_code != http_status)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u to command %s\n", "Unexpected response code %u to command %s in %s:%u\n",
http_status, http_status,
cmd->label); cmd->label,
__FILE__,
__LINE__);
json_dumpf (json, stderr, 0); json_dumpf (json, stderr, 0);
TALER_TESTING_interpreter_fail (is); TALER_TESTING_interpreter_fail (is);
return; return;
@ -224,7 +226,7 @@ deposit_wtid_cb
TALER_TESTING_interpreter_fail (is); TALER_TESTING_interpreter_fail (is);
return; return;
} }
/* Compare that expected and gotten subjects match. */ /* Compare that expected and gotten subjects match. */
if (0 != strcmp (ws, transfer_subject)) if (0 != strcmp (ws, transfer_subject))
{ {
@ -527,9 +529,11 @@ track_transfer_cb
if (tts->expected_response_code != http_status) if (tts->expected_response_code != http_status)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u to command %s\n", "Unexpected response code %u to command %s in %s:%u\n",
http_status, http_status,
cmd->label); cmd->label,
__FILE__,
__LINE__);
json_dumpf (json, stderr, 0); json_dumpf (json, stderr, 0);
TALER_TESTING_interpreter_fail (is); TALER_TESTING_interpreter_fail (is);
return; return;

View File

@ -120,9 +120,11 @@ reserve_withdraw_cb (void *cls,
if (ws->expected_response_code != http_status) if (ws->expected_response_code != http_status)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u to command %s\n", "Unexpected response code %u to command %s in %s:%u\n",
http_status, http_status,
TALER_TESTING_interpreter_get_current_label (is)); TALER_TESTING_interpreter_get_current_label (is),
__FILE__,
__LINE__);
json_dumpf (full_response, json_dumpf (full_response,
stderr, stderr,
0); 0);
@ -269,7 +271,7 @@ withdraw_traits (void *cls,
{ {
GNUNET_break (0); GNUNET_break (0);
TALER_TESTING_interpreter_fail (ws->is); TALER_TESTING_interpreter_fail (ws->is);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (GNUNET_OK != TALER_TESTING_get_trait_reserve_priv if (GNUNET_OK != TALER_TESTING_get_trait_reserve_priv
@ -277,7 +279,7 @@ withdraw_traits (void *cls,
{ {
GNUNET_break (0); GNUNET_break (0);
TALER_TESTING_interpreter_fail (ws->is); TALER_TESTING_interpreter_fail (ws->is);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
struct TALER_TESTING_Trait traits[] = { struct TALER_TESTING_Trait traits[] = {

View File

@ -944,11 +944,11 @@ main (int argc,
} }
mhd mhd
= MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_PIPE_FOR_SHUTDOWN | MHD_USE_DEBUG | MHD_USE_DUAL_STACK, // | MHD_USE_INTERNAL_POLLING_THREAD, = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_PIPE_FOR_SHUTDOWN | MHD_USE_DEBUG | MHD_USE_DUAL_STACK | MHD_USE_INTERNAL_POLLING_THREAD,
(-1 == fh) ? serve_port : 0, (-1 == fh) ? serve_port : 0,
NULL, NULL, NULL, NULL,
&handle_mhd_request, NULL, &handle_mhd_request, NULL,
/* MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) 8, */ MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) 16,
MHD_OPTION_LISTEN_SOCKET, fh, MHD_OPTION_LISTEN_SOCKET, fh,
MHD_OPTION_EXTERNAL_LOGGER, &handle_mhd_logs, NULL, MHD_OPTION_EXTERNAL_LOGGER, &handle_mhd_logs, NULL,
MHD_OPTION_NOTIFY_COMPLETED, &handle_mhd_completion_callback, NULL, MHD_OPTION_NOTIFY_COMPLETED, &handle_mhd_completion_callback, NULL,