diff --git a/src/bank-lib/testing_api_cmd_history.c b/src/bank-lib/testing_api_cmd_history.c index 311c910d0..51d6ad3b2 100644 --- a/src/bank-lib/testing_api_cmd_history.c +++ b/src/bank-lib/testing_api_cmd_history.c @@ -112,24 +112,29 @@ test_cancelled (struct TALER_TESTING_Interpreter *is, unsigned int off) { const char *rejected_reference; + const struct TALER_TESTING_Command *current_cmd; + current_cmd = &is->commands[off]; + TALER_LOG_INFO ("Is `%s' rejected?\n", current_cmd->label); for (unsigned int i=0;iip;i++) { const struct TALER_TESTING_Command *c = &is->commands[i]; #warning "Errors reported here are NOT fatal" - /* We use the exposure of a reference to a reject - * command as a signal to understand if the current - * command was cancelled; so errors about "reject traits" - * not found are NOT fatal here */ - + /* Rejected wire transfers have hold a reference to a + * reject command to mark them as rejected. So errors + * about "reject traits" not found are NOT fatal here */ if (GNUNET_OK != TALER_TESTING_get_trait_rejected (c, 0, &rejected_reference)) continue; + + TALER_LOG_INFO ("Command `%s' was rejected by `%s'.\n", + current_cmd->label, + c->label); + if (0 == strcmp (rejected_reference, - TALER_TESTING_interpreter_get_current_label - (is))) + current_cmd->label)) return GNUNET_YES; } return GNUNET_NO; diff --git a/src/bank-lib/testing_api_cmd_reject.c b/src/bank-lib/testing_api_cmd_reject.c index 0383c1066..c01c27d87 100644 --- a/src/bank-lib/testing_api_cmd_reject.c +++ b/src/bank-lib/testing_api_cmd_reject.c @@ -139,6 +139,33 @@ reject_run (void *cls, } +/** + * @param cls closure + * @param ret[out] result (could be anything) + * @param trait name of the trait + * @param selector more detailed information about which object + * to return in case there were multiple generated + * by the command + * @return #GNUNET_OK on success + */ +static int +reject_traits (void *cls, + void **ret, + const char *trait, + unsigned int index) +{ + struct RejectState *rs = cls; + struct TALER_TESTING_Trait traits[] = { + TALER_TESTING_make_trait_rejected (0, rs->deposit_reference), + TALER_TESTING_trait_end () + }; + + return TALER_TESTING_get_trait (traits, + ret, + trait, + index); +} + /** * FIXME. */ @@ -158,6 +185,7 @@ TALER_TESTING_cmd_bank_reject (const char *label, cmd.run = &reject_run; cmd.cleanup = &reject_cleanup; cmd.label = label; + cmd.traits = &reject_traits; return cmd; diff --git a/src/exchange-lib/testing_api_cmd_bank_check.c b/src/exchange-lib/testing_api_cmd_bank_check.c index 9af156f92..380f5d61d 100644 --- a/src/exchange-lib/testing_api_cmd_bank_check.c +++ b/src/exchange-lib/testing_api_cmd_bank_check.c @@ -200,17 +200,19 @@ check_bank_transfer_traits (void *cls, unsigned int index) { struct BankCheckState *bcs = cls; + struct TALER_WireTransferIdentifierRawP *wtid_ptr; - GNUNET_assert (GNUNET_OK == - GNUNET_STRINGS_string_to_data + if (GNUNET_OK != GNUNET_STRINGS_string_to_data (bcs->subject, strlen (bcs->subject), &bcs->wtid, - sizeof (struct TALER_WireTransferIdentifierRawP))); + sizeof (struct TALER_WireTransferIdentifierRawP))) + wtid_ptr = NULL; + wtid_ptr = &bcs->wtid; struct TALER_TESTING_Trait traits[] = { TALER_TESTING_make_trait_transfer_subject (0, bcs->subject), - TALER_TESTING_make_trait_wtid (0, &bcs->wtid), + TALER_TESTING_make_trait_wtid (0, wtid_ptr), TALER_TESTING_make_trait_url (0, bcs->exchange_base_url), TALER_TESTING_trait_end () }; @@ -297,6 +299,22 @@ check_bank_empty_run (void *cls, TALER_TESTING_interpreter_next (is); } +/** + * FIXME. + */ +static int +check_bank_empty_traits (void *cls, + void **ret, + const char *trait, + unsigned int index) +{ + /** + * Some commands (notably "bank history") could randomly + * look for traits; this way makes sure we don't segfault. + */ + return GNUNET_SYSERR; +} + /** * Check bank's balance is zero. * @@ -312,6 +330,7 @@ TALER_TESTING_cmd_check_bank_empty (const char *label) cmd.label = label; cmd.run = &check_bank_empty_run; cmd.cleanup = &check_bank_empty_cleanup; + cmd.traits = &check_bank_empty_traits; return cmd; } @@ -331,6 +350,7 @@ TALER_TESTING_cmd_check_bank_transfer_with_ref bcs = GNUNET_new (struct BankCheckState); bcs->deposit_reference = deposit_reference; + cmd.label = label; cmd.cls = bcs; cmd.run = &check_bank_transfer_run; diff --git a/src/exchange-lib/testing_api_cmd_track.c b/src/exchange-lib/testing_api_cmd_track.c index 8c289ed5d..3f14c5110 100644 --- a/src/exchange-lib/testing_api_cmd_track.c +++ b/src/exchange-lib/testing_api_cmd_track.c @@ -722,6 +722,7 @@ track_transfer_run (void *cls, TALER_TESTING_interpreter_fail (tts->is); return; } + GNUNET_assert (NULL != wtid_ptr); } tts->tth = TALER_EXCHANGE_track_transfer (tts->exchange, wtid_ptr,