diff options
Diffstat (limited to 'src/lib')
27 files changed, 375 insertions, 328 deletions
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index a3b680032..9a12d25bc 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -95,6 +95,7 @@ libtalertesting_la_SOURCES = \ testing_api_cmd_sleep.c \ testing_api_cmd_status.c \ testing_api_cmd_track.c \ + testing_api_cmd_wait.c \ testing_api_cmd_wire.c \ testing_api_cmd_withdraw.c \ testing_api_cmd_insert_deposit.c \ diff --git a/src/lib/testing_api_cmd_auditor_deposit_confirmation.c b/src/lib/testing_api_cmd_auditor_deposit_confirmation.c index 8e7ccd198..df80fef73 100644 --- a/src/lib/testing_api_cmd_auditor_deposit_confirmation.c +++ b/src/lib/testing_api_cmd_auditor_deposit_confirmation.c @@ -16,13 +16,11 @@ License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ - /** * @file lib/testing_api_cmd_auditor_deposit_confirmation.c * @brief command for testing /deposit_confirmation. * @author Christian Grothoff */ - #include "platform.h" #include "taler_json_lib.h" #include <gnunet/gnunet_curl_lib.h> @@ -359,7 +357,7 @@ deposit_confirmation_cleanup (void *cls, * Offer internal data to other commands. * * @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 index index number of the traits to be returned. * @@ -393,15 +391,13 @@ deposit_confirmation_traits (void *cls, * @return the command. */ struct TALER_TESTING_Command -TALER_TESTING_cmd_deposit_confirmation - (const char *label, - struct TALER_AUDITOR_Handle *auditor, - const char *deposit_reference, - unsigned int coin_index, - const char *amount_without_fee, - unsigned int expected_response_code) +TALER_TESTING_cmd_deposit_confirmation (const char *label, + struct TALER_AUDITOR_Handle *auditor, + const char *deposit_reference, + unsigned int coin_index, + const char *amount_without_fee, + unsigned int expected_response_code) { - struct TALER_TESTING_Command cmd = {0}; /* need explicit zeroing..*/ struct DepositConfirmationState *dcs; dcs = GNUNET_new (struct DepositConfirmationState); @@ -411,13 +407,17 @@ TALER_TESTING_cmd_deposit_confirmation dcs->amount_without_fee = amount_without_fee; dcs->expected_response_code = expected_response_code; - cmd.cls = dcs; - cmd.label = label; - cmd.run = &deposit_confirmation_run; - cmd.cleanup = &deposit_confirmation_cleanup; - cmd.traits = &deposit_confirmation_traits; + { + struct TALER_TESTING_Command cmd = { + .cls = dcs, + .label = label, + .run = &deposit_confirmation_run, + .cleanup = &deposit_confirmation_cleanup, + .traits = &deposit_confirmation_traits + }; - return cmd; + return cmd; + } } diff --git a/src/lib/testing_api_cmd_auditor_exchanges.c b/src/lib/testing_api_cmd_auditor_exchanges.c index e8dbc2b5e..3b2187a3d 100644 --- a/src/lib/testing_api_cmd_auditor_exchanges.c +++ b/src/lib/testing_api_cmd_auditor_exchanges.c @@ -253,10 +253,9 @@ exchanges_cleanup (void *cls, * Offer internal data to other commands. * * @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 index index number of the traits to be returned. - * * @return #GNUNET_OK on success */ static int @@ -280,25 +279,27 @@ exchanges_traits (void *cls, * @return the command. */ struct TALER_TESTING_Command -TALER_TESTING_cmd_exchanges - (const char *label, - struct TALER_AUDITOR_Handle *auditor, - unsigned int expected_response_code) +TALER_TESTING_cmd_exchanges (const char *label, + struct TALER_AUDITOR_Handle *auditor, + unsigned int expected_response_code) { - struct TALER_TESTING_Command cmd = {0}; /* need explicit zeroing..*/ struct ExchangesState *es; es = GNUNET_new (struct ExchangesState); es->auditor = auditor; es->expected_response_code = expected_response_code; - cmd.cls = es; - cmd.label = label; - cmd.run = &exchanges_run; - cmd.cleanup = &exchanges_cleanup; - cmd.traits = &exchanges_traits; - - return cmd; + { + struct TALER_TESTING_Command cmd = { + .cls = es, + .label = label, + .run = &exchanges_run, + .cleanup = &exchanges_cleanup, + .traits = &exchanges_traits + }; + + return cmd; + } } @@ -314,25 +315,26 @@ TALER_TESTING_cmd_exchanges * @return the command. */ struct TALER_TESTING_Command -TALER_TESTING_cmd_exchanges_with_url - (const char *label, - unsigned int expected_response_code, - const char *exchange_url) +TALER_TESTING_cmd_exchanges_with_url (const char *label, + unsigned int expected_response_code, + const char *exchange_url) { - struct TALER_TESTING_Command cmd = {0}; /* need explicit zeroing..*/ struct ExchangesState *es; es = GNUNET_new (struct ExchangesState); es->expected_response_code = expected_response_code; es->exchange_url = exchange_url; - - cmd.cls = es; - cmd.label = label; - cmd.run = &exchanges_run; - cmd.cleanup = &exchanges_cleanup; - cmd.traits = &exchanges_traits; - - return cmd; + { + struct TALER_TESTING_Command cmd = { + .cls = es, + .label = label, + .run = &exchanges_run, + .cleanup = &exchanges_cleanup, + .traits = &exchanges_traits + }; + + return cmd; + } } diff --git a/src/lib/testing_api_cmd_auditor_exec_auditor.c b/src/lib/testing_api_cmd_auditor_exec_auditor.c index 762611383..f56038e78 100644 --- a/src/lib/testing_api_cmd_auditor_exec_auditor.c +++ b/src/lib/testing_api_cmd_auditor_exec_auditor.c @@ -16,7 +16,6 @@ License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ - /** * @file lib/testing_api_cmd_auditor_exec_auditor.c * @brief run the taler-auditor command @@ -111,7 +110,7 @@ auditor_cleanup (void *cls, * Offer "auditor" CMD internal data to other commands. * * @param cls closure. - * @param ret[out] result + * @param[out] ret result * @param trait name of the trait. * @param index index number of the object to offer. * @return #GNUNET_OK on success. @@ -146,17 +145,21 @@ struct TALER_TESTING_Command TALER_TESTING_cmd_exec_auditor (const char *label, const char *config_filename) { - struct TALER_TESTING_Command cmd; struct AuditorState *ks; ks = GNUNET_new (struct AuditorState); ks->config_filename = config_filename; - cmd.cls = ks; - cmd.label = label; - cmd.run = &auditor_run; - cmd.cleanup = &auditor_cleanup; - cmd.traits = &auditor_traits; - return cmd; + { + struct TALER_TESTING_Command cmd = { + .cls = ks, + .label = label, + .run = &auditor_run, + .cleanup = &auditor_cleanup, + .traits = &auditor_traits + }; + + return cmd; + } } diff --git a/src/lib/testing_api_cmd_auditor_exec_auditor_dbinit.c b/src/lib/testing_api_cmd_auditor_exec_auditor_dbinit.c index 7044cb39f..828622e23 100644 --- a/src/lib/testing_api_cmd_auditor_exec_auditor_dbinit.c +++ b/src/lib/testing_api_cmd_auditor_exec_auditor_dbinit.c @@ -16,7 +16,6 @@ License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ - /** * @file lib/testing_api_cmd_auditor_exec_auditor_dbinit.c * @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. * * @param cls closure. - * @param ret[out] result + * @param[out] ret result * @param trait name of the trait. * @param index index number of the object to offer. * @return #GNUNET_OK on success. @@ -147,17 +146,21 @@ struct TALER_TESTING_Command TALER_TESTING_cmd_exec_auditor_dbinit (const char *label, const char *config_filename) { - struct TALER_TESTING_Command cmd; struct AuditorDbinitState *ks; ks = GNUNET_new (struct AuditorDbinitState); ks->config_filename = config_filename; - cmd.cls = ks; - cmd.label = label; - cmd.run = &auditor_dbinit_run; - cmd.cleanup = &auditor_dbinit_cleanup; - cmd.traits = &auditor_dbinit_traits; - return cmd; + { + struct TALER_TESTING_Command cmd = { + .cls = ks, + .label = label. + .run = &auditor_dbinit_run, + .cleanup = &auditor_dbinit_cleanup, + .traits = &auditor_dbinit_traits + }; + + return cmd; + } } diff --git a/src/lib/testing_api_cmd_auditor_exec_wire_auditor.c b/src/lib/testing_api_cmd_auditor_exec_wire_auditor.c index 12b2344db..458a0b349 100644 --- a/src/lib/testing_api_cmd_auditor_exec_wire_auditor.c +++ b/src/lib/testing_api_cmd_auditor_exec_wire_auditor.c @@ -16,7 +16,6 @@ License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ - /** * @file lib/testing_api_cmd_auditor_exec_wire_auditor.c * @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. * * @param cls closure. - * @param ret[out] result + * @param[out] ret result * @param trait name of the trait. * @param index index number of the object to offer. * @return #GNUNET_OK on success. @@ -146,17 +145,21 @@ struct TALER_TESTING_Command TALER_TESTING_cmd_exec_wire_auditor (const char *label, const char *config_filename) { - struct TALER_TESTING_Command cmd; struct WireAuditorState *ks; ks = GNUNET_new (struct WireAuditorState); ks->config_filename = config_filename; - cmd.cls = ks; - cmd.label = label; - cmd.run = &wire_auditor_run; - cmd.cleanup = &wire_auditor_cleanup; - cmd.traits = &wire_auditor_traits; - return cmd; + { + struct TALER_TESTING_Command cmd = { + .cls = ks, + .label = label, + .run = &wire_auditor_run, + .cleanup = &wire_auditor_cleanup, + .traits = &wire_auditor_traits + }; + + return cmd; + } } diff --git a/src/lib/testing_api_cmd_bank_admin_add_incoming.c b/src/lib/testing_api_cmd_bank_admin_add_incoming.c index e9f15f634..294c933e1 100644 --- a/src/lib/testing_api_cmd_bank_admin_add_incoming.c +++ b/src/lib/testing_api_cmd_bank_admin_add_incoming.c @@ -384,7 +384,7 @@ admin_add_incoming_cleanup (void *cls, * commands. * * @param cls closure. - * @param ret[out] result + * @param[out] ret result * @param trait name of the trait. * @param index index number of the object to offer. * @return #GNUNET_OK on success. @@ -488,11 +488,11 @@ make_command (const char *label, * @return the command. */ 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/lib/testing_api_cmd_bank_admin_check.c b/src/lib/testing_api_cmd_bank_admin_check.c index c63a1b4aa..97e2eade2 100644 --- a/src/lib/testing_api_cmd_bank_admin_check.c +++ b/src/lib/testing_api_cmd_bank_admin_check.c @@ -162,7 +162,7 @@ check_bank_admin_transfer_cleanup (void *cls, * Offer internal data from a "bank admin check" CMD state. * * @param cls closure. - * @param ret[out] result. + * @param[out] ret result. * @param trait name of the trait. * @param index index number of the object to offer. * @return #GNUNET_OK on success. diff --git a/src/lib/testing_api_cmd_bank_check.c b/src/lib/testing_api_cmd_bank_check.c index 3ac4b87cd..e8bd415b3 100644 --- a/src/lib/testing_api_cmd_bank_check.c +++ b/src/lib/testing_api_cmd_bank_check.c @@ -190,9 +190,8 @@ check_bank_transfer_run (void *cls, * @param cmd the command which is being cleaned up. */ static void -check_bank_transfer_cleanup - (void *cls, - const struct TALER_TESTING_Command *cmd) +check_bank_transfer_cleanup (void *cls, + const struct TALER_TESTING_Command *cmd) { struct BankCheckState *bcs = cls; @@ -204,7 +203,7 @@ check_bank_transfer_cleanup * Offer internal data from a "bank check" CMD state. * * @param cls closure. - * @param ret[out] result. + * @param[out] ret result. * @param trait name of the trait. * @param index index number of the object to offer. * @return #GNUNET_OK on success. @@ -246,12 +245,11 @@ check_bank_transfer_traits (void *cls, * @return the command */ struct TALER_TESTING_Command -TALER_TESTING_cmd_check_bank_transfer - (const char *label, - const char *exchange_base_url, - const char *amount, - const char *debit_payto, - const char *credit_payto) +TALER_TESTING_cmd_check_bank_transfer (const char *label, + const char *exchange_base_url, + const char *amount, + const char *debit_payto, + const char *credit_payto) { struct BankCheckState *bcs; diff --git a/src/lib/testing_api_cmd_bank_history_credit.c b/src/lib/testing_api_cmd_bank_history_credit.c index 41a1f0b80..96da33a19 100644 --- a/src/lib/testing_api_cmd_bank_history_credit.c +++ b/src/lib/testing_api_cmd_bank_history_credit.c @@ -115,7 +115,7 @@ struct HistoryState * Offer internal data to other commands. * * @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 index index number of the traits to be returned. * diff --git a/src/lib/testing_api_cmd_bank_history_debit.c b/src/lib/testing_api_cmd_bank_history_debit.c index d6cbbab21..ecd0bb4f7 100644 --- a/src/lib/testing_api_cmd_bank_history_debit.c +++ b/src/lib/testing_api_cmd_bank_history_debit.c @@ -119,7 +119,7 @@ struct HistoryState * Offer internal data to other commands. * * @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 index index number of the traits to be returned. * diff --git a/src/lib/testing_api_cmd_bank_transfer.c b/src/lib/testing_api_cmd_bank_transfer.c index 5290ba684..8bf4187c9 100644 --- a/src/lib/testing_api_cmd_bank_transfer.c +++ b/src/lib/testing_api_cmd_bank_transfer.c @@ -294,7 +294,7 @@ transfer_cleanup (void *cls, * commands. * * @param cls closure. - * @param ret[out] result + * @param[out] ret result * @param trait name of the trait. * @param index index number of the object to offer. * @return #GNUNET_OK on success. @@ -340,14 +340,13 @@ transfer_traits (void *cls, * @return the command. */ struct TALER_TESTING_Command -TALER_TESTING_cmd_transfer - (const char *label, - const char *amount, - const struct TALER_BANK_AuthenticationData *auth, - const char *payto_debit_account, - const char *payto_credit_account, - const struct TALER_WireTransferIdentifierRawP *wtid, - const char *exchange_base_url) +TALER_TESTING_cmd_transfer (const char *label, + const char *amount, + const struct TALER_BANK_AuthenticationData *auth, + const char *payto_debit_account, + const char *payto_credit_account, + const struct TALER_WireTransferIdentifierRawP *wtid, + const char *exchange_base_url) { struct TransferState *fts; diff --git a/src/lib/testing_api_cmd_batch.c b/src/lib/testing_api_cmd_batch.c index c0e5b3af9..6d3c86ec0 100644 --- a/src/lib/testing_api_cmd_batch.c +++ b/src/lib/testing_api_cmd_batch.c @@ -105,7 +105,7 @@ batch_cleanup (void *cls, * Offer internal data from a "batch" CMD, to other commands. * * @param cls closure. - * @param ret[out] result. + * @param[out] ret result. * @param trait name of the trait. * @param index index number of the object to offer. * @return #GNUNET_OK on success. @@ -168,16 +168,17 @@ TALER_TESTING_cmd_batch (const char *label, memcpy (bs->batch, batch, sizeof (struct TALER_TESTING_Command) * i); - - struct TALER_TESTING_Command cmd = { - .cls = bs, - .label = label, - .run = &batch_run, - .cleanup = &batch_cleanup, - .traits = &batch_traits - }; - - return cmd; + { + struct TALER_TESTING_Command cmd = { + .cls = bs, + .label = label, + .run = &batch_run, + .cleanup = &batch_cleanup, + .traits = &batch_traits + }; + + return cmd; + } } @@ -187,8 +188,7 @@ TALER_TESTING_cmd_batch (const char *label, * @param is interpreter state. */ void -TALER_TESTING_cmd_batch_next - (struct TALER_TESTING_Interpreter *is) +TALER_TESTING_cmd_batch_next (struct TALER_TESTING_Interpreter *is) { 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 */ int -TALER_TESTING_cmd_is_batch - (const struct TALER_TESTING_Command *cmd) +TALER_TESTING_cmd_is_batch (const struct TALER_TESTING_Command *cmd) { return cmd->run == &batch_run; } @@ -221,8 +220,7 @@ TALER_TESTING_cmd_is_batch * @return cmd current batch command */ struct TALER_TESTING_Command * -TALER_TESTING_cmd_batch_get_current - (const struct TALER_TESTING_Command *cmd) +TALER_TESTING_cmd_batch_get_current (const struct TALER_TESTING_Command *cmd) { struct BatchState *bs = cmd->cls; diff --git a/src/lib/testing_api_cmd_deposit.c b/src/lib/testing_api_cmd_deposit.c index eb3d256d1..94636b7cf 100644 --- a/src/lib/testing_api_cmd_deposit.c +++ b/src/lib/testing_api_cmd_deposit.c @@ -396,7 +396,7 @@ deposit_cleanup (void *cls, * Offer internal data from a "deposit" CMD, to other commands. * * @param cls closure. - * @param ret[out] result. + * @param[out] ret result. * @param trait name of the trait. * @param index index number of the object to offer. * diff --git a/src/lib/testing_api_cmd_exec_aggregator.c b/src/lib/testing_api_cmd_exec_aggregator.c index 7633d6f47..425b3f23a 100644 --- a/src/lib/testing_api_cmd_exec_aggregator.c +++ b/src/lib/testing_api_cmd_exec_aggregator.c @@ -16,7 +16,6 @@ License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ - /** * @file lib/testing_api_cmd_exec_aggregator.c * @brief run the taler-exchange-aggregator command @@ -111,7 +110,7 @@ aggregator_cleanup (void *cls, * Offer "aggregator" CMD internal data to other commands. * * @param cls closure. - * @param ret[out] result. + * @param[out] ret result. * @param trait name of the trait. * @param index index number of the object to offer. * @return #GNUNET_OK on success @@ -151,16 +150,17 @@ TALER_TESTING_cmd_exec_aggregator (const char *label, as = GNUNET_new (struct AggregatorState); as->config_filename = config_filename; - - struct TALER_TESTING_Command cmd = { - .cls = as, - .label = label, - .run = &aggregator_run, - .cleanup = &aggregator_cleanup, - .traits = &aggregator_traits - }; - - return cmd; + { + struct TALER_TESTING_Command cmd = { + .cls = as, + .label = label, + .run = &aggregator_run, + .cleanup = &aggregator_cleanup, + .traits = &aggregator_traits + }; + + return cmd; + } } diff --git a/src/lib/testing_api_cmd_exec_auditor-sign.c b/src/lib/testing_api_cmd_exec_auditor-sign.c index 49a494a67..deda26686 100644 --- a/src/lib/testing_api_cmd_exec_auditor-sign.c +++ b/src/lib/testing_api_cmd_exec_auditor-sign.c @@ -175,7 +175,7 @@ auditor_sign_cleanup (void *cls, * Offer "auditor sign" CMD internal data to other commands. * * @param cls closure. - * @param ret[out] result. + * @param[out] ret result. * @param trait name of the trait. * @param index index number of the object to offer. * @return #GNUNET_OK on success. diff --git a/src/lib/testing_api_cmd_exec_keyup.c b/src/lib/testing_api_cmd_exec_keyup.c index 3ce746527..3947ad26e 100644 --- a/src/lib/testing_api_cmd_exec_keyup.c +++ b/src/lib/testing_api_cmd_exec_keyup.c @@ -143,7 +143,7 @@ keyup_cleanup (void *cls, * Offer "keyup" CMD internal data to other commands. * * @param cls closure. - * @param ret[out] result + * @param[out] ret result * @param trait name of the trait. * @param index index number of the object to offer. * @@ -189,16 +189,17 @@ TALER_TESTING_cmd_exec_keyup_with_now ks->config_filename = config_filename; ks->now = now; ks->with_now = GNUNET_YES; - - struct TALER_TESTING_Command cmd = { - .cls = ks, - .label = label, - .run = &keyup_run, - .cleanup = &keyup_cleanup, - .traits = &keyup_traits - }; - - return cmd; + { + struct TALER_TESTING_Command cmd = { + .cls = ks, + .label = label, + .run = &keyup_run, + .cleanup = &keyup_cleanup, + .traits = &keyup_traits + }; + + return cmd; + } } @@ -218,16 +219,17 @@ TALER_TESTING_cmd_exec_keyup (const char *label, ks = GNUNET_new (struct KeyupState); ks->config_filename = config_filename; - - struct TALER_TESTING_Command cmd = { - .cls = ks, - .label = label, - .run = &keyup_run, - .cleanup = &keyup_cleanup, - .traits = &keyup_traits - }; - - return cmd; + { + struct TALER_TESTING_Command cmd = { + .cls = ks, + .label = label, + .run = &keyup_run, + .cleanup = &keyup_cleanup, + .traits = &keyup_traits + }; + + return cmd; + } } diff --git a/src/lib/testing_api_cmd_exec_wirewatch.c b/src/lib/testing_api_cmd_exec_wirewatch.c index 91366316d..75f8f46e4 100644 --- a/src/lib/testing_api_cmd_exec_wirewatch.c +++ b/src/lib/testing_api_cmd_exec_wirewatch.c @@ -16,7 +16,6 @@ License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ - /** * @file lib/testing_api_cmd_exec_wirewatch.c * @brief run the taler-exchange-wirewatch command @@ -111,7 +110,7 @@ wirewatch_cleanup (void *cls, * Offer "wirewatch" CMD internal data to other commands. * * @param cls closure. - * @param ret[out] result. + * @param[out] ret result. * @param trait name of the trait. * @param index index number of the object to offer. * @return #GNUNET_OK on success. @@ -152,16 +151,17 @@ TALER_TESTING_cmd_exec_wirewatch (const char *label, ws = GNUNET_new (struct WirewatchState); ws->config_filename = config_filename; - - struct TALER_TESTING_Command cmd = { - .cls = ws, - .label = label, - .run = &wirewatch_run, - .cleanup = &wirewatch_cleanup, - .traits = &wirewatch_traits - }; - - return cmd; + { + struct TALER_TESTING_Command cmd = { + .cls = ws, + .label = label, + .run = &wirewatch_run, + .cleanup = &wirewatch_cleanup, + .traits = &wirewatch_traits + }; + + return cmd; + } } diff --git a/src/lib/testing_api_cmd_insert_deposit.c b/src/lib/testing_api_cmd_insert_deposit.c index 931ceb162..1f257574f 100644 --- a/src/lib/testing_api_cmd_insert_deposit.c +++ b/src/lib/testing_api_cmd_insert_deposit.c @@ -141,7 +141,7 @@ insert_deposit_run (void *cls, return; } - // prepare and store deposit now. + /* prepare and store deposit now. */ memset (&deposit, 0, sizeof (deposit)); @@ -250,7 +250,7 @@ insert_deposit_cleanup (void *cls, * Offer "insert-deposit" CMD internal data to other commands. * * @param cls closure. - * @param ret[out] result + * @param[out] ret result * @param trait name of the trait. * @param index index number of the object to offer. * @return #GNUNET_OK on success. @@ -261,6 +261,10 @@ insert_deposit_traits (void *cls, const char *trait, unsigned int index) { + (void) cls; + (void) ret; + (void) trait; + (void) index; return GNUNET_NO; } @@ -288,7 +292,6 @@ TALER_TESTING_cmd_insert_deposit (const char *label, const char *amount_with_fee, const char *deposit_fee) { - struct TALER_TESTING_Command cmd; struct InsertDepositState *ids; ids = GNUNET_new (struct InsertDepositState); @@ -299,13 +302,17 @@ TALER_TESTING_cmd_insert_deposit (const char *label, ids->amount_with_fee = amount_with_fee; ids->deposit_fee = deposit_fee; - cmd.cls = ids; - cmd.label = label; - cmd.run = &insert_deposit_run; - cmd.cleanup = &insert_deposit_cleanup; - cmd.traits = &insert_deposit_traits; - - return cmd; + { + struct TALER_TESTING_Command cmd = { + .cls = ids, + .label = label, + .run = &insert_deposit_run, + .cleanup = &insert_deposit_cleanup, + .traits = &insert_deposit_traits + }; + + return cmd; + } } diff --git a/src/lib/testing_api_cmd_payback.c b/src/lib/testing_api_cmd_payback.c index 29b407dd4..1fdd2bfea 100644 --- a/src/lib/testing_api_cmd_payback.c +++ b/src/lib/testing_api_cmd_payback.c @@ -16,13 +16,11 @@ License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ - /** * @file lib/testing_api_cmd_payback.c * @brief Implement the /revoke and /payback test commands. * @author Marcello Stanisci */ - #include "platform.h" #include "taler_json_lib.h" #include <gnunet/gnunet_curl_lib.h> @@ -112,8 +110,8 @@ struct PaybackState * Parser reference to a coin. * * @param coin_reference of format $LABEL['#' $INDEX]? - * @param cref[out] where we return a copy of $LABEL - * @param idx[out] where we set $INDEX + * @param[out] cref where we return a copy of $LABEL + * @param[out] idx where we set $INDEX * @return #GNUNET_SYSERR if $INDEX is present but not numeric */ static int @@ -459,7 +457,7 @@ payback_cleanup (void *cls, * Offer internal data from a "revoke" CMD to other CMDs. * * @param cls closure - * @param ret[out] result (could be anything) + * @param[out] ret result (could be anything) * @param trait name of the trait * @param index index number of the object to offer. * @return #GNUNET_OK on success @@ -470,7 +468,6 @@ revoke_traits (void *cls, const char *trait, unsigned int index) { - struct RevokeState *rs = cls; struct TALER_TESTING_Trait traits[] = { /* 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 * denomination to revoke. * @param config_filename configuration file name. - * * @return the command. */ struct TALER_TESTING_Command diff --git a/src/lib/testing_api_cmd_refresh.c b/src/lib/testing_api_cmd_refresh.c index 64215e581..da9f7c051 100644 --- a/src/lib/testing_api_cmd_refresh.c +++ b/src/lib/testing_api_cmd_refresh.c @@ -1063,7 +1063,7 @@ refresh_melt_cleanup (void *cls, * Offer internal data to the "refresh melt" CMD. * * @param cls closure. - * @param ret[out] result (could be anything). + * @param[out] ret result (could be anything). * @param trait name of the trait. * @param index index number of the object to offer. * @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. * * @param cls closure. - * @param ret[out] result (could be anything). + * @param[out] ret result (could be anything). * @param trait name of the trait. * @param index index number of the object to offer. * @@ -1322,10 +1322,9 @@ refresh_reveal_traits (void *cls, * @return the command. */ struct TALER_TESTING_Command -TALER_TESTING_cmd_refresh_reveal - (const char *label, - const char *melt_reference, - unsigned int expected_response_code) +TALER_TESTING_cmd_refresh_reveal (const char *label, + const char *melt_reference, + unsigned int expected_response_code) { struct RefreshRevealState *rrs; @@ -1374,25 +1373,25 @@ TALER_TESTING_cmd_refresh_reveal_with_retry (struct TALER_TESTING_Command cmd) * @return the "refresh link" command */ struct TALER_TESTING_Command -TALER_TESTING_cmd_refresh_link - (const char *label, - const char *reveal_reference, - unsigned int expected_response_code) +TALER_TESTING_cmd_refresh_link (const char *label, + const char *reveal_reference, + unsigned int expected_response_code) { struct RefreshLinkState *rrs; rrs = GNUNET_new (struct RefreshLinkState); rrs->reveal_reference = reveal_reference; rrs->expected_response_code = expected_response_code; + { + struct TALER_TESTING_Command cmd = { + .cls = rrs, + .label = label, + .run = &refresh_link_run, + .cleanup = &refresh_link_cleanup + }; - struct TALER_TESTING_Command cmd = { - .cls = rrs, - .label = label, - .run = &refresh_link_run, - .cleanup = &refresh_link_cleanup - }; - - return cmd; + return cmd; + } } diff --git a/src/lib/testing_api_cmd_serialize_keys.c b/src/lib/testing_api_cmd_serialize_keys.c index ab527c8d4..e18a25b77 100644 --- a/src/lib/testing_api_cmd_serialize_keys.c +++ b/src/lib/testing_api_cmd_serialize_keys.c @@ -16,13 +16,11 @@ License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ - /** * @file lib/testing_api_cmd_serialize_keys.c * @brief Lets tests use the keys serialization API. * @author Marcello Stanisci */ - #include "platform.h" #include <jansson.h> #include "exchange_api_handle.h" @@ -129,10 +127,9 @@ serialize_keys_cleanup (void *cls, * Offer serialized keys as trait. * * @param cls closure. - * @param ret[out] result. + * @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 @@ -253,15 +250,17 @@ TALER_TESTING_cmd_serialize_keys (const char *label) struct SerializeKeysState *sks; sks = GNUNET_new (struct SerializeKeysState); - struct TALER_TESTING_Command cmd = { - .cls = sks, - .label = label, - .run = serialize_keys_run, - .cleanup = serialize_keys_cleanup, - .traits = serialize_keys_traits - }; - - return cmd; + { + struct TALER_TESTING_Command cmd = { + .cls = sks, + .label = label, + .run = serialize_keys_run, + .cleanup = serialize_keys_cleanup, + .traits = serialize_keys_traits + }; + + return cmd; + } } @@ -284,13 +283,14 @@ TALER_TESTING_cmd_connect_with_state (const char *label, cwss = GNUNET_new (struct ConnectWithStateState); cwss->state_reference = state_reference; cwss->consumed = GNUNET_NO; - - struct TALER_TESTING_Command cmd = { - .cls = cwss, - .label = label, - .run = connect_with_state_run, - .cleanup = connect_with_state_cleanup - }; - - return cmd; + { + struct TALER_TESTING_Command cmd = { + .cls = cwss, + .label = label, + .run = connect_with_state_run, + .cleanup = connect_with_state_cleanup + }; + + return cmd; + } } diff --git a/src/lib/testing_api_cmd_sleep.c b/src/lib/testing_api_cmd_sleep.c index 751b81c64..f7af53e51 100644 --- a/src/lib/testing_api_cmd_sleep.c +++ b/src/lib/testing_api_cmd_sleep.c @@ -46,10 +46,9 @@ struct SleepState * some CMDs iterates through the list of all the commands. * * @param cls closure. - * @param ret[out] result. + * @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 @@ -58,6 +57,10 @@ sleep_traits (void *cls, const char *trait, unsigned int index) { + (void) cls; + (void) ret; + (void) trait; + (void) index; return GNUNET_NO; } @@ -93,6 +96,7 @@ sleep_cleanup (void *cls, { struct SleepState *ss = cls; + (void) cmd; 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 */ diff --git a/src/lib/testing_api_cmd_track.c b/src/lib/testing_api_cmd_track.c index db3f6ef14..6d095bafb 100644 --- a/src/lib/testing_api_cmd_track.c +++ b/src/lib/testing_api_cmd_track.c @@ -369,10 +369,9 @@ track_transaction_cleanup (void *cls, * Offer internal data from a "track transaction" CMD. * * @param cls closure. - * @param ret[out] result (could be anything). + * @param[out] ret result (could be anything). * @param trait name of the trait. * @param index index number of the object to offer. - * * @return #GNUNET_OK on success. */ static int @@ -405,7 +404,6 @@ track_transaction_traits (void *cls, * @param bank_transfer_reference reference to a command that * can offer a WTID so as to check that against what WTID * the tracked operation has. Set as NULL if not needed. - * * @return the 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 * are multiple on offer. * @param expected_response_code expected HTTP response code. - * * @return the 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 * with this wire-transfer. * @param expected_wire_fee expected wire fee. - * * @return the command */ struct TALER_TESTING_Command diff --git a/src/lib/testing_api_cmd_wait.c b/src/lib/testing_api_cmd_wait.c new file mode 100644 index 000000000..d153229ce --- /dev/null +++ b/src/lib/testing_api_cmd_wait.c @@ -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 */ diff --git a/src/lib/testing_api_cmd_withdraw.c b/src/lib/testing_api_cmd_withdraw.c index 4437c9c98..d3779e20e 100644 --- a/src/lib/testing_api_cmd_withdraw.c +++ b/src/lib/testing_api_cmd_withdraw.c @@ -347,7 +347,7 @@ withdraw_cleanup (void *cls, * commands. * * @param cls closure - * @param ret[out] result (could be anything) + * @param[out] ret result (could be anything) * @param trait name of the trait * @param index index number of the object to offer. * diff --git a/src/lib/testing_api_helpers_bank.c b/src/lib/testing_api_helpers_bank.c index cdb690932..7ff8d976e 100644 --- a/src/lib/testing_api_helpers_bank.c +++ b/src/lib/testing_api_helpers_bank.c @@ -219,7 +219,7 @@ TALER_TESTING_run_bank (const char *config_filename, * and reset database. * * @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 * by the caller. */ @@ -385,7 +385,7 @@ TALER_TESTING_prepare_bank (const char *config_filename, * * @param config_filename configuration file to use * @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 */ int |