This commit is contained in:
Christian Grothoff 2020-01-18 13:57:47 +01:00
parent 4993863c4c
commit 0b4008bd84
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
27 changed files with 365 additions and 318 deletions

View File

@ -95,6 +95,7 @@ libtalertesting_la_SOURCES = \
testing_api_cmd_sleep.c \ testing_api_cmd_sleep.c \
testing_api_cmd_status.c \ testing_api_cmd_status.c \
testing_api_cmd_track.c \ testing_api_cmd_track.c \
testing_api_cmd_wait.c \
testing_api_cmd_wire.c \ testing_api_cmd_wire.c \
testing_api_cmd_withdraw.c \ testing_api_cmd_withdraw.c \
testing_api_cmd_insert_deposit.c \ testing_api_cmd_insert_deposit.c \

View File

@ -16,13 +16,11 @@
License along with TALER; see the file COPYING. If not, see License along with TALER; see the file COPYING. If not, see
<http://www.gnu.org/licenses/> <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file lib/testing_api_cmd_auditor_deposit_confirmation.c * @file lib/testing_api_cmd_auditor_deposit_confirmation.c
* @brief command for testing /deposit_confirmation. * @brief command for testing /deposit_confirmation.
* @author Christian Grothoff * @author Christian Grothoff
*/ */
#include "platform.h" #include "platform.h"
#include "taler_json_lib.h" #include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h> #include <gnunet/gnunet_curl_lib.h>
@ -359,7 +357,7 @@ deposit_confirmation_cleanup (void *cls,
* Offer internal data to other commands. * Offer internal data to other commands.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] set to the wanted data. * @param[out] ret set to the wanted data.
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the traits to be returned. * @param index index number of the traits to be returned.
* *
@ -393,15 +391,13 @@ deposit_confirmation_traits (void *cls,
* @return the command. * @return the command.
*/ */
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_deposit_confirmation TALER_TESTING_cmd_deposit_confirmation (const char *label,
(const char *label,
struct TALER_AUDITOR_Handle *auditor, struct TALER_AUDITOR_Handle *auditor,
const char *deposit_reference, const char *deposit_reference,
unsigned int coin_index, unsigned int coin_index,
const char *amount_without_fee, const char *amount_without_fee,
unsigned int expected_response_code) unsigned int expected_response_code)
{ {
struct TALER_TESTING_Command cmd = {0}; /* need explicit zeroing..*/
struct DepositConfirmationState *dcs; struct DepositConfirmationState *dcs;
dcs = GNUNET_new (struct DepositConfirmationState); dcs = GNUNET_new (struct DepositConfirmationState);
@ -411,14 +407,18 @@ TALER_TESTING_cmd_deposit_confirmation
dcs->amount_without_fee = amount_without_fee; dcs->amount_without_fee = amount_without_fee;
dcs->expected_response_code = expected_response_code; dcs->expected_response_code = expected_response_code;
cmd.cls = dcs; {
cmd.label = label; struct TALER_TESTING_Command cmd = {
cmd.run = &deposit_confirmation_run; .cls = dcs,
cmd.cleanup = &deposit_confirmation_cleanup; .label = label,
cmd.traits = &deposit_confirmation_traits; .run = &deposit_confirmation_run,
.cleanup = &deposit_confirmation_cleanup,
.traits = &deposit_confirmation_traits
};
return cmd; return cmd;
} }
}
/** /**

View File

@ -253,10 +253,9 @@ exchanges_cleanup (void *cls,
* Offer internal data to other commands. * Offer internal data to other commands.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] set to the wanted data. * @param[out] ret set to the wanted data.
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the traits to be returned. * @param index index number of the traits to be returned.
*
* @return #GNUNET_OK on success * @return #GNUNET_OK on success
*/ */
static int static int
@ -280,26 +279,28 @@ exchanges_traits (void *cls,
* @return the command. * @return the command.
*/ */
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_exchanges TALER_TESTING_cmd_exchanges (const char *label,
(const char *label,
struct TALER_AUDITOR_Handle *auditor, struct TALER_AUDITOR_Handle *auditor,
unsigned int expected_response_code) unsigned int expected_response_code)
{ {
struct TALER_TESTING_Command cmd = {0}; /* need explicit zeroing..*/
struct ExchangesState *es; struct ExchangesState *es;
es = GNUNET_new (struct ExchangesState); es = GNUNET_new (struct ExchangesState);
es->auditor = auditor; es->auditor = auditor;
es->expected_response_code = expected_response_code; es->expected_response_code = expected_response_code;
cmd.cls = es; {
cmd.label = label; struct TALER_TESTING_Command cmd = {
cmd.run = &exchanges_run; .cls = es,
cmd.cleanup = &exchanges_cleanup; .label = label,
cmd.traits = &exchanges_traits; .run = &exchanges_run,
.cleanup = &exchanges_cleanup,
.traits = &exchanges_traits
};
return cmd; return cmd;
} }
}
/** /**
@ -314,26 +315,27 @@ TALER_TESTING_cmd_exchanges
* @return the command. * @return the command.
*/ */
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_exchanges_with_url TALER_TESTING_cmd_exchanges_with_url (const char *label,
(const char *label,
unsigned int expected_response_code, unsigned int expected_response_code,
const char *exchange_url) const char *exchange_url)
{ {
struct TALER_TESTING_Command cmd = {0}; /* need explicit zeroing..*/
struct ExchangesState *es; struct ExchangesState *es;
es = GNUNET_new (struct ExchangesState); es = GNUNET_new (struct ExchangesState);
es->expected_response_code = expected_response_code; es->expected_response_code = expected_response_code;
es->exchange_url = exchange_url; es->exchange_url = exchange_url;
{
cmd.cls = es; struct TALER_TESTING_Command cmd = {
cmd.label = label; .cls = es,
cmd.run = &exchanges_run; .label = label,
cmd.cleanup = &exchanges_cleanup; .run = &exchanges_run,
cmd.traits = &exchanges_traits; .cleanup = &exchanges_cleanup,
.traits = &exchanges_traits
};
return cmd; return cmd;
} }
}
/** /**

View File

@ -16,7 +16,6 @@
License along with TALER; see the file COPYING. If not, License along with TALER; see the file COPYING. If not,
see <http://www.gnu.org/licenses/> see <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file lib/testing_api_cmd_auditor_exec_auditor.c * @file lib/testing_api_cmd_auditor_exec_auditor.c
* @brief run the taler-auditor command * @brief run the taler-auditor command
@ -111,7 +110,7 @@ auditor_cleanup (void *cls,
* Offer "auditor" CMD internal data to other commands. * Offer "auditor" CMD internal data to other commands.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result * @param[out] ret result
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the object to offer. * @param index index number of the object to offer.
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.
@ -146,18 +145,22 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_exec_auditor (const char *label, TALER_TESTING_cmd_exec_auditor (const char *label,
const char *config_filename) const char *config_filename)
{ {
struct TALER_TESTING_Command cmd;
struct AuditorState *ks; struct AuditorState *ks;
ks = GNUNET_new (struct AuditorState); ks = GNUNET_new (struct AuditorState);
ks->config_filename = config_filename; ks->config_filename = config_filename;
cmd.cls = ks; {
cmd.label = label; struct TALER_TESTING_Command cmd = {
cmd.run = &auditor_run; .cls = ks,
cmd.cleanup = &auditor_cleanup; .label = label,
cmd.traits = &auditor_traits; .run = &auditor_run,
.cleanup = &auditor_cleanup,
.traits = &auditor_traits
};
return cmd; return cmd;
} }
}
/* end of testing_auditor_api_cmd_exec_auditor.c */ /* end of testing_auditor_api_cmd_exec_auditor.c */

View File

@ -16,7 +16,6 @@
License along with TALER; see the file COPYING. If not, License along with TALER; see the file COPYING. If not,
see <http://www.gnu.org/licenses/> see <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file lib/testing_api_cmd_auditor_exec_auditor_dbinit.c * @file lib/testing_api_cmd_auditor_exec_auditor_dbinit.c
* @brief run the taler-auditor-dbinit "-r" command * @brief run the taler-auditor-dbinit "-r" command
@ -112,7 +111,7 @@ auditor_dbinit_cleanup (void *cls,
* Offer "auditor-dbinit" CMD internal data to other commands. * Offer "auditor-dbinit" CMD internal data to other commands.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result * @param[out] ret result
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the object to offer. * @param index index number of the object to offer.
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.
@ -147,18 +146,22 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_exec_auditor_dbinit (const char *label, TALER_TESTING_cmd_exec_auditor_dbinit (const char *label,
const char *config_filename) const char *config_filename)
{ {
struct TALER_TESTING_Command cmd;
struct AuditorDbinitState *ks; struct AuditorDbinitState *ks;
ks = GNUNET_new (struct AuditorDbinitState); ks = GNUNET_new (struct AuditorDbinitState);
ks->config_filename = config_filename; ks->config_filename = config_filename;
cmd.cls = ks; {
cmd.label = label; struct TALER_TESTING_Command cmd = {
cmd.run = &auditor_dbinit_run; .cls = ks,
cmd.cleanup = &auditor_dbinit_cleanup; .label = label.
cmd.traits = &auditor_dbinit_traits; .run = &auditor_dbinit_run,
.cleanup = &auditor_dbinit_cleanup,
.traits = &auditor_dbinit_traits
};
return cmd; return cmd;
} }
}
/* end of testing_auditor_api_cmd_exec_auditor_dbinit.c */ /* end of testing_auditor_api_cmd_exec_auditor_dbinit.c */

View File

@ -16,7 +16,6 @@
License along with TALER; see the file COPYING. If not, License along with TALER; see the file COPYING. If not,
see <http://www.gnu.org/licenses/> see <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file lib/testing_api_cmd_auditor_exec_wire_auditor.c * @file lib/testing_api_cmd_auditor_exec_wire_auditor.c
* @brief run the taler-wire-auditor command * @brief run the taler-wire-auditor command
@ -111,7 +110,7 @@ wire_auditor_cleanup (void *cls,
* Offer "wire-auditor" CMD internal data to other commands. * Offer "wire-auditor" CMD internal data to other commands.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result * @param[out] ret result
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the object to offer. * @param index index number of the object to offer.
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.
@ -146,18 +145,22 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_exec_wire_auditor (const char *label, TALER_TESTING_cmd_exec_wire_auditor (const char *label,
const char *config_filename) const char *config_filename)
{ {
struct TALER_TESTING_Command cmd;
struct WireAuditorState *ks; struct WireAuditorState *ks;
ks = GNUNET_new (struct WireAuditorState); ks = GNUNET_new (struct WireAuditorState);
ks->config_filename = config_filename; ks->config_filename = config_filename;
cmd.cls = ks; {
cmd.label = label; struct TALER_TESTING_Command cmd = {
cmd.run = &wire_auditor_run; .cls = ks,
cmd.cleanup = &wire_auditor_cleanup; .label = label,
cmd.traits = &wire_auditor_traits; .run = &wire_auditor_run,
.cleanup = &wire_auditor_cleanup,
.traits = &wire_auditor_traits
};
return cmd; return cmd;
} }
}
/* end of testing_auditor_api_cmd_exec_wire_auditor.c */ /* end of testing_auditor_api_cmd_exec_wire_auditor.c */

View File

@ -384,7 +384,7 @@ admin_add_incoming_cleanup (void *cls,
* commands. * commands.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result * @param[out] ret result
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the object to offer. * @param index index number of the object to offer.
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.
@ -488,10 +488,10 @@ make_command (const char *label,
* @return the command. * @return the command.
*/ */
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_admin_add_incoming TALER_TESTING_cmd_admin_add_incoming (const char *label,
(const char *label,
const char *amount, const char *amount,
const struct TALER_BANK_AuthenticationData *auth, const struct
TALER_BANK_AuthenticationData *auth,
const char *payto_debit_account) const char *payto_debit_account)
{ {
return make_command (label, return make_command (label,

View File

@ -162,7 +162,7 @@ check_bank_admin_transfer_cleanup (void *cls,
* Offer internal data from a "bank admin check" CMD state. * Offer internal data from a "bank admin check" CMD state.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result. * @param[out] ret result.
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the object to offer. * @param index index number of the object to offer.
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.

View File

@ -190,8 +190,7 @@ check_bank_transfer_run (void *cls,
* @param cmd the command which is being cleaned up. * @param cmd the command which is being cleaned up.
*/ */
static void static void
check_bank_transfer_cleanup check_bank_transfer_cleanup (void *cls,
(void *cls,
const struct TALER_TESTING_Command *cmd) const struct TALER_TESTING_Command *cmd)
{ {
struct BankCheckState *bcs = cls; struct BankCheckState *bcs = cls;
@ -204,7 +203,7 @@ check_bank_transfer_cleanup
* Offer internal data from a "bank check" CMD state. * Offer internal data from a "bank check" CMD state.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result. * @param[out] ret result.
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the object to offer. * @param index index number of the object to offer.
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.
@ -246,8 +245,7 @@ check_bank_transfer_traits (void *cls,
* @return the command * @return the command
*/ */
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_check_bank_transfer TALER_TESTING_cmd_check_bank_transfer (const char *label,
(const char *label,
const char *exchange_base_url, const char *exchange_base_url,
const char *amount, const char *amount,
const char *debit_payto, const char *debit_payto,

View File

@ -115,7 +115,7 @@ struct HistoryState
* Offer internal data to other commands. * Offer internal data to other commands.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] set to the wanted data. * @param[out] ret set to the wanted data.
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the traits to be returned. * @param index index number of the traits to be returned.
* *

View File

@ -119,7 +119,7 @@ struct HistoryState
* Offer internal data to other commands. * Offer internal data to other commands.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] set to the wanted data. * @param[out] ret set to the wanted data.
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the traits to be returned. * @param index index number of the traits to be returned.
* *

View File

@ -294,7 +294,7 @@ transfer_cleanup (void *cls,
* commands. * commands.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result * @param[out] ret result
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the object to offer. * @param index index number of the object to offer.
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.
@ -340,8 +340,7 @@ transfer_traits (void *cls,
* @return the command. * @return the command.
*/ */
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_transfer TALER_TESTING_cmd_transfer (const char *label,
(const char *label,
const char *amount, const char *amount,
const struct TALER_BANK_AuthenticationData *auth, const struct TALER_BANK_AuthenticationData *auth,
const char *payto_debit_account, const char *payto_debit_account,

View File

@ -105,7 +105,7 @@ batch_cleanup (void *cls,
* Offer internal data from a "batch" CMD, to other commands. * Offer internal data from a "batch" CMD, to other commands.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result. * @param[out] ret result.
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the object to offer. * @param index index number of the object to offer.
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.
@ -168,7 +168,7 @@ TALER_TESTING_cmd_batch (const char *label,
memcpy (bs->batch, memcpy (bs->batch,
batch, batch,
sizeof (struct TALER_TESTING_Command) * i); sizeof (struct TALER_TESTING_Command) * i);
{
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.cls = bs, .cls = bs,
.label = label, .label = label,
@ -179,6 +179,7 @@ TALER_TESTING_cmd_batch (const char *label,
return cmd; return cmd;
} }
}
/** /**
@ -187,8 +188,7 @@ TALER_TESTING_cmd_batch (const char *label,
* @param is interpreter state. * @param is interpreter state.
*/ */
void void
TALER_TESTING_cmd_batch_next TALER_TESTING_cmd_batch_next (struct TALER_TESTING_Interpreter *is)
(struct TALER_TESTING_Interpreter *is)
{ {
struct BatchState *bs = is->commands[is->ip].cls; struct BatchState *bs = is->commands[is->ip].cls;
@ -208,8 +208,7 @@ TALER_TESTING_cmd_batch_next
* @return false if not, true if it is a batch command * @return false if not, true if it is a batch command
*/ */
int int
TALER_TESTING_cmd_is_batch TALER_TESTING_cmd_is_batch (const struct TALER_TESTING_Command *cmd)
(const struct TALER_TESTING_Command *cmd)
{ {
return cmd->run == &batch_run; return cmd->run == &batch_run;
} }
@ -221,8 +220,7 @@ TALER_TESTING_cmd_is_batch
* @return cmd current batch command * @return cmd current batch command
*/ */
struct TALER_TESTING_Command * struct TALER_TESTING_Command *
TALER_TESTING_cmd_batch_get_current TALER_TESTING_cmd_batch_get_current (const struct TALER_TESTING_Command *cmd)
(const struct TALER_TESTING_Command *cmd)
{ {
struct BatchState *bs = cmd->cls; struct BatchState *bs = cmd->cls;

View File

@ -396,7 +396,7 @@ deposit_cleanup (void *cls,
* Offer internal data from a "deposit" CMD, to other commands. * Offer internal data from a "deposit" CMD, to other commands.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result. * @param[out] ret result.
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the object to offer. * @param index index number of the object to offer.
* *

View File

@ -16,7 +16,6 @@
License along with TALER; see the file COPYING. If not, License along with TALER; see the file COPYING. If not,
see <http://www.gnu.org/licenses/> see <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file lib/testing_api_cmd_exec_aggregator.c * @file lib/testing_api_cmd_exec_aggregator.c
* @brief run the taler-exchange-aggregator command * @brief run the taler-exchange-aggregator command
@ -111,7 +110,7 @@ aggregator_cleanup (void *cls,
* Offer "aggregator" CMD internal data to other commands. * Offer "aggregator" CMD internal data to other commands.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result. * @param[out] ret result.
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the object to offer. * @param index index number of the object to offer.
* @return #GNUNET_OK on success * @return #GNUNET_OK on success
@ -151,7 +150,7 @@ TALER_TESTING_cmd_exec_aggregator (const char *label,
as = GNUNET_new (struct AggregatorState); as = GNUNET_new (struct AggregatorState);
as->config_filename = config_filename; as->config_filename = config_filename;
{
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.cls = as, .cls = as,
.label = label, .label = label,
@ -162,6 +161,7 @@ TALER_TESTING_cmd_exec_aggregator (const char *label,
return cmd; return cmd;
} }
}
/* end of testing_api_cmd_exec_aggregator.c */ /* end of testing_api_cmd_exec_aggregator.c */

View File

@ -175,7 +175,7 @@ auditor_sign_cleanup (void *cls,
* Offer "auditor sign" CMD internal data to other commands. * Offer "auditor sign" CMD internal data to other commands.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result. * @param[out] ret result.
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the object to offer. * @param index index number of the object to offer.
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.

View File

@ -143,7 +143,7 @@ keyup_cleanup (void *cls,
* Offer "keyup" CMD internal data to other commands. * Offer "keyup" CMD internal data to other commands.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result * @param[out] ret result
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the object to offer. * @param index index number of the object to offer.
* *
@ -189,7 +189,7 @@ TALER_TESTING_cmd_exec_keyup_with_now
ks->config_filename = config_filename; ks->config_filename = config_filename;
ks->now = now; ks->now = now;
ks->with_now = GNUNET_YES; ks->with_now = GNUNET_YES;
{
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.cls = ks, .cls = ks,
.label = label, .label = label,
@ -200,6 +200,7 @@ TALER_TESTING_cmd_exec_keyup_with_now
return cmd; return cmd;
} }
}
/** /**
@ -218,7 +219,7 @@ TALER_TESTING_cmd_exec_keyup (const char *label,
ks = GNUNET_new (struct KeyupState); ks = GNUNET_new (struct KeyupState);
ks->config_filename = config_filename; ks->config_filename = config_filename;
{
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.cls = ks, .cls = ks,
.label = label, .label = label,
@ -229,6 +230,7 @@ TALER_TESTING_cmd_exec_keyup (const char *label,
return cmd; return cmd;
} }
}
/* end of testing_api_cmd_exec_keyup.c */ /* end of testing_api_cmd_exec_keyup.c */

View File

@ -16,7 +16,6 @@
License along with TALER; see the file COPYING. If not, see License along with TALER; see the file COPYING. If not, see
<http://www.gnu.org/licenses/> <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file lib/testing_api_cmd_exec_wirewatch.c * @file lib/testing_api_cmd_exec_wirewatch.c
* @brief run the taler-exchange-wirewatch command * @brief run the taler-exchange-wirewatch command
@ -111,7 +110,7 @@ wirewatch_cleanup (void *cls,
* Offer "wirewatch" CMD internal data to other commands. * Offer "wirewatch" CMD internal data to other commands.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result. * @param[out] ret result.
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the object to offer. * @param index index number of the object to offer.
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.
@ -152,7 +151,7 @@ TALER_TESTING_cmd_exec_wirewatch (const char *label,
ws = GNUNET_new (struct WirewatchState); ws = GNUNET_new (struct WirewatchState);
ws->config_filename = config_filename; ws->config_filename = config_filename;
{
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.cls = ws, .cls = ws,
.label = label, .label = label,
@ -163,6 +162,7 @@ TALER_TESTING_cmd_exec_wirewatch (const char *label,
return cmd; return cmd;
} }
}
/* end of testing_api_cmd_exec_wirewatch.c */ /* end of testing_api_cmd_exec_wirewatch.c */

View File

@ -141,7 +141,7 @@ insert_deposit_run (void *cls,
return; return;
} }
// prepare and store deposit now. /* prepare and store deposit now. */
memset (&deposit, memset (&deposit,
0, 0,
sizeof (deposit)); sizeof (deposit));
@ -250,7 +250,7 @@ insert_deposit_cleanup (void *cls,
* Offer "insert-deposit" CMD internal data to other commands. * Offer "insert-deposit" CMD internal data to other commands.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result * @param[out] ret result
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the object to offer. * @param index index number of the object to offer.
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.
@ -261,6 +261,10 @@ insert_deposit_traits (void *cls,
const char *trait, const char *trait,
unsigned int index) unsigned int index)
{ {
(void) cls;
(void) ret;
(void) trait;
(void) index;
return GNUNET_NO; return GNUNET_NO;
} }
@ -288,7 +292,6 @@ TALER_TESTING_cmd_insert_deposit (const char *label,
const char *amount_with_fee, const char *amount_with_fee,
const char *deposit_fee) const char *deposit_fee)
{ {
struct TALER_TESTING_Command cmd;
struct InsertDepositState *ids; struct InsertDepositState *ids;
ids = GNUNET_new (struct InsertDepositState); ids = GNUNET_new (struct InsertDepositState);
@ -299,14 +302,18 @@ TALER_TESTING_cmd_insert_deposit (const char *label,
ids->amount_with_fee = amount_with_fee; ids->amount_with_fee = amount_with_fee;
ids->deposit_fee = deposit_fee; ids->deposit_fee = deposit_fee;
cmd.cls = ids; {
cmd.label = label; struct TALER_TESTING_Command cmd = {
cmd.run = &insert_deposit_run; .cls = ids,
cmd.cleanup = &insert_deposit_cleanup; .label = label,
cmd.traits = &insert_deposit_traits; .run = &insert_deposit_run,
.cleanup = &insert_deposit_cleanup,
.traits = &insert_deposit_traits
};
return cmd; return cmd;
} }
}
/* end of testing_api_cmd_insert_deposit.c */ /* end of testing_api_cmd_insert_deposit.c */

View File

@ -16,13 +16,11 @@
License along with TALER; see the file COPYING. If not, see License along with TALER; see the file COPYING. If not, see
<http://www.gnu.org/licenses/> <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file lib/testing_api_cmd_payback.c * @file lib/testing_api_cmd_payback.c
* @brief Implement the /revoke and /payback test commands. * @brief Implement the /revoke and /payback test commands.
* @author Marcello Stanisci * @author Marcello Stanisci
*/ */
#include "platform.h" #include "platform.h"
#include "taler_json_lib.h" #include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h> #include <gnunet/gnunet_curl_lib.h>
@ -112,8 +110,8 @@ struct PaybackState
* Parser reference to a coin. * Parser reference to a coin.
* *
* @param coin_reference of format $LABEL['#' $INDEX]? * @param coin_reference of format $LABEL['#' $INDEX]?
* @param cref[out] where we return a copy of $LABEL * @param[out] cref where we return a copy of $LABEL
* @param idx[out] where we set $INDEX * @param[out] idx where we set $INDEX
* @return #GNUNET_SYSERR if $INDEX is present but not numeric * @return #GNUNET_SYSERR if $INDEX is present but not numeric
*/ */
static int static int
@ -459,7 +457,7 @@ payback_cleanup (void *cls,
* Offer internal data from a "revoke" CMD to other CMDs. * Offer internal data from a "revoke" CMD to other CMDs.
* *
* @param cls closure * @param cls closure
* @param ret[out] result (could be anything) * @param[out] ret result (could be anything)
* @param trait name of the trait * @param trait name of the trait
* @param index index number of the object to offer. * @param index index number of the object to offer.
* @return #GNUNET_OK on success * @return #GNUNET_OK on success
@ -470,7 +468,6 @@ revoke_traits (void *cls,
const char *trait, const char *trait,
unsigned int index) unsigned int index)
{ {
struct RevokeState *rs = cls; struct RevokeState *rs = cls;
struct TALER_TESTING_Trait traits[] = { struct TALER_TESTING_Trait traits[] = {
/* Needed by the handler which waits the proc' /* Needed by the handler which waits the proc'
@ -596,7 +593,6 @@ TALER_TESTING_cmd_payback (const char *label,
* @param coin_reference reference to a CMD that will offer the * @param coin_reference reference to a CMD that will offer the
* denomination to revoke. * denomination to revoke.
* @param config_filename configuration file name. * @param config_filename configuration file name.
*
* @return the command. * @return the command.
*/ */
struct TALER_TESTING_Command struct TALER_TESTING_Command

View File

@ -1063,7 +1063,7 @@ refresh_melt_cleanup (void *cls,
* Offer internal data to the "refresh melt" CMD. * Offer internal data to the "refresh melt" CMD.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result (could be anything). * @param[out] ret result (could be anything).
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the object to offer. * @param index index number of the object to offer.
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.
@ -1254,7 +1254,7 @@ TALER_TESTING_cmd_refresh_melt_with_retry (struct TALER_TESTING_Command cmd)
* Offer internal data from a "refresh reveal" CMD. * Offer internal data from a "refresh reveal" CMD.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result (could be anything). * @param[out] ret result (could be anything).
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the object to offer. * @param index index number of the object to offer.
* *
@ -1322,8 +1322,7 @@ refresh_reveal_traits (void *cls,
* @return the command. * @return the command.
*/ */
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_refresh_reveal TALER_TESTING_cmd_refresh_reveal (const char *label,
(const char *label,
const char *melt_reference, const char *melt_reference,
unsigned int expected_response_code) unsigned int expected_response_code)
{ {
@ -1374,8 +1373,7 @@ TALER_TESTING_cmd_refresh_reveal_with_retry (struct TALER_TESTING_Command cmd)
* @return the "refresh link" command * @return the "refresh link" command
*/ */
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_refresh_link TALER_TESTING_cmd_refresh_link (const char *label,
(const char *label,
const char *reveal_reference, const char *reveal_reference,
unsigned int expected_response_code) unsigned int expected_response_code)
{ {
@ -1384,7 +1382,7 @@ TALER_TESTING_cmd_refresh_link
rrs = GNUNET_new (struct RefreshLinkState); rrs = GNUNET_new (struct RefreshLinkState);
rrs->reveal_reference = reveal_reference; rrs->reveal_reference = reveal_reference;
rrs->expected_response_code = expected_response_code; rrs->expected_response_code = expected_response_code;
{
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.cls = rrs, .cls = rrs,
.label = label, .label = label,
@ -1394,6 +1392,7 @@ TALER_TESTING_cmd_refresh_link
return cmd; return cmd;
} }
}
/** /**

View File

@ -16,13 +16,11 @@
License along with TALER; see the file COPYING. If not, see License along with TALER; see the file COPYING. If not, see
<http://www.gnu.org/licenses/> <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file lib/testing_api_cmd_serialize_keys.c * @file lib/testing_api_cmd_serialize_keys.c
* @brief Lets tests use the keys serialization API. * @brief Lets tests use the keys serialization API.
* @author Marcello Stanisci * @author Marcello Stanisci
*/ */
#include "platform.h" #include "platform.h"
#include <jansson.h> #include <jansson.h>
#include "exchange_api_handle.h" #include "exchange_api_handle.h"
@ -129,10 +127,9 @@ serialize_keys_cleanup (void *cls,
* Offer serialized keys as trait. * Offer serialized keys as trait.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result. * @param[out] ret result.
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the object to offer. * @param index index number of the object to offer.
*
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.
*/ */
static int static int
@ -253,6 +250,7 @@ TALER_TESTING_cmd_serialize_keys (const char *label)
struct SerializeKeysState *sks; struct SerializeKeysState *sks;
sks = GNUNET_new (struct SerializeKeysState); sks = GNUNET_new (struct SerializeKeysState);
{
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.cls = sks, .cls = sks,
.label = label, .label = label,
@ -263,6 +261,7 @@ TALER_TESTING_cmd_serialize_keys (const char *label)
return cmd; return cmd;
} }
}
/** /**
@ -284,7 +283,7 @@ TALER_TESTING_cmd_connect_with_state (const char *label,
cwss = GNUNET_new (struct ConnectWithStateState); cwss = GNUNET_new (struct ConnectWithStateState);
cwss->state_reference = state_reference; cwss->state_reference = state_reference;
cwss->consumed = GNUNET_NO; cwss->consumed = GNUNET_NO;
{
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.cls = cwss, .cls = cwss,
.label = label, .label = label,
@ -294,3 +293,4 @@ TALER_TESTING_cmd_connect_with_state (const char *label,
return cmd; return cmd;
} }
}

View File

@ -46,10 +46,9 @@ struct SleepState
* some CMDs iterates through the list of all the commands. * some CMDs iterates through the list of all the commands.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result. * @param[out] ret result.
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the trait to return. * @param index index number of the trait to return.
*
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.
*/ */
static int static int
@ -58,6 +57,10 @@ sleep_traits (void *cls,
const char *trait, const char *trait,
unsigned int index) unsigned int index)
{ {
(void) cls;
(void) ret;
(void) trait;
(void) index;
return GNUNET_NO; return GNUNET_NO;
} }
@ -93,6 +96,7 @@ sleep_cleanup (void *cls,
{ {
struct SleepState *ss = cls; struct SleepState *ss = cls;
(void) cmd;
GNUNET_free (ss); GNUNET_free (ss);
} }
@ -127,102 +131,4 @@ TALER_TESTING_cmd_sleep (const char *label,
} }
/**
* Cleanup the state from a "wait service" CMD.
*
* @param cls closure.
* @param cmd the command which is being cleaned up.
*/
static void
wait_service_cleanup (void *cls,
const struct TALER_TESTING_Command *cmd)
{
/* nothing to clean. */
return;
}
/**
* 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 ret[out] result.
* @param trait name of the trait.
* @param index index number of the trait to return.
*
* @return #GNUNET_OK on success.
*/
static int
wait_service_traits (void *cls,
const void **ret,
const char *trait,
unsigned int index)
{
return GNUNET_NO;
}
/**
* Run a "wait service" CMD.
*
* @param cls closure.
* @param cmd the command being run.
* @param is the interpreter state.
*/
static void
wait_service_run (void *cls,
const struct TALER_TESTING_Command *cmd,
struct TALER_TESTING_Interpreter *is)
{
unsigned int iter = 0;
const char *url = cmd->cls;
char *wget_cmd;
GNUNET_asprintf (&wget_cmd,
"wget -q -t 1 -T 1 %s -o /dev/null -O /dev/null",
url);
do
{
fprintf (stderr, ".");
if (10 == iter++)
{
TALER_LOG_ERROR ("Could not reach the proxied service\n");
TALER_TESTING_interpreter_fail (is);
GNUNET_free (wget_cmd);
return;
}
}
while (0 != system (wget_cmd));
GNUNET_free (wget_cmd);
TALER_TESTING_interpreter_next (is);
}
/**
* This CMD simply tries to connect via HTTP to the
* service addressed by @a url. It attemps 10 times
* before giving up and make the test fail.
*
* @param label label for the command.
* @param url complete URL to connect to.
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_wait_service (const char *label,
const char *url)
{
struct TALER_TESTING_Command cmd = {
.label = label,
.run = wait_service_run,
.cleanup = wait_service_cleanup,
.traits = wait_service_traits,
.cls = (void *) url
};
return cmd;
}
/* end of testing_api_cmd_sleep.c */ /* end of testing_api_cmd_sleep.c */

View File

@ -369,10 +369,9 @@ track_transaction_cleanup (void *cls,
* Offer internal data from a "track transaction" CMD. * Offer internal data from a "track transaction" CMD.
* *
* @param cls closure. * @param cls closure.
* @param ret[out] result (could be anything). * @param[out] ret result (could be anything).
* @param trait name of the trait. * @param trait name of the trait.
* @param index index number of the object to offer. * @param index index number of the object to offer.
*
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.
*/ */
static int static int
@ -405,7 +404,6 @@ track_transaction_traits (void *cls,
* @param bank_transfer_reference reference to a command that * @param bank_transfer_reference reference to a command that
* can offer a WTID so as to check that against what WTID * can offer a WTID so as to check that against what WTID
* the tracked operation has. Set as NULL if not needed. * the tracked operation has. Set as NULL if not needed.
*
* @return the command. * @return the command.
*/ */
struct TALER_TESTING_Command struct TALER_TESTING_Command
@ -733,7 +731,6 @@ track_transfer_run (void *cls,
* @param index index number of the WTID to track, in case there * @param index index number of the WTID to track, in case there
* are multiple on offer. * are multiple on offer.
* @param expected_response_code expected HTTP response code. * @param expected_response_code expected HTTP response code.
*
* @return the command. * @return the command.
*/ */
struct TALER_TESTING_Command struct TALER_TESTING_Command
@ -774,7 +771,6 @@ TALER_TESTING_cmd_track_transfer_empty (const char *label,
* @param expected_amount how much money we expect being moved * @param expected_amount how much money we expect being moved
* with this wire-transfer. * with this wire-transfer.
* @param expected_wire_fee expected wire fee. * @param expected_wire_fee expected wire fee.
*
* @return the command * @return the command
*/ */
struct TALER_TESTING_Command struct TALER_TESTING_Command

View File

@ -0,0 +1,134 @@
/*
This file is part of TALER
(C) 2018 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 the Free Software Foundation; either version 3, or
(at your option) any later version.
TALER is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public
License along with TALER; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>
*/
/**
* @file lib/testing_api_cmd_wait.c
* @brief command(s) to wait on some process
* @author Christian Grothoff
*/
#include "platform.h"
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "exchange_api_handle.h"
#include "taler_testing_lib.h"
/**
* Cleanup the state from a "wait service" CMD.
*
* @param cls closure.
* @param cmd the command which is being cleaned up.
*/
static void
wait_service_cleanup (void *cls,
const struct TALER_TESTING_Command *cmd)
{
(void) cls;
(void) cmd;
/* nothing to clean. */
return;
}
/**
* 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
wait_service_traits (void *cls,
const void **ret,
const char *trait,
unsigned int index)
{
(void) cls;
(void) ret;
(void) trait;
(void) index;
return GNUNET_NO;
}
/**
* Run a "wait service" CMD.
*
* @param cls closure.
* @param cmd the command being run.
* @param is the interpreter state.
*/
static void
wait_service_run (void *cls,
const struct TALER_TESTING_Command *cmd,
struct TALER_TESTING_Interpreter *is)
{
unsigned int iter = 0;
const char *url = cmd->cls;
char *wget_cmd;
GNUNET_asprintf (&wget_cmd,
"wget -q -t 1 -T 1 %s -o /dev/null -O /dev/null",
url);
do
{
fprintf (stderr, ".");
if (10 == iter++)
{
TALER_LOG_ERROR ("Could not reach the proxied service\n");
TALER_TESTING_interpreter_fail (is);
GNUNET_free (wget_cmd);
return;
}
}
while (0 != system (wget_cmd));
GNUNET_free (wget_cmd);
TALER_TESTING_interpreter_next (is);
}
/**
* This CMD simply tries to connect via HTTP to the
* service addressed by @a url. It attemps 10 times
* before giving up and make the test fail.
*
* @param label label for the command.
* @param url complete URL to connect to.
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_wait_service (const char *label,
const char *url)
{
struct TALER_TESTING_Command cmd = {
.label = label,
.run = wait_service_run,
.cleanup = wait_service_cleanup,
.traits = wait_service_traits,
.cls = (void *) url
};
return cmd;
}
/* end of testing_api_cmd_sleep.c */

View File

@ -347,7 +347,7 @@ withdraw_cleanup (void *cls,
* commands. * commands.
* *
* @param cls closure * @param cls closure
* @param ret[out] result (could be anything) * @param[out] ret result (could be anything)
* @param trait name of the trait * @param trait name of the trait
* @param index index number of the object to offer. * @param index index number of the object to offer.
* *

View File

@ -219,7 +219,7 @@ TALER_TESTING_run_bank (const char *config_filename,
* and reset database. * and reset database.
* *
* @param config_filename configuration file name. * @param config_filename configuration file name.
* @param bc[out] set to the bank's configuration data * @param[out] bc set to the bank's configuration data
* @return the base url, or NULL upon errors. Must be freed * @return the base url, or NULL upon errors. Must be freed
* by the caller. * by the caller.
*/ */
@ -385,7 +385,7 @@ TALER_TESTING_prepare_bank (const char *config_filename,
* *
* @param config_filename configuration file to use * @param config_filename configuration file to use
* @param config_section which account to use (must match x-taler-bank) * @param config_section which account to use (must match x-taler-bank)
* @param bc[out] set to the bank's configuration data * @param[out] bc set to the bank's configuration data
* @return #GNUNET_OK on success * @return #GNUNET_OK on success
*/ */
int int