summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-10-27 18:37:42 +0200
committerChristian Grothoff <christian@grothoff.org>2021-10-27 18:37:42 +0200
commitb449c7353ef5d789500244c790bae5affedf0ee7 (patch)
tree37376031b030558c8f4f3bb58da08a519a3b292f
parent3f630eafc4bac6249c518bc725bf1b19aa0287f1 (diff)
downloadexchange-b449c7353ef5d789500244c790bae5affedf0ee7.tar.gz
exchange-b449c7353ef5d789500244c790bae5affedf0ee7.tar.bz2
exchange-b449c7353ef5d789500244c790bae5affedf0ee7.zip
work on testing ftbfs
-rw-r--r--src/include/taler_json_lib.h2
-rw-r--r--src/include/taler_testing_lib.h86
-rw-r--r--src/json/json.c4
-rw-r--r--src/testing/testing_api_cmd_auditor_add_denom_sig.c25
-rw-r--r--src/testing/testing_api_cmd_auditor_deposit_confirmation.c60
-rw-r--r--src/testing/testing_api_cmd_auditor_exec_auditor.c11
-rw-r--r--src/testing/testing_api_cmd_auditor_exec_auditor_dbinit.c9
-rw-r--r--src/testing/testing_api_cmd_bank_admin_add_incoming.c56
-rw-r--r--src/testing/testing_api_cmd_bank_admin_check.c31
-rw-r--r--src/testing/testing_api_cmd_bank_check.c52
-rw-r--r--src/testing/testing_api_cmd_bank_history_credit.c97
-rw-r--r--src/testing/testing_api_cmd_bank_history_debit.c98
-rw-r--r--src/testing/testing_api_cmd_bank_transfer.c40
-rw-r--r--src/testing/testing_api_cmd_batch.c48
-rw-r--r--src/testing/testing_api_cmd_deposit.c33
-rw-r--r--src/testing/testing_api_cmd_deposits_get.c12
-rw-r--r--src/testing/testing_api_cmd_exec_aggregator.c12
-rw-r--r--src/testing/testing_api_cmd_exec_closer.c33
-rw-r--r--src/testing/testing_api_cmd_exec_transfer.c12
-rw-r--r--src/testing/testing_api_cmd_exec_wirewatch.c13
-rw-r--r--src/testing/testing_api_cmd_rewind.c17
-rw-r--r--src/testing/testing_api_cmd_stat.c58
-rw-r--r--src/testing/testing_api_cmd_status.c18
-rw-r--r--src/testing/testing_api_loop.c98
24 files changed, 223 insertions, 702 deletions
diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h
index 42c3669d2..e381a7a10 100644
--- a/src/include/taler_json_lib.h
+++ b/src/include/taler_json_lib.h
@@ -383,7 +383,7 @@ TALER_JSON_spec_i18n_str (const char *name,
*/
enum GNUNET_GenericReturnValue
TALER_JSON_contract_hash (const json_t *json,
- struct GNUNET_HashCode *hc);
+ struct TALER_PrivateContractHash *hc);
/**
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 041ed3d07..7c066294e 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -1871,7 +1871,7 @@ TALER_TESTING_cmd_batch (const char *label,
*
* @return false if not, true if it is a batch command
*/
-int
+bool
TALER_TESTING_cmd_is_batch (const struct TALER_TESTING_Command *cmd);
/**
@@ -2259,10 +2259,10 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
enum GNUNET_GenericReturnValue \
TALER_TESTING_get_trait_ ## name ( \
const struct TALER_TESTING_Command *cmd, \
- const type **ret); \
+ type **ret); \
struct TALER_TESTING_Trait \
TALER_TESTING_make_trait_ ## name ( \
- const type * value);
+ type * value);
/**
@@ -2273,8 +2273,9 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
enum GNUNET_GenericReturnValue \
TALER_TESTING_get_trait_ ## name ( \
const struct TALER_TESTING_Command *cmd, \
- const type **ret) \
+ type **ret) \
{ \
+ if (NULL == cmd->traits) return GNUNET_SYSERR; \
return cmd->traits (cmd->cls, \
(const void **) ret, \
TALER_S (name), \
@@ -2301,11 +2302,11 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
TALER_TESTING_get_trait_ ## name ( \
const struct TALER_TESTING_Command *cmd, \
unsigned int index, \
- const type **ret); \
+ type **ret); \
struct TALER_TESTING_Trait \
TALER_TESTING_make_trait_ ## name ( \
unsigned int index, \
- const type * value);
+ type * value);
/**
@@ -2317,8 +2318,9 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
TALER_TESTING_get_trait_ ## name ( \
const struct TALER_TESTING_Command *cmd, \
unsigned int index, \
- const type **ret) \
+ type **ret) \
{ \
+ if (NULL == cmd->traits) return GNUNET_SYSERR; \
return cmd->traits (cmd->cls, \
(const void **) ret, \
TALER_S (name), \
@@ -2327,7 +2329,7 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
struct TALER_TESTING_Trait \
TALER_TESTING_make_trait_ ## name ( \
unsigned int index, \
- const type * value) \
+ type * value) \
{ \
struct TALER_TESTING_Trait ret = { \
.index = index, \
@@ -2342,45 +2344,47 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
* Call #op on all simple traits.
*/
#define TALER_TESTING_SIMPLE_TRAITS(op) \
- op (exchange_pub, struct TALER_ExchangePublicKeyP) \
- op (bank_row, uint64_t) \
- op (reserve_priv, struct TALER_ReservePrivateKeyP) \
- op (reserve_pub, struct TALER_ReservePublicKeyP) \
- op (exchange_sig, struct TALER_ExchangeSignatureP) \
- op (exchange_pub, struct TALER_ExchangePublicKeyP) \
- op (merchant_priv, struct TALER_MerchantPrivateKeyP) \
- op (merchant_pub, struct TALER_MerchantPublicKeyP) \
- op (wtid, struct TALER_WireTransferIdentifierRawP) \
- op (contract_terms, json_t) \
- op (wire_details, json_t) \
- op (exchange_keys, json_t) \
- op (reserve_history, struct TALER_EXCHANGE_ReserveHistory) \
- op (exchange_url, char *) \
- op (exchange_bank_account_url, char *) \
- op (taler_uri, char *) \
- op (payto_uri, char *) \
- op (credit_payto_uri, char *) \
- op (debit_payto_uri, char *) \
- op (order_id, char *) \
- op (amount, struct TALER_Amount) \
- op (cmd, struct TALER_TESTING_Command) \
- op (uuid, struct GNUNET_Uuid) \
- op (claim_token, struct TALER_ClaimTokenP) \
- op (absolute_time, struct GNUNET_TIME_Absolute) \
- op (relative_time, struct GNUNET_TIME_Relative) \
+ op (bank_row, const uint64_t) \
+ op (reserve_priv, const struct TALER_ReservePrivateKeyP) \
+ op (reserve_pub, const struct TALER_ReservePublicKeyP) \
+ op (merchant_priv, const struct TALER_MerchantPrivateKeyP) \
+ op (merchant_pub, const struct TALER_MerchantPublicKeyP) \
+ op (wtid, const struct TALER_WireTransferIdentifierRawP) \
+ op (contract_terms, const json_t) \
+ op (wire_details, const json_t) \
+ op (exchange_keys, const json_t) \
+ op (reserve_history, const struct TALER_EXCHANGE_ReserveHistory) \
+ op (exchange_url, const char *) \
+ op (exchange_bank_account_url, const char *) \
+ op (taler_uri, const char *) \
+ op (payto_uri, const char *) \
+ op (row, const uint64_t) \
+ op (credit_payto_uri, const char *) \
+ op (debit_payto_uri, const char *) \
+ op (order_id, const char *) \
+ op (amount, const struct TALER_Amount) \
+ op (deposit_amount, const struct TALER_Amount) \
+ op (deposit_fee_amount, const struct TALER_Amount) \
+ op (batch_cmds, struct TALER_TESTING_Command *) \
+ op (uuid, const struct GNUNET_Uuid) \
+ op (claim_token, const struct TALER_ClaimTokenP) \
+ op (relative_time, const struct GNUNET_TIME_Relative) \
op (process, struct GNUNET_OS_Process *)
/**
* Call #op on all indexed traits.
*/
-#define TALER_TESTING_INDEXED_TRAITS(op) \
- op (denom_pub, struct TALER_EXCHANGE_DenomPublicKey) \
- op (denom_sig, struct TALER_EXCHANGE_DenominationKeySignature) \
- op (coin_priv, struct TALER_CoinSpendPrivateKeyP) \
- op (coin_pub, struct TALER_CoinSpendPublicKeyP) \
- op (fresh_coin, struct TALER_TESTING_FreshCoinData) \
- op (blinding_key, struct TALER_DenominationBlindingKeyP)
+#define TALER_TESTING_INDEXED_TRAITS(op) \
+ op (denom_pub, const struct TALER_EXCHANGE_DenomPublicKey) \
+ op (denom_sig, const struct TALER_DenominationSignature) \
+ op (coin_priv, const struct TALER_CoinSpendPrivateKeyP) \
+ op (coin_pub, const struct TALER_CoinSpendPublicKeyP) \
+ op (fresh_coin, const struct TALER_TESTING_FreshCoinData) \
+ op (absolute_time, const struct GNUNET_TIME_Absolute) \
+ op (exchange_pub, const struct TALER_ExchangePublicKeyP) \
+ op (exchange_sig, const struct TALER_ExchangeSignatureP) \
+ op (blinding_key, const struct TALER_DenominationBlindingKeyP)
TALER_TESTING_SIMPLE_TRAITS (TALER_TESTING_MAKE_DECL_SIMPLE_TRAIT)
diff --git a/src/json/json.c b/src/json/json.c
index 4c2b82ccb..2dfabbf96 100644
--- a/src/json/json.c
+++ b/src/json/json.c
@@ -325,7 +325,7 @@ forget (const json_t *in,
enum GNUNET_GenericReturnValue
TALER_JSON_contract_hash (const json_t *json,
- struct GNUNET_HashCode *hc)
+ struct TALER_PrivateContractHash *hc)
{
enum GNUNET_GenericReturnValue ret;
json_t *cjson;
@@ -339,7 +339,7 @@ TALER_JSON_contract_hash (const json_t *json,
return ret;
ret = dump_and_hash (cjson,
NULL,
- hc);
+ &hc->hash);
json_decref (cjson);
return ret;
}
diff --git a/src/testing/testing_api_cmd_auditor_add_denom_sig.c b/src/testing/testing_api_cmd_auditor_add_denom_sig.c
index efa4a9d76..33cd9575e 100644
--- a/src/testing/testing_api_cmd_auditor_add_denom_sig.c
+++ b/src/testing/testing_api_cmd_auditor_add_denom_sig.c
@@ -108,7 +108,7 @@ auditor_add_run (void *cls,
{
struct AuditorAddDenomSigState *ds = cls;
struct TALER_AuditorSignatureP auditor_sig;
- struct GNUNET_HashCode h_denom_pub;
+ struct TALER_DenominationHash h_denom_pub;
const struct TALER_EXCHANGE_DenomPublicKey *dk;
(void) cmd;
@@ -202,26 +202,6 @@ auditor_add_cleanup (void *cls,
}
-/**
- * Offer internal data from a "auditor_add" CMD, to other commands.
- *
- * @param cls closure.
- * @param[out] ret result.
- * @param trait name of the trait.
- * @param index index number of the object to offer.
- *
- * @return #GNUNET_OK on success.
- */
-static int
-auditor_add_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
-{
- return GNUNET_NO;
-}
-
-
struct TALER_TESTING_Command
TALER_TESTING_cmd_auditor_add_denom_sig (const char *label,
unsigned int expected_http_status,
@@ -239,8 +219,7 @@ TALER_TESTING_cmd_auditor_add_denom_sig (const char *label,
.cls = ds,
.label = label,
.run = &auditor_add_run,
- .cleanup = &auditor_add_cleanup,
- .traits = &auditor_add_traits
+ .cleanup = &auditor_add_cleanup
};
return cmd;
diff --git a/src/testing/testing_api_cmd_auditor_deposit_confirmation.c b/src/testing/testing_api_cmd_auditor_deposit_confirmation.c
index f40d78c88..6522fe5bf 100644
--- a/src/testing/testing_api_cmd_auditor_deposit_confirmation.c
+++ b/src/testing/testing_api_cmd_auditor_deposit_confirmation.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2018 Taler Systems SA
+ Copyright (C) 2018, 2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
@@ -201,8 +201,8 @@ deposit_confirmation_run (void *cls,
{
struct DepositConfirmationState *dcs = cls;
const struct TALER_TESTING_Command *deposit_cmd;
- struct GNUNET_HashCode h_wire;
- struct GNUNET_HashCode h_contract_terms;
+ struct TALER_MerchantWireHash h_wire;
+ struct TALER_PrivateContractHash h_contract_terms;
const struct GNUNET_TIME_Absolute *exchange_timestamp = NULL;
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Absolute refund_deadline;
@@ -251,7 +251,6 @@ deposit_confirmation_run (void *cls,
GNUNET_assert (GNUNET_OK ==
TALER_TESTING_get_trait_contract_terms (deposit_cmd,
- dcs->coin_index,
&contract_terms));
/* Very unlikely to fail */
GNUNET_assert (NULL != contract_terms);
@@ -260,7 +259,6 @@ deposit_confirmation_run (void *cls,
&h_contract_terms));
GNUNET_assert (GNUNET_OK ==
TALER_TESTING_get_trait_wire_details (deposit_cmd,
- dcs->coin_index,
&wire_details));
GNUNET_assert (GNUNET_OK ==
TALER_JSON_merchant_wire_signature_hash (wire_details,
@@ -273,7 +271,6 @@ deposit_confirmation_run (void *cls,
&coin_pub.eddsa_pub);
GNUNET_assert (GNUNET_OK ==
TALER_TESTING_get_trait_merchant_priv (deposit_cmd,
- dcs->coin_index,
&merchant_priv));
GNUNET_CRYPTO_eddsa_key_get_public (&merchant_priv->eddsa_priv,
&merchant_pub.eddsa_pub);
@@ -371,47 +368,6 @@ deposit_confirmation_cleanup (void *cls,
}
-/**
- * Offer internal data to other commands.
- *
- * @param cls closure.
- * @param[out] ret set to the wanted data.
- * @param trait name of the trait.
- * @param index index number of the traits to be returned.
- *
- * @return #GNUNET_OK on success
- */
-static int
-deposit_confirmation_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
-{
- (void) cls;
- (void) ret;
- (void) trait;
- (void) index;
- /* Must define this function because some callbacks
- * look for certain traits on _all_ the commands. */
- return GNUNET_SYSERR;
-}
-
-
-/**
- * Create a "deposit-confirmation" command.
- *
- * @param label command label.
- * @param auditor auditor connection.
- * @param deposit_reference reference to any operation that can
- * provide a coin.
- * @param coin_index if @a deposit_reference offers an array of
- * coins, this parameter selects which one in that array.
- * This value is currently ignored, as only one-coin
- * deposits are implemented.
- * @param amount_without_fee deposited amount without the fee
- * @param expected_response_code expected HTTP response code.
- * @return the command.
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_deposit_confirmation (const char *label,
struct TALER_AUDITOR_Handle *auditor,
@@ -434,8 +390,7 @@ TALER_TESTING_cmd_deposit_confirmation (const char *label,
.cls = dcs,
.label = label,
.run = &deposit_confirmation_run,
- .cleanup = &deposit_confirmation_cleanup,
- .traits = &deposit_confirmation_traits
+ .cleanup = &deposit_confirmation_cleanup
};
return cmd;
@@ -443,13 +398,6 @@ TALER_TESTING_cmd_deposit_confirmation (const char *label,
}
-/**
- * Modify a deposit confirmation command to enable retries when we get
- * transient errors from the auditor.
- *
- * @param cmd a deposit confirmation command
- * @return the command with retries enabled
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_deposit_confirmation_with_retry (
struct TALER_TESTING_Command cmd)
diff --git a/src/testing/testing_api_cmd_auditor_exec_auditor.c b/src/testing/testing_api_cmd_auditor_exec_auditor.c
index 06dfe91bf..8ec128c01 100644
--- a/src/testing/testing_api_cmd_auditor_exec_auditor.c
+++ b/src/testing/testing_api_cmd_auditor_exec_auditor.c
@@ -115,7 +115,7 @@ auditor_cleanup (void *cls,
* @param index index number of the object to offer.
* @return #GNUNET_OK on success.
*/
-static int
+static enum GNUNET_GenericReturnValue
auditor_traits (void *cls,
const void **ret,
const char *trait,
@@ -123,7 +123,7 @@ auditor_traits (void *cls,
{
struct AuditorState *ks = cls;
struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_process (0, &ks->auditor_proc),
+ TALER_TESTING_make_trait_process (&ks->auditor_proc),
TALER_TESTING_trait_end ()
};
@@ -134,13 +134,6 @@ auditor_traits (void *cls,
}
-/**
- * Make the "exec-auditor" CMD.
- *
- * @param label command label.
- * @param config_filename configuration filename.
- * @return the command.
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_exec_auditor (const char *label,
const char *config_filename)
diff --git a/src/testing/testing_api_cmd_auditor_exec_auditor_dbinit.c b/src/testing/testing_api_cmd_auditor_exec_auditor_dbinit.c
index c09ec2918..2ab5bda8b 100644
--- a/src/testing/testing_api_cmd_auditor_exec_auditor_dbinit.c
+++ b/src/testing/testing_api_cmd_auditor_exec_auditor_dbinit.c
@@ -124,7 +124,7 @@ auditor_dbinit_traits (void *cls,
{
struct AuditorDbinitState *ks = cls;
struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_process (0, &ks->auditor_dbinit_proc),
+ TALER_TESTING_make_trait_process (&ks->auditor_dbinit_proc),
TALER_TESTING_trait_end ()
};
@@ -135,13 +135,6 @@ auditor_dbinit_traits (void *cls,
}
-/**
- * Make the "exec-auditor-dbinit" CMD.
- *
- * @param label command label.
- * @param config_filename configuration filename.
- * @return the command.
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_exec_auditor_dbinit (const char *label,
const char *config_filename)
diff --git a/src/testing/testing_api_cmd_bank_admin_add_incoming.c b/src/testing/testing_api_cmd_bank_admin_add_incoming.c
index 28f907fda..10114ae7f 100644
--- a/src/testing/testing_api_cmd_bank_admin_add_incoming.c
+++ b/src/testing/testing_api_cmd_bank_admin_add_incoming.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2018-2020 Taler Systems SA
+ Copyright (C) 2018-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
@@ -326,11 +326,9 @@ admin_add_incoming_run (void *cls,
}
if (GNUNET_OK !=
TALER_TESTING_get_trait_reserve_priv (ref,
- 0,
&reserve_priv))
{
if (GNUNET_OK != TALER_TESTING_get_trait_reserve_pub (ref,
- 0,
&reserve_pub))
{
GNUNET_break (0);
@@ -420,13 +418,14 @@ admin_add_incoming_cleanup (void *cls,
* @param index index number of the object to offer.
* @return #GNUNET_OK on success.
*/
-static int
+static enum GNUNET_GenericReturnValue
admin_add_incoming_traits (void *cls,
const void **ret,
const char *trait,
unsigned int index)
{
struct AdminAddIncomingState *fts = cls;
+ static const char *void_uri = "payto://void/the-exchange";
if (MHD_HTTP_OK !=
fts->expected_http_status)
@@ -435,21 +434,16 @@ admin_add_incoming_traits (void *cls,
{
struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_bank_row (&fts->serial_id),
- TALER_TESTING_make_trait_payto (TALER_TESTING_PT_DEBIT,
- fts->payto_debit_account),
+ TALER_TESTING_make_trait_debit_payto_uri (&fts->payto_debit_account),
/* Used as a marker, content does not matter */
- TALER_TESTING_make_trait_payto (TALER_TESTING_PT_CREDIT,
- "payto://void/the-exchange"),
- TALER_TESTING_make_trait_url (TALER_TESTING_UT_EXCHANGE_BANK_ACCOUNT_URL,
- fts->exchange_credit_url),
- TALER_TESTING_make_trait_amount_obj (0, &fts->amount),
+ TALER_TESTING_make_trait_credit_payto_uri (&void_uri),
+ TALER_TESTING_make_trait_exchange_bank_account_url (
+ &fts->exchange_credit_url),
+ TALER_TESTING_make_trait_amount (&fts->amount),
TALER_TESTING_make_trait_absolute_time (0, &fts->timestamp),
- TALER_TESTING_make_trait_reserve_priv (0,
- &fts->reserve_priv),
- TALER_TESTING_make_trait_reserve_pub (0,
- &fts->reserve_pub),
- TALER_TESTING_make_trait_reserve_history (0,
- &fts->reserve_history),
+ TALER_TESTING_make_trait_reserve_priv (&fts->reserve_priv),
+ TALER_TESTING_make_trait_reserve_pub (&fts->reserve_pub),
+ TALER_TESTING_make_trait_reserve_history (&fts->reserve_history),
TALER_TESTING_trait_end ()
};
@@ -462,19 +456,15 @@ admin_add_incoming_traits (void *cls,
{
struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_bank_row (&fts->serial_id),
- TALER_TESTING_make_trait_payto (TALER_TESTING_PT_DEBIT,
- fts->payto_debit_account),
+ TALER_TESTING_make_trait_debit_payto_uri (&fts->payto_debit_account),
/* Used as a marker, content does not matter */
- TALER_TESTING_make_trait_payto (TALER_TESTING_PT_CREDIT,
- "payto://void/the-exchange"),
- TALER_TESTING_make_trait_url (TALER_TESTING_UT_EXCHANGE_BANK_ACCOUNT_URL,
- fts->exchange_credit_url),
- TALER_TESTING_make_trait_amount_obj (0, &fts->amount),
+ TALER_TESTING_make_trait_credit_payto_uri (&void_uri),
+ TALER_TESTING_make_trait_exchange_bank_account_url (
+ &fts->exchange_credit_url),
+ TALER_TESTING_make_trait_amount (&fts->amount),
TALER_TESTING_make_trait_absolute_time (0, &fts->timestamp),
- TALER_TESTING_make_trait_reserve_pub (0,
- &fts->reserve_pub),
- TALER_TESTING_make_trait_reserve_history (0,
- &fts->reserve_history),
+ TALER_TESTING_make_trait_reserve_pub (&fts->reserve_pub),
+ TALER_TESTING_make_trait_reserve_history (&fts->reserve_history),
TALER_TESTING_trait_end ()
};
@@ -543,11 +533,11 @@ make_command (const char *label,
struct TALER_TESTING_Command
-TALER_TESTING_cmd_admin_add_incoming (const char *label,
- const char *amount,
- const struct
- TALER_BANK_AuthenticationData *auth,
- const char *payto_debit_account)
+TALER_TESTING_cmd_admin_add_incoming (
+ const char *label,
+ const char *amount,
+ const struct TALER_BANK_AuthenticationData *auth,
+ const char *payto_debit_account)
{
return make_command (label,
make_fts (amount,
diff --git a/src/testing/testing_api_cmd_bank_admin_check.c b/src/testing/testing_api_cmd_bank_admin_check.c
index 473f3f3f2..21a230834 100644
--- a/src/testing/testing_api_cmd_bank_admin_check.c
+++ b/src/testing/testing_api_cmd_bank_admin_check.c
@@ -95,7 +95,6 @@ check_bank_admin_transfer_run (void *cls,
}
if (GNUNET_OK !=
TALER_TESTING_get_trait_reserve_pub (cmd_ref,
- 0,
&reserve_pub))
{
GNUNET_break (0);
@@ -160,33 +159,6 @@ check_bank_admin_transfer_cleanup (void *cls,
/**
- * Offer internal data from a "bank admin check" CMD state.
- *
- * @param cls closure.
- * @param[out] ret result.
- * @param trait name of the trait.
- * @param index index number of the object to offer.
- * @return #GNUNET_OK on success.
- */
-static int
-check_bank_admin_transfer_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
-{
- struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_trait_end ()
- };
-
- (void) cls;
- return TALER_TESTING_get_trait (traits,
- ret,
- trait,
- index);
-}
-
-
-/**
* Make a "bank check" CMD. It checks whether a particular wire transfer to
* the exchange (credit) has been made or not.
*
@@ -217,8 +189,7 @@ TALER_TESTING_cmd_check_bank_admin_transfer
.label = label,
.cls = bcs,
.run = &check_bank_admin_transfer_run,
- .cleanup = &check_bank_admin_transfer_cleanup,
- .traits = &check_bank_admin_transfer_traits
+ .cleanup = &check_bank_admin_transfer_cleanup
};
return cmd;
diff --git a/src/testing/testing_api_cmd_bank_check.c b/src/testing/testing_api_cmd_bank_check.c
index c01bc709f..ed4cde461 100644
--- a/src/testing/testing_api_cmd_bank_check.c
+++ b/src/testing/testing_api_cmd_bank_check.c
@@ -74,6 +74,7 @@ struct BankCheckState
const char *deposit_reference;
};
+
/**
* Run the command.
*
@@ -90,17 +91,17 @@ check_bank_transfer_run (void *cls,
struct TALER_Amount amount;
char *debit_account;
char *credit_account;
- const char *exchange_base_url;
- const char *debit_payto;
- const char *credit_payto;
+ const char **exchange_base_url;
+ const char **debit_payto;
+ const char **credit_payto;
(void) cmd;
if (NULL == bcs->deposit_reference)
{
TALER_LOG_INFO ("Deposit reference NOT given\n");
- debit_payto = bcs->debit_payto;
- credit_payto = bcs->credit_payto;
- exchange_base_url = bcs->exchange_base_url;
+ debit_payto = &bcs->debit_payto;
+ credit_payto = &bcs->credit_payto;
+ exchange_base_url = &bcs->exchange_base_url;
if (GNUNET_OK !=
TALER_string_to_amount (bcs->amount,
@@ -130,37 +131,33 @@ check_bank_transfer_run (void *cls,
if (NULL == deposit_cmd)
TALER_TESTING_FAIL (is);
if ( (GNUNET_OK !=
- TALER_TESTING_get_trait_amount_obj (deposit_cmd,
- 0,
- &amount_ptr)) ||
+ TALER_TESTING_get_trait_amount (deposit_cmd,
+ &amount_ptr)) ||
(GNUNET_OK !=
- TALER_TESTING_get_trait_payto (deposit_cmd,
- TALER_TESTING_PT_DEBIT,
- &debit_payto)) ||
+ TALER_TESTING_get_trait_debit_payto_uri (deposit_cmd,
+ &debit_payto)) ||
(GNUNET_OK !=
- TALER_TESTING_get_trait_payto (deposit_cmd,
- TALER_TESTING_PT_CREDIT,
- &credit_payto)) ||
+ TALER_TESTING_get_trait_credit_payto_uri (deposit_cmd,
+ &credit_payto)) ||
(GNUNET_OK !=
- TALER_TESTING_get_trait_url (deposit_cmd,
- TALER_TESTING_UT_EXCHANGE_BASE_URL,
- &exchange_base_url)) )
+ TALER_TESTING_get_trait_exchange_url (deposit_cmd,
+ &exchange_base_url)) )
TALER_TESTING_FAIL (is);
amount = *amount_ptr;
}
- debit_account = TALER_xtalerbank_account_from_payto (debit_payto);
- credit_account = TALER_xtalerbank_account_from_payto (credit_payto);
+ debit_account = TALER_xtalerbank_account_from_payto (*debit_payto);
+ credit_account = TALER_xtalerbank_account_from_payto (*credit_payto);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"converted debit_payto (%s) to debit_account (%s)\n",
- debit_payto,
+ *debit_payto,
debit_account);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"converted credit_payto (%s) to credit_account (%s)\n",
- credit_payto,
+ *credit_payto,
credit_account);
if (GNUNET_OK !=
@@ -168,7 +165,7 @@ check_bank_transfer_run (void *cls,
&amount,
debit_account,
credit_account,
- exchange_base_url,
+ *exchange_base_url,
&bcs->wtid))
{
GNUNET_break (0);
@@ -209,7 +206,7 @@ check_bank_transfer_cleanup (void *cls,
* @param index index number of the object to offer.
* @return #GNUNET_OK on success.
*/
-static int
+static enum GNUNET_GenericReturnValue
check_bank_transfer_traits (void *cls,
const void **ret,
const char *trait,
@@ -218,10 +215,9 @@ check_bank_transfer_traits (void *cls,
struct BankCheckState *bcs = cls;
struct TALER_WireTransferIdentifierRawP *wtid_ptr = &bcs->wtid;
struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_wtid (0,
- wtid_ptr),
- TALER_TESTING_make_trait_url (TALER_TESTING_UT_EXCHANGE_BASE_URL,
- bcs->exchange_base_url),
+ TALER_TESTING_make_trait_wtid (wtid_ptr),
+ TALER_TESTING_make_trait_exchange_url (
+ &bcs->exchange_base_url),
TALER_TESTING_trait_end ()
};
diff --git a/src/testing/testing_api_cmd_bank_history_credit.c b/src/testing/testing_api_cmd_bank_history_credit.c
index c052b55fb..a7ad40a43 100644
--- a/src/testing/testing_api_cmd_bank_history_credit.c
+++ b/src/testing/testing_api_cmd_bank_history_credit.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2018-2020 Taler Systems SA
+ Copyright (C) 2018-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -93,10 +93,10 @@ struct HistoryState
uint64_t results_obtained;
/**
- * Set to GNUNET_YES if the callback detects something
+ * Set to true if the callback detects something
* unexpected.
*/
- int failed;
+ bool failed;
/**
* Expected history.
@@ -112,32 +112,6 @@ struct HistoryState
/**
- * Offer internal data to other commands.
- *
- * @param cls closure.
- * @param[out] ret set to the wanted data.
- * @param trait name of the trait.
- * @param index index number of the traits to be returned.
- *
- * @return #GNUNET_OK on success
- */
-static int
-history_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
-{
- (void) cls;
- (void) ret;
- (void) trait;
- (void) index;
- /* Must define this function because some callbacks
- * look for certain traits on _all_ the commands. */
- return GNUNET_SYSERR;
-}
-
-
-/**
* Log which history we expected. Called when an error occurs.
*
* @param h what we expected.
@@ -210,9 +184,8 @@ build_history (struct TALER_TESTING_Interpreter *is,
hs->start_row_reference);
GNUNET_assert (NULL != add_incoming_cmd);
GNUNET_assert (GNUNET_OK ==
- TALER_TESTING_get_trait_uint64 (add_incoming_cmd,
- 0,
- &row_id_start));
+ TALER_TESTING_get_trait_row (add_incoming_cmd,
+ &row_id_start));
}
GNUNET_assert (0 != hs->num_results);
@@ -249,11 +222,11 @@ build_history (struct TALER_TESTING_Interpreter *is,
{
const struct TALER_TESTING_Command *cmd = &is->commands[off];
const uint64_t *row_id;
- const char *credit_account;
- const char *debit_account;
+ const char **credit_account;
+ const char **debit_account;
const struct TALER_Amount *amount;
const struct TALER_ReservePublicKeyP *reserve_pub;
- const char *exchange_credit_url;
+ const char **exchange_credit_url;
/* The following command allows us to skip over those CMDs
* that do not offer a "row_id" trait. Such skipped CMDs are
@@ -262,25 +235,21 @@ build_history (struct TALER_TESTING_Interpreter *is,
TALER_TESTING_get_trait_bank_row (cmd,
&row_id)) ||
(GNUNET_OK !=
- TALER_TESTING_get_trait_payto (cmd,
- TALER_TESTING_PT_CREDIT,
- &credit_account)) ||
+ TALER_TESTING_get_trait_credit_payto_uri (cmd,
+ &credit_account)) ||
(GNUNET_OK !=
- TALER_TESTING_get_trait_payto (cmd,
- TALER_TESTING_PT_DEBIT,
- &debit_account)) ||
+ TALER_TESTING_get_trait_debit_payto_uri (cmd,
+ &debit_account)) ||
(GNUNET_OK !=
- TALER_TESTING_get_trait_amount_obj (cmd,
- 0,
- &amount)) ||
+ TALER_TESTING_get_trait_amount (cmd,
+ &amount)) ||
(GNUNET_OK !=
TALER_TESTING_get_trait_reserve_pub (cmd,
- 0,
&reserve_pub)) ||
(GNUNET_OK !=
- TALER_TESTING_get_trait_url (cmd,
- TALER_TESTING_UT_EXCHANGE_BANK_ACCOUNT_URL,
- &exchange_credit_url)) )
+ TALER_TESTING_get_trait_exchange_bank_account_url (
+ cmd,
+ &exchange_credit_url)) )
continue; /* not an interesting event */
/* Seek "/history/incoming" starting row. */
if ( (NULL != row_id_start) &&
@@ -295,7 +264,7 @@ build_history (struct TALER_TESTING_Interpreter *is,
if (GNUNET_NO == ok)
continue; /* skip until we find the marker */
if (0 != strcasecmp (hs->account_url,
- exchange_credit_url))
+ *exchange_credit_url))
continue; /* account mismatch */
if (total >= GNUNET_MAX (hs->num_results,
-hs->num_results) )
@@ -304,20 +273,20 @@ build_history (struct TALER_TESTING_Interpreter *is,
break;
}
TALER_LOG_INFO ("Found history: %s->%s for account %s\n",
- debit_account,
- credit_account,
+ *debit_account,
+ *credit_account,
hs->account_url);
/* found matching record, make sure we have room */
if (pos == total)
GNUNET_array_grow (h,
total,
pos * 2);
- h[pos].url = GNUNET_strdup (debit_account);
+ h[pos].url = GNUNET_strdup (*debit_account);
h[pos].details.debit_account_uri = h[pos].url;
h[pos].details.amount = *amount;
h[pos].row_id = *row_id;
h[pos].details.reserve_pub = *reserve_pub;
- h[pos].details.credit_account_uri = exchange_credit_url;
+ h[pos].details.credit_account_uri = *exchange_credit_url;
pos++;
}
GNUNET_assert (GNUNET_YES == ok);
@@ -405,7 +374,7 @@ check_result (struct History *h,
* reply was not in JSON.
* @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration
*/
-static int
+static enum GNUNET_GenericReturnValue
history_cb (void *cls,
unsigned int http_status,
enum TALER_ErrorCode ec,
@@ -421,7 +390,7 @@ history_cb (void *cls,
{
hs->hh = NULL;
if ( (hs->results_obtained != hs->total) ||
- (GNUNET_YES == hs->failed) ||
+ (hs->failed) ||
(MHD_HTTP_NO_CONTENT != http_status) )
{
GNUNET_break (0);
@@ -432,7 +401,7 @@ history_cb (void *cls,
(unsigned long long) hs->results_obtained,
http_status,
(int) ec,
- hs->failed);
+ hs->failed ? 1 : 0);
print_expected (hs->h,
hs->total,
UINT_MAX);
@@ -469,7 +438,7 @@ history_cb (void *cls,
acc);
if (NULL != acc)
free (acc);
- hs->failed = GNUNET_YES;
+ hs->failed = true;
return GNUNET_SYSERR;
}
hs->results_obtained++;
@@ -499,16 +468,15 @@ history_run (void *cls,
{
const struct TALER_TESTING_Command *history_cmd;
- history_cmd = TALER_TESTING_interpreter_lookup_command
- (is, hs->start_row_reference);
-
+ history_cmd = TALER_TESTING_interpreter_lookup_command (
+ is,
+ hs->start_row_reference);
if (NULL == history_cmd)
TALER_TESTING_FAIL (is);
if (GNUNET_OK !=
- TALER_TESTING_get_trait_uint64 (history_cmd,
- 0,
- &row_ptr))
+ TALER_TESTING_get_trait_row (history_cmd,
+ &row_ptr))
TALER_TESTING_FAIL (is);
else
row_id = *row_ptr;
@@ -574,8 +542,7 @@ TALER_TESTING_cmd_bank_credits (
.label = label,
.cls = hs,
.run = &history_run,
- .cleanup = &history_cleanup,
- .traits = &history_traits
+ .cleanup = &history_cleanup
};
return cmd;
diff --git a/src/testing/testing_api_cmd_bank_history_debit.c b/src/testing/testing_api_cmd_bank_history_debit.c
index 779facee8..a1dee81e1 100644
--- a/src/testing/testing_api_cmd_bank_history_debit.c
+++ b/src/testing/testing_api_cmd_bank_history_debit.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2018-2020 Taler Systems SA
+ Copyright (C) 2018-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -116,32 +116,6 @@ struct HistoryState
/**
- * Offer internal data to other commands.
- *
- * @param cls closure.
- * @param[out] ret set to the wanted data.
- * @param trait name of the trait.
- * @param index index number of the traits to be returned.
- *
- * @return #GNUNET_OK on success
- */
-static int
-history_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
-{
- (void) cls;
- (void) ret;
- (void) trait;
- (void) index;
- /* Must define this function because some callbacks
- * look for certain traits on _all_ the commands. */
- return GNUNET_SYSERR;
-}
-
-
-/**
* Log which history we expected. Called when an error occurs.
*
* @param h what we expected.
@@ -207,13 +181,13 @@ build_history (struct TALER_TESTING_Interpreter *is,
("`%s': start row given via reference `%s'\n",
TALER_TESTING_interpreter_get_current_label (is),
hs->start_row_reference);
- add_incoming_cmd = TALER_TESTING_interpreter_lookup_command
- (is, hs->start_row_reference);
+ add_incoming_cmd = TALER_TESTING_interpreter_lookup_command (
+ is,
+ hs->start_row_reference);
GNUNET_assert (NULL != add_incoming_cmd);
GNUNET_assert (GNUNET_OK ==
- TALER_TESTING_get_trait_uint64 (add_incoming_cmd,
- 0,
- &row_id_start));
+ TALER_TESTING_get_trait_row (add_incoming_cmd,
+ &row_id_start));
}
GNUNET_assert (0 != hs->num_results);
@@ -255,11 +229,11 @@ build_history (struct TALER_TESTING_Interpreter *is,
{
const struct TALER_TESTING_Command *cmd = &is->commands[off];
const uint64_t *row_id;
- const char *debit_account;
- const char *credit_account;
+ const char **debit_account;
+ const char **credit_account;
const struct TALER_Amount *amount;
const struct TALER_WireTransferIdentifierRawP *wtid;
- const char *exchange_base_url;
+ const char **exchange_base_url;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Checking if command %s is relevant for debit history\n",
@@ -268,25 +242,20 @@ build_history (struct TALER_TESTING_Interpreter *is,
TALER_TESTING_get_trait_bank_row (cmd,
&row_id)) ||
(GNUNET_OK !=
- TALER_TESTING_get_trait_payto (cmd,
- TALER_TESTING_PT_DEBIT,
- &debit_account)) ||
+ TALER_TESTING_get_trait_debit_payto_uri (cmd,
+ &debit_account)) ||
(GNUNET_OK !=
- TALER_TESTING_get_trait_payto (cmd,
- TALER_TESTING_PT_CREDIT,
- &credit_account)) ||
+ TALER_TESTING_get_trait_credit_payto_uri (cmd,
+ &credit_account)) ||
(GNUNET_OK !=
- TALER_TESTING_get_trait_amount_obj (cmd,
- 0,
- &amount)) ||
+ TALER_TESTING_get_trait_amount (cmd,
+ &amount)) ||
(GNUNET_OK !=
TALER_TESTING_get_trait_wtid (cmd,
- 0,
&wtid)) ||
(GNUNET_OK !=
- TALER_TESTING_get_trait_url (cmd,
- TALER_TESTING_UT_EXCHANGE_BASE_URL,
- &exchange_base_url)) )
+ TALER_TESTING_get_trait_exchange_url (cmd,
+ &exchange_base_url)) )
continue; /* not an event we care about */
/* Seek "/history/outgoing" starting row. */
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -310,22 +279,22 @@ build_history (struct TALER_TESTING_Interpreter *is,
break;
}
TALER_LOG_INFO ("Found history: %s->%s for account %s\n",
- debit_account,
- credit_account,
+ *debit_account,
+ *credit_account,
hs->account_url);
/* found matching record, make sure we have room */
if (pos == total)
GNUNET_array_grow (h,
total,
pos * 2);
- h[pos].c_url = GNUNET_strdup (credit_account);
- h[pos].d_url = GNUNET_strdup (debit_account);
+ h[pos].c_url = GNUNET_strdup (*credit_account);
+ h[pos].d_url = GNUNET_strdup (*debit_account);
h[pos].details.credit_account_uri = h[pos].c_url;
h[pos].details.debit_account_uri = h[pos].d_url;
h[pos].details.amount = *amount;
h[pos].row_id = *row_id;
h[pos].details.wtid = *wtid;
- h[pos].details.exchange_base_url = exchange_base_url;
+ h[pos].details.exchange_base_url = *exchange_base_url;
pos++;
}
GNUNET_assert (GNUNET_YES == ok);
@@ -350,7 +319,7 @@ build_history (struct TALER_TESTING_Interpreter *is,
* @param details the expected transaction details.
* @return #GNUNET_OK if the transaction is what we expect.
*/
-static int
+static enum GNUNET_GenericReturnValue
check_result (struct History *h,
uint64_t total,
unsigned int off,
@@ -407,7 +376,7 @@ check_result (struct History *h,
* reply was not in JSON.
* @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration
*/
-static int
+static enum GNUNET_GenericReturnValue
history_cb (void *cls,
unsigned int http_status,
enum TALER_ErrorCode ec,
@@ -508,9 +477,8 @@ history_run (void *cls,
if (NULL == history_cmd)
TALER_TESTING_FAIL (is);
if (GNUNET_OK !=
- TALER_TESTING_get_trait_uint64 (history_cmd,
- 0,
- &row_ptr))
+ TALER_TESTING_get_trait_row (history_cmd,
+ &row_ptr))
TALER_TESTING_FAIL (is);
else
row_id = *row_ptr;
@@ -558,17 +526,6 @@ history_cleanup (void *cls,
}
-/**
- * Make a "history" CMD.
- *
- * @param label command label.
- * @param auth login data to use
- * @param start_row_reference reference to a command that can
- * offer a row identifier, to be used as the starting row
- * to accept in the result.
- * @param num_results how many rows we want in the result.
- * @return the command.
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_bank_debits (const char *label,
const struct TALER_BANK_AuthenticationData *auth,
@@ -588,8 +545,7 @@ TALER_TESTING_cmd_bank_debits (const char *label,
.label = label,
.cls = hs,
.run = &history_run,
- .cleanup = &history_cleanup,
- .traits = &history_traits
+ .cleanup = &history_cleanup
};
return cmd;
diff --git a/src/testing/testing_api_cmd_bank_transfer.c b/src/testing/testing_api_cmd_bank_transfer.c
index 565d6e460..0755a71d2 100644
--- a/src/testing/testing_api_cmd_bank_transfer.c
+++ b/src/testing/testing_api_cmd_bank_transfer.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2018-2020 Taler Systems SA
+ Copyright (C) 2018-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
@@ -310,7 +310,7 @@ transfer_cleanup (void *cls,
* @param index index number of the object to offer.
* @return #GNUNET_OK on success.
*/
-static int
+static enum GNUNET_GenericReturnValue
transfer_traits (void *cls,
const void **ret,
const char *trait,
@@ -318,17 +318,16 @@ transfer_traits (void *cls,
{
struct TransferState *fts = cls;
struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_url (TALER_TESTING_UT_EXCHANGE_BASE_URL,
- fts->exchange_base_url),
+ TALER_TESTING_make_trait_exchange_url (
+ (const char **) &fts->exchange_base_url),
TALER_TESTING_make_trait_bank_row (&fts->serial_id),
- TALER_TESTING_make_trait_payto (TALER_TESTING_PT_CREDIT,
- fts->payto_credit_account),
- TALER_TESTING_make_trait_payto (TALER_TESTING_PT_DEBIT,
- fts->payto_debit_account),
- TALER_TESTING_make_trait_amount_obj (0, &fts->amount),
+ TALER_TESTING_make_trait_credit_payto_uri (
+ (const char **) &fts->payto_credit_account),
+ TALER_TESTING_make_trait_debit_payto_uri (
+ (const char **) &fts->payto_debit_account),
+ TALER_TESTING_make_trait_amount (&fts->amount),
TALER_TESTING_make_trait_absolute_time (0, &fts->timestamp),
- TALER_TESTING_make_trait_wtid (0,
- &fts->wtid),
+ TALER_TESTING_make_trait_wtid (&fts->wtid),
TALER_TESTING_trait_end ()
};
@@ -339,18 +338,6 @@ transfer_traits (void *cls,
}
-/**
- * Create transfer command.
- *
- * @param label command label.
- * @param amount amount to transfer.
- * @param auth authentication data to use
- * @param payto_debit_account which account sends money.
- * @param payto_credit_account which account receives money.
- * @param wtid wire transfer identifier to use
- * @param exchange_base_url exchange URL to use
- * @return the command.
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_transfer (const char *label,
const char *amount,
@@ -394,13 +381,6 @@ TALER_TESTING_cmd_transfer (const char *label,
}
-/**
- * Modify a transfer command to enable retries when the reserve is not yet
- * full or we get other transient errors from the bank.
- *
- * @param cmd a fakebank transfer command
- * @return the command with retries enabled
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_transfer_retry (struct TALER_TESTING_Command cmd)
{
diff --git a/src/testing/testing_api_cmd_batch.c b/src/testing/testing_api_cmd_batch.c
index ca23d7fd9..e8f76ca37 100644
--- a/src/testing/testing_api_cmd_batch.c
+++ b/src/testing/testing_api_cmd_batch.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2018 Taler Systems SA
+ Copyright (C) 2014-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -113,22 +113,15 @@ batch_cleanup (void *cls,
* @param index index number of the object to offer.
* @return #GNUNET_OK on success.
*/
-static int
+static enum GNUNET_GenericReturnValue
batch_traits (void *cls,
const void **ret,
const char *trait,
unsigned int index)
{
-#define CURRENT_CMD_INDEX 0
-#define BATCH_INDEX 1
-
struct BatchState *bs = cls;
-
struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_cmd
- (CURRENT_CMD_INDEX, &bs->batch[bs->batch_ip]),
- TALER_TESTING_make_trait_cmd
- (BATCH_INDEX, bs->batch),
+ TALER_TESTING_make_trait_batch_cmds (&bs->batch),
TALER_TESTING_trait_end ()
};
@@ -140,18 +133,6 @@ batch_traits (void *cls,
}
-/**
- * Create a "batch" command. Such command takes a
- * end_CMD-terminated array of CMDs and executed them.
- * Once it hits the end CMD, it passes the control
- * to the next top-level CMD, regardless of it being
- * another batch or ordinary CMD.
- *
- * @param label the command label.
- * @param batch array of CMDs to execute.
- *
- * @return the command.
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_batch (const char *label,
struct TALER_TESTING_Command *batch)
@@ -185,11 +166,6 @@ TALER_TESTING_cmd_batch (const char *label,
}
-/**
- * Advance internal pointer to next command.
- *
- * @param is interpreter state.
- */
void
TALER_TESTING_cmd_batch_next (struct TALER_TESTING_Interpreter *is)
{
@@ -206,23 +182,13 @@ TALER_TESTING_cmd_batch_next (struct TALER_TESTING_Interpreter *is)
}
-/**
- * Test if this command is a batch command.
- *
- * @return false if not, true if it is a batch command
- */
-int
+bool
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)
{
@@ -233,12 +199,6 @@ TALER_TESTING_cmd_batch_get_current (const struct TALER_TESTING_Command *cmd)
}
-/**
- * Set what command the batch should be at.
- *
- * @param cmd current batch command
- * @param new_ip where to move the IP
- */
void
TALER_TESTING_cmd_batch_set_current (const struct TALER_TESTING_Command *cmd,
unsigned int new_ip)
diff --git a/src/testing/testing_api_cmd_deposit.c b/src/testing/testing_api_cmd_deposit.c
index 58322b1d1..7e944b6ee 100644
--- a/src/testing/testing_api_cmd_deposit.c
+++ b/src/testing/testing_api_cmd_deposit.c
@@ -287,7 +287,7 @@ deposit_run (void *cls,
struct TALER_CoinSpendSignatureP coin_sig;
struct GNUNET_TIME_Absolute wire_deadline;
struct TALER_MerchantPublicKeyP merchant_pub;
- struct GNUNET_HashCode h_contract_terms;
+ struct TALER_PrivateContractHash h_contract_terms;
enum TALER_ErrorCode ec;
(void) cmd;
@@ -333,7 +333,6 @@ deposit_run (void *cls,
}
if ( (GNUNET_OK !=
TALER_TESTING_get_trait_merchant_priv (cmd,
- 0,
&merchant_priv)) )
{
GNUNET_break (0);
@@ -393,7 +392,7 @@ deposit_run (void *cls,
&merchant_pub.eddsa_pub);
(void) GNUNET_TIME_round_abs (&wire_deadline);
{
- struct GNUNET_HashCode h_wire;
+ struct TALER_MerchantWireHash h_wire;
GNUNET_assert (GNUNET_OK ==
TALER_JSON_merchant_wire_signature_hash (ds->wire_details,
@@ -402,6 +401,7 @@ deposit_run (void *cls,
&denom_pub->fee_deposit,
&h_wire,
&h_contract_terms,
+ NULL, /* FIXME: extension hash! */
&denom_pub->h_key,
coin_priv,
ds->wallet_timestamp,
@@ -414,6 +414,7 @@ deposit_run (void *cls,
wire_deadline,
ds->wire_details,
&h_contract_terms,
+ NULL, /* FIXME: extension object */
&coin_pub,
denom_pub_sig,
&denom_pub->key,
@@ -476,10 +477,9 @@ deposit_cleanup (void *cls,
* @param[out] ret result.
* @param trait name of the trait.
* @param index index number of the object to offer.
- *
* @return #GNUNET_OK on success.
*/
-static int
+static enum GNUNET_GenericReturnValue
deposit_traits (void *cls,
const void **ret,
const char *trait,
@@ -519,25 +519,16 @@ deposit_traits (void *cls,
struct TALER_TESTING_Trait traits[] = {
/* First two traits are only available if
ds->traits is #GNUNET_YES */
- TALER_TESTING_make_trait_exchange_pub (0,
- &ds->exchange_pub),
- TALER_TESTING_make_trait_exchange_sig (0,
- &ds->exchange_sig),
+ TALER_TESTING_make_trait_exchange_pub (0, &ds->exchange_pub),
+ TALER_TESTING_make_trait_exchange_sig (0, &ds->exchange_sig),
/* These traits are always available */
TALER_TESTING_make_trait_coin_priv (0,
coin_spent_priv),
- TALER_TESTING_make_trait_wire_details (0,
- ds->wire_details),
- TALER_TESTING_make_trait_contract_terms (0,
- ds->contract_terms),
- TALER_TESTING_make_trait_merchant_priv (0,
- &ds->merchant_priv),
- TALER_TESTING_make_trait_amount_obj (
- TALER_TESTING_CMD_DEPOSIT_TRAIT_IDX_DEPOSIT_VALUE,
- &ds->amount),
- TALER_TESTING_make_trait_amount_obj (
- TALER_TESTING_CMD_DEPOSIT_TRAIT_IDX_DEPOSIT_FEE,
- &ds->deposit_fee),
+ TALER_TESTING_make_trait_wire_details (ds->wire_details),
+ TALER_TESTING_make_trait_contract_terms (ds->contract_terms),
+ TALER_TESTING_make_trait_merchant_priv (&ds->merchant_priv),
+ TALER_TESTING_make_trait_deposit_amount (&ds->amount),
+ TALER_TESTING_make_trait_deposit_fee_amount (&ds->deposit_fee),
TALER_TESTING_make_trait_absolute_time (0,
&ds->exchange_timestamp),
TALER_TESTING_trait_end ()
diff --git a/src/testing/testing_api_cmd_deposits_get.c b/src/testing/testing_api_cmd_deposits_get.c
index 61358291b..389d46604 100644
--- a/src/testing/testing_api_cmd_deposits_get.c
+++ b/src/testing/testing_api_cmd_deposits_get.c
@@ -128,7 +128,6 @@ deposit_wtid_cb (void *cls,
if (GNUNET_OK !=
TALER_TESTING_get_trait_wtid (bank_transfer_cmd,
- 0,
&wtid_want))
{
GNUNET_break (0);
@@ -178,8 +177,8 @@ track_transaction_run (void *cls,
struct TALER_CoinSpendPublicKeyP coin_pub;
const json_t *contract_terms;
const json_t *wire_details;
- struct GNUNET_HashCode h_wire_details;
- struct GNUNET_HashCode h_contract_terms;
+ struct TALER_MerchantWireHash h_wire_details;
+ struct TALER_PrivateContractHash h_contract_terms;
const struct TALER_MerchantPrivateKeyP *merchant_priv;
(void) cmd;
@@ -210,7 +209,6 @@ track_transaction_run (void *cls,
/* Get the strings.. */
if (GNUNET_OK !=
TALER_TESTING_get_trait_wire_details (transaction_cmd,
- 0,
&wire_details))
{
GNUNET_break (0);
@@ -220,7 +218,6 @@ track_transaction_run (void *cls,
if (GNUNET_OK !=
TALER_TESTING_get_trait_contract_terms (transaction_cmd,
- 0,
&contract_terms))
{
GNUNET_break (0);
@@ -247,7 +244,6 @@ track_transaction_run (void *cls,
if (GNUNET_OK !=
TALER_TESTING_get_trait_merchant_priv (transaction_cmd,
- 0,
&merchant_priv))
{
GNUNET_break (0);
@@ -301,7 +297,7 @@ track_transaction_cleanup (void *cls,
* @param index index number of the object to offer.
* @return #GNUNET_OK on success.
*/
-static int
+static enum GNUNET_GenericReturnValue
track_transaction_traits (void *cls,
const void **ret,
const char *trait,
@@ -309,7 +305,7 @@ track_transaction_traits (void *cls,
{
struct TrackTransactionState *tts = cls;
struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_wtid (0, &tts->wtid),
+ TALER_TESTING_make_trait_wtid (&tts->wtid),
TALER_TESTING_trait_end ()
};
diff --git a/src/testing/testing_api_cmd_exec_aggregator.c b/src/testing/testing_api_cmd_exec_aggregator.c
index 6ec56c175..38875db94 100644
--- a/src/testing/testing_api_cmd_exec_aggregator.c
+++ b/src/testing/testing_api_cmd_exec_aggregator.c
@@ -115,7 +115,7 @@ aggregator_cleanup (void *cls,
* @param index index number of the object to offer.
* @return #GNUNET_OK on success
*/
-static int
+static enum GNUNET_GenericReturnValue
aggregator_traits (void *cls,
const void **ret,
const char *trait,
@@ -123,7 +123,7 @@ aggregator_traits (void *cls,
{
struct AggregatorState *as = cls;
struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_process (0, &as->aggregator_proc),
+ TALER_TESTING_make_trait_process (&as->aggregator_proc),
TALER_TESTING_trait_end ()
};
@@ -134,14 +134,6 @@ aggregator_traits (void *cls,
}
-/**
- * Make a "aggregator" CMD.
- *
- * @param label command label.
- * @param config_filename configuration file for the
- * aggregator to use.
- * @return the command.
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_exec_aggregator (const char *label,
const char *config_filename)
diff --git a/src/testing/testing_api_cmd_exec_closer.c b/src/testing/testing_api_cmd_exec_closer.c
index c1153babb..442fb4ce0 100644
--- a/src/testing/testing_api_cmd_exec_closer.c
+++ b/src/testing/testing_api_cmd_exec_closer.c
@@ -65,7 +65,7 @@ struct CloserState
/**
* Do we expect the command to actually close a reserve?
*/
- int expect_close;
+ bool expect_close;
};
@@ -93,7 +93,6 @@ closer_run (void *cls,
as->reserve_ref);
if (GNUNET_OK !=
TALER_TESTING_get_trait_reserve_pub (rcmd,
- 0,
&reserve_pubp))
{
GNUNET_break (0);
@@ -156,7 +155,7 @@ closer_cleanup (void *cls,
* @param index index number of the object to offer.
* @return #GNUNET_OK on success
*/
-static int
+static enum GNUNET_GenericReturnValue
closer_traits (void *cls,
const void **ret,
const char *trait,
@@ -164,15 +163,13 @@ closer_traits (void *cls,
{
struct CloserState *as = cls;
struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_process (0, &as->closer_proc),
+ TALER_TESTING_make_trait_process (&as->closer_proc),
TALER_TESTING_trait_end ()
};
struct TALER_TESTING_Trait xtraits[] = {
- TALER_TESTING_make_trait_process (0, &as->closer_proc),
- TALER_TESTING_make_trait_reserve_pub (0,
- &as->reserve_pub),
- TALER_TESTING_make_trait_reserve_history (0,
- &as->reserve_history),
+ TALER_TESTING_make_trait_process (&as->closer_proc),
+ TALER_TESTING_make_trait_reserve_pub (&as->reserve_pub),
+ TALER_TESTING_make_trait_reserve_history (&as->reserve_history),
TALER_TESTING_trait_end ()
};
@@ -185,22 +182,6 @@ closer_traits (void *cls,
}
-/**
- * Make a "closer" CMD. Note that it is right now not supported to run the
- * closer to close multiple reserves in combination with a subsequent reserve
- * status call, as we cannot generate the traits necessary for multiple closed
- * reserves. You can work around this by using multiple closer commands, one
- * per reserve that is being closed.
- *
- * @param label command label.
- * @param config_filename configuration file for the
- * closer to use.
- * @param expected_amount amount we expect to see wired from a @a expected_reserve_ref
- * @param expected_fee closing fee we expect to see
- * @param expected_reserve_ref reference to a reserve we expect the closer to drain;
- * NULL if we do not expect the closer to do anything
- * @return the command.
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_exec_closer (const char *label,
const char *config_filename,
@@ -214,7 +195,7 @@ TALER_TESTING_cmd_exec_closer (const char *label,
as->config_filename = config_filename;
if (NULL != expected_reserve_ref)
{
- as->expect_close = GNUNET_YES;
+ as->expect_close = true;
as->reserve_ref = expected_reserve_ref;
if (GNUNET_OK !=
TALER_string_to_amount (expected_amount,
diff --git a/src/testing/testing_api_cmd_exec_transfer.c b/src/testing/testing_api_cmd_exec_transfer.c
index 796f32d07..beceec574 100644
--- a/src/testing/testing_api_cmd_exec_transfer.c
+++ b/src/testing/testing_api_cmd_exec_transfer.c
@@ -116,7 +116,7 @@ transfer_cleanup (void *cls,
* @param index index number of the object to offer.
* @return #GNUNET_OK on success
*/
-static int
+static enum GNUNET_GenericReturnValue
transfer_traits (void *cls,
const void **ret,
const char *trait,
@@ -124,7 +124,7 @@ transfer_traits (void *cls,
{
struct TransferState *as = cls;
struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_process (0, &as->transfer_proc),
+ TALER_TESTING_make_trait_process (&as->transfer_proc),
TALER_TESTING_trait_end ()
};
@@ -135,14 +135,6 @@ transfer_traits (void *cls,
}
-/**
- * Make a "transfer" CMD.
- *
- * @param label command label.
- * @param config_filename configuration file for the
- * transfer to use.
- * @return the command.
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_exec_transfer (const char *label,
const char *config_filename)
diff --git a/src/testing/testing_api_cmd_exec_wirewatch.c b/src/testing/testing_api_cmd_exec_wirewatch.c
index 2c50b4f4a..e4188ac8a 100644
--- a/src/testing/testing_api_cmd_exec_wirewatch.c
+++ b/src/testing/testing_api_cmd_exec_wirewatch.c
@@ -46,6 +46,7 @@ struct WirewatchState
const char *config_filename;
};
+
/**
* Run the command; use the `taler-exchange-wirewatch' program.
*
@@ -115,7 +116,7 @@ wirewatch_cleanup (void *cls,
* @param index index number of the object to offer.
* @return #GNUNET_OK on success.
*/
-static int
+static enum GNUNET_GenericReturnValue
wirewatch_traits (void *cls,
const void **ret,
const char *trait,
@@ -123,8 +124,7 @@ wirewatch_traits (void *cls,
{
struct WirewatchState *ws = cls;
struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_process (0,
- &ws->wirewatch_proc),
+ TALER_TESTING_make_trait_process (&ws->wirewatch_proc),
TALER_TESTING_trait_end ()
};
@@ -135,13 +135,6 @@ wirewatch_traits (void *cls,
}
-/**
- * Make a "wirewatch" CMD.
- *
- * @param label command label.
- * @param config_filename configuration filename.
- * @return the command.
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_exec_wirewatch (const char *label,
const char *config_filename)
diff --git a/src/testing/testing_api_cmd_rewind.c b/src/testing/testing_api_cmd_rewind.c
index 979607cd7..9e19773cc 100644
--- a/src/testing/testing_api_cmd_rewind.c
+++ b/src/testing/testing_api_cmd_rewind.c
@@ -68,13 +68,12 @@ rewind_ip_cleanup (void *cls,
* @return #GNUNET_OK on success, #GNUNET_NO if target was not found,
* #GNUNET_SYSERR if target is in the future and we failed
*/
-static int
+static enum GNUNET_GenericReturnValue
seek_batch (struct TALER_TESTING_Interpreter *is,
const struct TALER_TESTING_Command *cmd,
const struct TALER_TESTING_Command *target)
{
unsigned int new_ip;
-#define BATCH_INDEX 1
struct TALER_TESTING_Command *batch;
struct TALER_TESTING_Command *current;
struct TALER_TESTING_Command *icmd;
@@ -82,9 +81,8 @@ seek_batch (struct TALER_TESTING_Interpreter *is,
current = TALER_TESTING_cmd_batch_get_current (cmd);
GNUNET_assert (GNUNET_OK ==
- TALER_TESTING_get_trait_cmd (cmd,
- BATCH_INDEX,
- &batch));
+ TALER_TESTING_get_trait_batch_cmds (cmd,
+ &batch));
match = NULL;
for (new_ip = 0;
NULL != (icmd = &batch[new_ip]);
@@ -189,15 +187,6 @@ rewind_ip_run (void *cls,
}
-/**
- * Make the instruction pointer point to @a new_ip
- * only if @a counter is greater than zero.
- *
- * @param label command label
- * @param target_label label of the new instruction pointer's destination after the jump;
- * must be before the current instruction
- * @param counter counts how many times the rewinding is to happen.
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_rewind_ip (const char *label,
const char *target_label,
diff --git a/src/testing/testing_api_cmd_stat.c b/src/testing/testing_api_cmd_stat.c
index 9461a22cf..d74e9bb2c 100644
--- a/src/testing/testing_api_cmd_stat.c
+++ b/src/testing/testing_api_cmd_stat.c
@@ -28,46 +28,6 @@
/**
- * Cleanup the state from a "stat service" CMD.
- *
- * @param cls closure.
- * @param cmd the command which is being cleaned up.
- */
-static void
-stat_cleanup (void *cls,
- const struct TALER_TESTING_Command *cmd)
-{
- (void) cls;
- (void) cmd;
- /* nothing to clean. */
-}
-
-
-/**
- * No traits to offer, just provide a stub to be called when
- * some CMDs iterates through the list of all the commands.
- *
- * @param cls closure.
- * @param[out] ret result.
- * @param trait name of the trait.
- * @param index index number of the trait to return.
- * @return #GNUNET_OK on success.
- */
-static int
-stat_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
-{
- (void) cls;
- (void) ret;
- (void) trait;
- (void) index;
- return GNUNET_NO;
-}
-
-
-/**
* Add the time @a cmd took to the respective duration in @a timings.
*
* @param timings where to add up times
@@ -123,19 +83,19 @@ do_stat (struct TALER_TESTING_Timer *timings,
{
if (TALER_TESTING_cmd_is_batch (cmd))
{
-#define BATCH_INDEX 1
struct TALER_TESTING_Command *bcmd;
if (GNUNET_OK !=
- TALER_TESTING_get_trait_cmd (cmd,
- BATCH_INDEX,
- &bcmd))
+ TALER_TESTING_get_trait_batch_cmds (cmd,
+ &bcmd))
{
GNUNET_break (0);
return;
}
- for (unsigned int j = 0; NULL != bcmd[j].label; j++)
+ for (unsigned int j = 0;
+ NULL != bcmd[j].label;
+ j++)
do_stat (timings,
&bcmd[j]);
}
@@ -172,20 +132,12 @@ stat_run (void *cls,
}
-/**
- * Obtain performance data from the interpreter.
- *
- * @param timers what commands (by label) to obtain runtimes for
- * @return the command
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_stat (struct TALER_TESTING_Timer *timers)
{
struct TALER_TESTING_Command cmd = {
.label = "stat",
.run = stat_run,
- .cleanup = stat_cleanup,
- .traits = stat_traits,
.cls = (void *) timers
};
diff --git a/src/testing/testing_api_cmd_status.c b/src/testing/testing_api_cmd_status.c
index 6acfcc75b..1dba675b3 100644
--- a/src/testing/testing_api_cmd_status.c
+++ b/src/testing/testing_api_cmd_status.c
@@ -146,7 +146,7 @@ history_entry_cmp (const struct TALER_EXCHANGE_ReserveHistory *h1,
* @param[in,out] found array to update
* @return #GNUNET_OK if @a cmd action on reserve was found in @a history
*/
-static int
+static enum GNUNET_GenericReturnValue
analyze_command (const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_TESTING_Command *cmd,
unsigned int history_length,
@@ -155,15 +155,13 @@ analyze_command (const struct TALER_ReservePublicKeyP *reserve_pub,
{
if (TALER_TESTING_cmd_is_batch (cmd))
{
-#define BATCH_INDEX 1
struct TALER_TESTING_Command *cur;
struct TALER_TESTING_Command *bcmd;
cur = TALER_TESTING_cmd_batch_get_current (cmd);
if (GNUNET_OK !=
- TALER_TESTING_get_trait_cmd (cmd,
- BATCH_INDEX,
- &bcmd))
+ TALER_TESTING_get_trait_batch_cmds (cmd,
+ &bcmd))
{
GNUNET_break (0);
return GNUNET_SYSERR;
@@ -388,16 +386,6 @@ status_cleanup (void *cls,
}
-/**
- * Create a "reserve status" command.
- *
- * @param label the command label.
- * @param reserve_reference reference to the reserve to check.
- * @param expected_balance expected balance for the reserve.
- * @param expected_response_code expected HTTP response code.
- *
- * @return the command.
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_status (const char *label,
const char *reserve_reference,
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c
index 9e989ca36..ba1555895 100644
--- a/src/testing/testing_api_loop.c
+++ b/src/testing/testing_api_loop.c
@@ -66,7 +66,6 @@ TALER_TESTING_interpreter_lookup_command (struct TALER_TESTING_Interpreter *is,
if (TALER_TESTING_cmd_is_batch (cmd))
{
-#define BATCH_INDEX 1
struct TALER_TESTING_Command *batch;
struct TALER_TESTING_Command *current;
struct TALER_TESTING_Command *icmd;
@@ -74,9 +73,8 @@ TALER_TESTING_interpreter_lookup_command (struct TALER_TESTING_Interpreter *is,
current = TALER_TESTING_cmd_batch_get_current (cmd);
GNUNET_assert (GNUNET_OK ==
- TALER_TESTING_get_trait_cmd (cmd,
- BATCH_INDEX,
- &batch));
+ TALER_TESTING_get_trait_batch_cmds (cmd,
+ &batch));
/* We must do the loop forward, but we can find the last match */
match = NULL;
for (unsigned int j = 0;
@@ -120,15 +118,6 @@ TALER_TESTING_interpreter_get_fakebank (struct TALER_TESTING_Interpreter *is)
}
-/**
- * Run tests starting the "fakebank" first. The "fakebank"
- * is a C minimalist version of the human-oriented Python bank,
- * which is also part of the Taler project.
- *
- * @param is pointer to the interpreter state
- * @param commands the list of commands to execute
- * @param bank_url the url the fakebank is supposed to run on
- */
void
TALER_TESTING_run_with_fakebank (struct TALER_TESTING_Interpreter *is,
struct TALER_TESTING_Command *commands,
@@ -166,9 +155,6 @@ static void
interpreter_run (void *cls);
-/**
- * Current command is done, run the next one.
- */
void
TALER_TESTING_interpreter_next (struct TALER_TESTING_Interpreter *is)
{
@@ -203,11 +189,6 @@ TALER_TESTING_interpreter_next (struct TALER_TESTING_Interpreter *is)
}
-/**
- * Current command failed, clean up and fail the test case.
- *
- * @param is interpreter of the test
- */
void
TALER_TESTING_interpreter_fail (struct TALER_TESTING_Interpreter *is)
{
@@ -228,11 +209,6 @@ TALER_TESTING_interpreter_fail (struct TALER_TESTING_Interpreter *is)
}
-/**
- * Create command array terminator.
- *
- * @return a end-command.
- */
struct TALER_TESTING_Command
TALER_TESTING_cmd_end (void)
{
@@ -243,9 +219,6 @@ TALER_TESTING_cmd_end (void)
}
-/**
- * Obtain current label.
- */
const char *
TALER_TESTING_interpreter_get_current_label (struct
TALER_TESTING_Interpreter *is)
@@ -393,17 +366,8 @@ maint_child_death (void *cls)
enum GNUNET_OS_ProcessStatusType type;
unsigned long code;
- 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));
- cmd = batch_cmd;
- }
-
+ while (TALER_TESTING_cmd_is_batch (cmd))
+ cmd = TALER_TESTING_cmd_batch_get_current (cmd);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Got SIGCHLD for `%s'.\n",
cmd->label);
@@ -469,12 +433,6 @@ maint_child_death (void *cls)
}
-/**
- * Wait until we receive SIGCHLD signal.
- * Then obtain the process trait of the current
- * command, wait on the the zombie and continue
- * with the next command.
- */
void
TALER_TESTING_wait_for_sigchld (struct TALER_TESTING_Interpreter *is)
{
@@ -491,16 +449,6 @@ TALER_TESTING_wait_for_sigchld (struct TALER_TESTING_Interpreter *is)
}
-/**
- * Run the testsuite. Note, CMDs are copied into
- * the interpreter state because they are _usually_
- * defined into the "run" method that returns after
- * having scheduled the test interpreter.
- *
- * @param is the interpreter state
- * @param commands the list of command to execute
- * @param timeout how long to wait
- */
void
TALER_TESTING_run2 (struct TALER_TESTING_Interpreter *is,
struct TALER_TESTING_Command *commands,
@@ -530,15 +478,6 @@ TALER_TESTING_run2 (struct TALER_TESTING_Interpreter *is,
}
-/**
- * Run the testsuite. Note, CMDs are copied into
- * the interpreter state because they are _usually_
- * defined into the "run" method that returns after
- * having scheduled the test interpreter.
- *
- * @param is the interpreter state
- * @param commands the list of command to execute
- */
void
TALER_TESTING_run (struct TALER_TESTING_Interpreter *is,
struct TALER_TESTING_Command *commands)
@@ -597,16 +536,6 @@ sighandler_child_death (void)
}
-/**
- * "Canonical" cert_cb used when we are connecting to the
- * Exchange.
- *
- * @param cls closure, typically, the "run" method containing
- * all the commands to be run, and a closure for it.
- * @param hr HTTP response details
- * @param keys the exchange's keys.
- * @param compat protocol compatibility information.
- */
void
TALER_TESTING_cert_cb (void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr,
@@ -875,25 +804,6 @@ load_urls (struct TALER_TESTING_Interpreter *is)
}
-/**
- * Install signal handlers plus schedules the main wrapper
- * around the "run" method.
- *
- * @param main_cb the "run" method which contains all the
- * commands.
- * @param main_cb_cls a closure for "run", typically NULL.
- * @param cfg configuration to use
- * @param exchanged exchange process handle: will be put in the
- * state as some commands - e.g. revoke - need to send
- * signal to it, for example to let it know to reload the
- * key state.. if NULL, the interpreter will run without
- * trying to connect to the exchange first.
- * @param exchange_connect #GNUNET_YES if the test should connect
- * to the exchange, #GNUNET_NO otherwise
- * @return #GNUNET_OK if all is okay, != #GNUNET_OK otherwise.
- * non-GNUNET_OK codes are #GNUNET_SYSERR most of the
- * times.
- */
int
TALER_TESTING_setup (TALER_TESTING_Main main_cb,
void *main_cb_cls,