From 5052698cbc6692c922e75081af12ad24bf8c3e69 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 25 Nov 2018 14:40:03 +0100 Subject: getting test_auditor_api to pass --- src/exchange-lib/exchange_api_deposit.c | 6 +++--- src/exchange-lib/exchange_api_handle.c | 16 ++++++++-------- src/exchange-lib/exchange_api_handle.h | 8 ++++---- src/exchange-lib/exchange_api_payback.c | 6 +++--- src/exchange-lib/exchange_api_refresh.c | 12 ++++++------ src/exchange-lib/exchange_api_refresh_link.c | 6 +++--- src/exchange-lib/exchange_api_refund.c | 6 +++--- src/exchange-lib/exchange_api_reserve.c | 10 +++++----- src/exchange-lib/exchange_api_track_transaction.c | 6 +++--- src/exchange-lib/exchange_api_track_transfer.c | 6 +++--- src/exchange-lib/exchange_api_wire.c | 6 +++--- src/exchange-lib/testing_api_cmd_batch.c | 14 ++++++++++++++ src/exchange-lib/testing_api_cmd_withdraw.c | 4 ++-- src/exchange-lib/testing_api_loop.c | 9 ++++++++- 14 files changed, 68 insertions(+), 47 deletions(-) (limited to 'src/exchange-lib') diff --git a/src/exchange-lib/exchange_api_deposit.c b/src/exchange-lib/exchange_api_deposit.c index 355464099..4b92dea20 100644 --- a/src/exchange-lib/exchange_api_deposit.c +++ b/src/exchange-lib/exchange_api_deposit.c @@ -419,7 +419,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, (void) GNUNET_TIME_round_abs (&refund_deadline); GNUNET_assert (refund_deadline.abs_value_us <= wire_deadline.abs_value_us); GNUNET_assert (GNUNET_YES == - MAH_handle_is_ready (exchange)); + TEAH_handle_is_ready (exchange)); /* initialize h_wire */ if (GNUNET_OK != TALER_JSON_merchant_wire_signature_hash (wire_details, @@ -483,7 +483,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, dh->exchange = exchange; dh->cb = cb; dh->cb_cls = cb_cls; - dh->url = MAH_path_to_url (exchange, "/deposit"); + dh->url = TEAH_path_to_url (exchange, "/deposit"); dh->depconf.purpose.size = htonl (sizeof (struct TALER_DepositConfirmationPS)); dh->depconf.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT); dh->depconf.h_contract_terms = *h_contract_terms; @@ -513,7 +513,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, curl_easy_setopt (eh, CURLOPT_POSTFIELDSIZE, strlen (dh->json_enc))); - ctx = MAH_handle_to_context (exchange); + ctx = TEAH_handle_to_context (exchange); dh->job = GNUNET_CURL_job_add (ctx, eh, GNUNET_YES, diff --git a/src/exchange-lib/exchange_api_handle.c b/src/exchange-lib/exchange_api_handle.c index b131ffcab..21c583ec7 100644 --- a/src/exchange-lib/exchange_api_handle.c +++ b/src/exchange-lib/exchange_api_handle.c @@ -976,7 +976,7 @@ keys_completed_cb (void *cls, * @return ctx context to execute jobs in */ struct GNUNET_CURL_Context * -MAH_handle_to_context (struct TALER_EXCHANGE_Handle *h) +TEAH_handle_to_context (struct TALER_EXCHANGE_Handle *h) { return h->ctx; } @@ -989,7 +989,7 @@ MAH_handle_to_context (struct TALER_EXCHANGE_Handle *h) * @return #GNUNET_YES if we are ready, #GNUNET_NO if not */ int -MAH_handle_is_ready (struct TALER_EXCHANGE_Handle *h) +TEAH_handle_is_ready (struct TALER_EXCHANGE_Handle *h) { return (MHS_CERT == h->state) ? GNUNET_YES : GNUNET_NO; } @@ -1003,10 +1003,10 @@ MAH_handle_is_ready (struct TALER_EXCHANGE_Handle *h) * @return the full URL to use with cURL */ char * -MAH_path_to_url (struct TALER_EXCHANGE_Handle *h, +TEAH_path_to_url (struct TALER_EXCHANGE_Handle *h, const char *path) { - return MAH_path_to_url2 (h->url, + return TEAH_path_to_url2 (h->url, path); } @@ -1019,7 +1019,7 @@ MAH_path_to_url (struct TALER_EXCHANGE_Handle *h, * @return the full URL to use with cURL */ char * -MAH_path_to_url2 (const char *base_url, +TEAH_path_to_url2 (const char *base_url, const char *path) { char *url; @@ -1443,20 +1443,20 @@ request_keys (void *cls) kr = GNUNET_new (struct KeysRequest); kr->exchange = exchange; if (GNUNET_YES == - MAH_handle_is_ready (exchange)) + TEAH_handle_is_ready (exchange)) { char *arg; GNUNET_asprintf (&arg, "/keys?last_issue_date=%llu", (unsigned long long) exchange->key_data.last_denom_issue_date.abs_value_us / 1000000LLU); - kr->url = MAH_path_to_url (exchange, + kr->url = TEAH_path_to_url (exchange, arg); GNUNET_free (arg); } else { - kr->url = MAH_path_to_url (exchange, + kr->url = TEAH_path_to_url (exchange, "/keys"); } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, diff --git a/src/exchange-lib/exchange_api_handle.h b/src/exchange-lib/exchange_api_handle.h index cd8b87209..8c4392731 100644 --- a/src/exchange-lib/exchange_api_handle.h +++ b/src/exchange-lib/exchange_api_handle.h @@ -31,7 +31,7 @@ * @return ctx context to execute jobs in */ struct GNUNET_CURL_Context * -MAH_handle_to_context (struct TALER_EXCHANGE_Handle *h); +TEAH_handle_to_context (struct TALER_EXCHANGE_Handle *h); /** @@ -41,7 +41,7 @@ MAH_handle_to_context (struct TALER_EXCHANGE_Handle *h); * @return #GNUNET_YES if we are ready, #GNUNET_NO if not */ int -MAH_handle_is_ready (struct TALER_EXCHANGE_Handle *h); +TEAH_handle_is_ready (struct TALER_EXCHANGE_Handle *h); /** @@ -52,7 +52,7 @@ MAH_handle_is_ready (struct TALER_EXCHANGE_Handle *h); * @return the full URL to use with cURL */ char * -MAH_path_to_url (struct TALER_EXCHANGE_Handle *h, +TEAH_path_to_url (struct TALER_EXCHANGE_Handle *h, const char *path); @@ -64,7 +64,7 @@ MAH_path_to_url (struct TALER_EXCHANGE_Handle *h, * @return the full URL to use with cURL */ char * -MAH_path_to_url2 (const char *base_url, +TEAH_path_to_url2 (const char *base_url, const char *path); diff --git a/src/exchange-lib/exchange_api_payback.c b/src/exchange-lib/exchange_api_payback.c index 5bfed2cfe..9f8005558 100644 --- a/src/exchange-lib/exchange_api_payback.c +++ b/src/exchange-lib/exchange_api_payback.c @@ -284,7 +284,7 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange, CURL *eh; GNUNET_assert (GNUNET_YES == - MAH_handle_is_ready (exchange)); + TEAH_handle_is_ready (exchange)); pr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_PAYBACK); pr.purpose.size = htonl (sizeof (struct TALER_PaybackRequestPS)); GNUNET_CRYPTO_eddsa_key_get_public (&ps->coin_priv.eddsa_priv, @@ -317,7 +317,7 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange, ph->pk = pk; ph->cb = payback_cb; ph->cb_cls = payback_cb_cls; - ph->url = MAH_path_to_url (exchange, "/payback"); + ph->url = TEAH_path_to_url (exchange, "/payback"); ph->json_enc = json_dumps (payback_obj, JSON_COMPACT); @@ -341,7 +341,7 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange, curl_easy_setopt (eh, CURLOPT_POSTFIELDSIZE, strlen (ph->json_enc))); - ctx = MAH_handle_to_context (exchange); + ctx = TEAH_handle_to_context (exchange); ph->job = GNUNET_CURL_job_add (ctx, eh, GNUNET_YES, diff --git a/src/exchange-lib/exchange_api_refresh.c b/src/exchange-lib/exchange_api_refresh.c index 443ba7d23..50c55835b 100644 --- a/src/exchange-lib/exchange_api_refresh.c +++ b/src/exchange-lib/exchange_api_refresh.c @@ -1153,7 +1153,7 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange, struct TALER_RefreshMeltCoinAffirmationPS melt; GNUNET_assert (GNUNET_YES == - MAH_handle_is_ready (exchange)); + TEAH_handle_is_ready (exchange)); md = deserialize_melt_data (refresh_data, refresh_data_length); if (NULL == md) @@ -1200,7 +1200,7 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange, rmh->melt_cb = melt_cb; rmh->melt_cb_cls = melt_cb_cls; rmh->md = md; - rmh->url = MAH_path_to_url (exchange, + rmh->url = TEAH_path_to_url (exchange, "/refresh/melt"); eh = TEL_curl_easy_get (rmh->url); GNUNET_assert (NULL != (rmh->json_enc = @@ -1215,7 +1215,7 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange, curl_easy_setopt (eh, CURLOPT_POSTFIELDSIZE, strlen (rmh->json_enc))); - ctx = MAH_handle_to_context (exchange); + ctx = TEAH_handle_to_context (exchange); rmh->job = GNUNET_CURL_job_add (ctx, eh, GNUNET_YES, @@ -1533,7 +1533,7 @@ TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange, struct TALER_TransferPublicKeyP transfer_pub; GNUNET_assert (GNUNET_YES == - MAH_handle_is_ready (exchange)); + TEAH_handle_is_ready (exchange)); md = deserialize_melt_data (refresh_data, refresh_data_length); if (NULL == md) @@ -1627,7 +1627,7 @@ TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange, rrh->reveal_cb = reveal_cb; rrh->reveal_cb_cls = reveal_cb_cls; rrh->md = md; - rrh->url = MAH_path_to_url (rrh->exchange, + rrh->url = TEAH_path_to_url (rrh->exchange, "/refresh/reveal"); eh = TEL_curl_easy_get (rrh->url); @@ -1643,7 +1643,7 @@ TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange, curl_easy_setopt (eh, CURLOPT_POSTFIELDSIZE, strlen (rrh->json_enc))); - ctx = MAH_handle_to_context (rrh->exchange); + ctx = TEAH_handle_to_context (rrh->exchange); rrh->job = GNUNET_CURL_job_add (ctx, eh, GNUNET_YES, diff --git a/src/exchange-lib/exchange_api_refresh_link.c b/src/exchange-lib/exchange_api_refresh_link.c index 545c96a7c..796608db5 100644 --- a/src/exchange-lib/exchange_api_refresh_link.c +++ b/src/exchange-lib/exchange_api_refresh_link.c @@ -387,7 +387,7 @@ TALER_EXCHANGE_refresh_link (struct TALER_EXCHANGE_Handle *exchange, char *arg_str; if (GNUNET_YES != - MAH_handle_is_ready (exchange)) + TEAH_handle_is_ready (exchange)) { GNUNET_break (0); return NULL; @@ -407,12 +407,12 @@ TALER_EXCHANGE_refresh_link (struct TALER_EXCHANGE_Handle *exchange, rlh->link_cb = link_cb; rlh->link_cb_cls = link_cb_cls; rlh->coin_priv = *coin_priv; - rlh->url = MAH_path_to_url (exchange, arg_str); + rlh->url = TEAH_path_to_url (exchange, arg_str); GNUNET_free (arg_str); eh = TEL_curl_easy_get (rlh->url); - ctx = MAH_handle_to_context (exchange); + ctx = TEAH_handle_to_context (exchange); rlh->job = GNUNET_CURL_job_add (ctx, eh, GNUNET_YES, diff --git a/src/exchange-lib/exchange_api_refund.c b/src/exchange-lib/exchange_api_refund.c index 1f1e66942..447e9ce08 100644 --- a/src/exchange-lib/exchange_api_refund.c +++ b/src/exchange-lib/exchange_api_refund.c @@ -256,7 +256,7 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange, struct TALER_MerchantSignatureP merchant_sig; GNUNET_assert (GNUNET_YES == - MAH_handle_is_ready (exchange)); + TEAH_handle_is_ready (exchange)); rr.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND); rr.purpose.size = htonl (sizeof (struct TALER_RefundRequestPS)); rr.h_contract_terms = *h_contract_terms; @@ -355,7 +355,7 @@ refund_obj = json_pack ("{s:o, s:o," /* amount/fee */ rh->exchange = exchange; rh->cb = cb; rh->cb_cls = cb_cls; - rh->url = MAH_path_to_url (exchange, "/refund"); + rh->url = TEAH_path_to_url (exchange, "/refund"); rh->depconf.purpose.size = htonl (sizeof (struct TALER_RefundConfirmationPS)); rh->depconf.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND); rh->depconf.h_contract_terms = *h_contract_terms; @@ -383,7 +383,7 @@ refund_obj = json_pack ("{s:o, s:o," /* amount/fee */ curl_easy_setopt (eh, CURLOPT_POSTFIELDSIZE, strlen (rh->json_enc))); - ctx = MAH_handle_to_context (exchange); + ctx = TEAH_handle_to_context (exchange); rh->job = GNUNET_CURL_job_add (ctx, eh, GNUNET_YES, diff --git a/src/exchange-lib/exchange_api_reserve.c b/src/exchange-lib/exchange_api_reserve.c index 99e7588c0..aa153f210 100644 --- a/src/exchange-lib/exchange_api_reserve.c +++ b/src/exchange-lib/exchange_api_reserve.c @@ -607,7 +607,7 @@ TALER_EXCHANGE_reserve_status (struct TALER_EXCHANGE_Handle *exchange, char *arg_str; if (GNUNET_YES != - MAH_handle_is_ready (exchange)) + TEAH_handle_is_ready (exchange)) { GNUNET_break (0); return NULL; @@ -623,12 +623,12 @@ TALER_EXCHANGE_reserve_status (struct TALER_EXCHANGE_Handle *exchange, rsh->cb = cb; rsh->cb_cls = cb_cls; rsh->reserve_pub = *reserve_pub; - rsh->url = MAH_path_to_url (exchange, + rsh->url = TEAH_path_to_url (exchange, arg_str); GNUNET_free (arg_str); eh = TEL_curl_easy_get (rsh->url); - ctx = MAH_handle_to_context (exchange); + ctx = TEAH_handle_to_context (exchange); rsh->job = GNUNET_CURL_job_add (ctx, eh, GNUNET_NO, @@ -1022,7 +1022,7 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange, } wsh->ps = *ps; - wsh->url = MAH_path_to_url (exchange, "/reserve/withdraw"); + wsh->url = TEAH_path_to_url (exchange, "/reserve/withdraw"); eh = TEL_curl_easy_get (wsh->url); GNUNET_assert (NULL != (wsh->json_enc = @@ -1037,7 +1037,7 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange, curl_easy_setopt (eh, CURLOPT_POSTFIELDSIZE, strlen (wsh->json_enc))); - ctx = MAH_handle_to_context (exchange); + ctx = TEAH_handle_to_context (exchange); wsh->job = GNUNET_CURL_job_add (ctx, eh, GNUNET_YES, diff --git a/src/exchange-lib/exchange_api_track_transaction.c b/src/exchange-lib/exchange_api_track_transaction.c index 0d9f97ee4..d61344e59 100644 --- a/src/exchange-lib/exchange_api_track_transaction.c +++ b/src/exchange-lib/exchange_api_track_transaction.c @@ -279,7 +279,7 @@ TALER_EXCHANGE_track_transaction (struct TALER_EXCHANGE_Handle *exchange, CURL *eh; if (GNUNET_YES != - MAH_handle_is_ready (exchange)) + TEAH_handle_is_ready (exchange)) { GNUNET_break (0); return NULL; @@ -314,7 +314,7 @@ TALER_EXCHANGE_track_transaction (struct TALER_EXCHANGE_Handle *exchange, dwh->exchange = exchange; dwh->cb = cb; dwh->cb_cls = cb_cls; - dwh->url = MAH_path_to_url (exchange, "/track/transaction"); + dwh->url = TEAH_path_to_url (exchange, "/track/transaction"); dwh->depconf.purpose.size = htonl (sizeof (struct TALER_ConfirmWirePS)); dwh->depconf.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE); dwh->depconf.h_wire = *h_wire; @@ -334,7 +334,7 @@ TALER_EXCHANGE_track_transaction (struct TALER_EXCHANGE_Handle *exchange, curl_easy_setopt (eh, CURLOPT_POSTFIELDSIZE, strlen (dwh->json_enc))); - ctx = MAH_handle_to_context (exchange); + ctx = TEAH_handle_to_context (exchange); dwh->job = GNUNET_CURL_job_add (ctx, eh, GNUNET_YES, diff --git a/src/exchange-lib/exchange_api_track_transfer.c b/src/exchange-lib/exchange_api_track_transfer.c index 7d4c92f7c..cf87fe77a 100644 --- a/src/exchange-lib/exchange_api_track_transfer.c +++ b/src/exchange-lib/exchange_api_track_transfer.c @@ -334,7 +334,7 @@ TALER_EXCHANGE_track_transfer (struct TALER_EXCHANGE_Handle *exchange, CURL *eh; if (GNUNET_YES != - MAH_handle_is_ready (exchange)) + TEAH_handle_is_ready (exchange)) { GNUNET_break (0); return NULL; @@ -350,13 +350,13 @@ TALER_EXCHANGE_track_transfer (struct TALER_EXCHANGE_Handle *exchange, GNUNET_asprintf (&path, "/track/transfer?wtid=%s", buf); - wdh->url = MAH_path_to_url (wdh->exchange, + wdh->url = TEAH_path_to_url (wdh->exchange, path); GNUNET_free (buf); GNUNET_free (path); eh = TEL_curl_easy_get (wdh->url); - ctx = MAH_handle_to_context (exchange); + ctx = TEAH_handle_to_context (exchange); wdh->job = GNUNET_CURL_job_add (ctx, eh, GNUNET_YES, diff --git a/src/exchange-lib/exchange_api_wire.c b/src/exchange-lib/exchange_api_wire.c index 894fd4944..c57ad6d92 100644 --- a/src/exchange-lib/exchange_api_wire.c +++ b/src/exchange-lib/exchange_api_wire.c @@ -397,7 +397,7 @@ TALER_EXCHANGE_wire (struct TALER_EXCHANGE_Handle *exchange, CURL *eh; if (GNUNET_YES != - MAH_handle_is_ready (exchange)) + TEAH_handle_is_ready (exchange)) { GNUNET_break (0); return NULL; @@ -406,10 +406,10 @@ TALER_EXCHANGE_wire (struct TALER_EXCHANGE_Handle *exchange, wh->exchange = exchange; wh->cb = wire_cb; wh->cb_cls = wire_cb_cls; - wh->url = MAH_path_to_url (exchange, "/wire"); + wh->url = TEAH_path_to_url (exchange, "/wire"); eh = TEL_curl_easy_get (wh->url); - ctx = MAH_handle_to_context (exchange); + ctx = TEAH_handle_to_context (exchange); wh->job = GNUNET_CURL_job_add (ctx, eh, GNUNET_YES, diff --git a/src/exchange-lib/testing_api_cmd_batch.c b/src/exchange-lib/testing_api_cmd_batch.c index 582bea7c8..5269d0b8b 100644 --- a/src/exchange-lib/testing_api_cmd_batch.c +++ b/src/exchange-lib/testing_api_cmd_batch.c @@ -189,3 +189,17 @@ TALER_TESTING_cmd_is_batch (const struct TALER_TESTING_Command *cmd) { return cmd->run == &batch_run; } + + +/** + * Obtain what command the batch is at. + * + * @return cmd current batch command + */ +struct TALER_TESTING_Command * +TALER_TESTING_cmd_batch_get_current (const struct TALER_TESTING_Command *cmd) +{ + struct BatchState *bs = cmd->cls; + + return &bs->batch[bs->batch_ip]; +} diff --git a/src/exchange-lib/testing_api_cmd_withdraw.c b/src/exchange-lib/testing_api_cmd_withdraw.c index 344a5c468..61730c526 100644 --- a/src/exchange-lib/testing_api_cmd_withdraw.c +++ b/src/exchange-lib/testing_api_cmd_withdraw.c @@ -434,7 +434,7 @@ TALER_TESTING_cmd_withdraw_amount } ws->expected_response_code = expected_response_code; ws->exchange = exchange; - ws->exchange_url = MAH_path_to_url (exchange, "/"); + ws->exchange_url = TEAH_path_to_url (exchange, "/"); cmd.cls = ws; cmd.label = label; @@ -481,7 +481,7 @@ TALER_TESTING_cmd_withdraw_denomination ws->pk = dk; ws->expected_response_code = expected_response_code; ws->exchange = exchange; - ws->exchange_url = MAH_path_to_url (exchange, "/"); + ws->exchange_url = TEAH_path_to_url (exchange, "/"); cmd.cls = ws; cmd.label = label; diff --git a/src/exchange-lib/testing_api_loop.c b/src/exchange-lib/testing_api_loop.c index f20d93f89..f81bb75c4 100644 --- a/src/exchange-lib/testing_api_loop.c +++ b/src/exchange-lib/testing_api_loop.c @@ -216,6 +216,13 @@ TALER_TESTING_interpreter_fail GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed at command `%s'\n", cmd->label); + while (TALER_TESTING_cmd_is_batch (cmd)) + { + cmd = TALER_TESTING_cmd_batch_get_current (cmd); + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Batch is at command `%s'\n", + cmd->label); + } is->result = GNUNET_SYSERR; GNUNET_SCHEDULER_shutdown (); } @@ -368,7 +375,7 @@ maint_child_death (void *cls) if (TALER_TESTING_cmd_is_batch (cmd)) { struct TALER_TESTING_Command *batch_cmd; - + GNUNET_assert (GNUNET_OK == TALER_TESTING_get_trait_cmd (cmd, 0, &batch_cmd)); /* bad? */ -- cgit v1.2.3