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_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 \

View File

@ -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,
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;
}
}

View File

@ -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,
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;
{
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,
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;
{
struct TALER_TESTING_Command cmd = {
.cls = es,
.label = label,
.run = &exchanges_run,
.cleanup = &exchanges_cleanup,
.traits = &exchanges_traits
};
return cmd;
}
}

View File

@ -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;
{
struct TALER_TESTING_Command cmd = {
.cls = ks,
.label = label,
.run = &auditor_run,
.cleanup = &auditor_cleanup,
.traits = &auditor_traits
};
return cmd;
}
}

View File

@ -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;
{
struct TALER_TESTING_Command cmd = {
.cls = ks,
.label = label.
.run = &auditor_dbinit_run,
.cleanup = &auditor_dbinit_cleanup,
.traits = &auditor_dbinit_traits
};
return cmd;
}
}

View File

@ -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;
{
struct TALER_TESTING_Command cmd = {
.cls = ks,
.label = label,
.run = &wire_auditor_run,
.cleanup = &wire_auditor_cleanup,
.traits = &wire_auditor_traits
};
return cmd;
}
}

View File

@ -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,10 +488,10 @@ make_command (const char *label,
* @return the command.
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_admin_add_incoming
(const char *label,
TALER_TESTING_cmd_admin_add_incoming (const char *label,
const char *amount,
const struct TALER_BANK_AuthenticationData *auth,
const struct
TALER_BANK_AuthenticationData *auth,
const char *payto_debit_account)
{
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.
*
* @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.

View File

@ -190,8 +190,7 @@ check_bank_transfer_run (void *cls,
* @param cmd the command which is being cleaned up.
*/
static void
check_bank_transfer_cleanup
(void *cls,
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,8 +245,7 @@ check_bank_transfer_traits (void *cls,
* @return the command
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_check_bank_transfer
(const char *label,
TALER_TESTING_cmd_check_bank_transfer (const char *label,
const char *exchange_base_url,
const char *amount,
const char *debit_payto,

View File

@ -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.
*

View File

@ -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.
*

View File

@ -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,8 +340,7 @@ transfer_traits (void *cls,
* @return the command.
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_transfer
(const char *label,
TALER_TESTING_cmd_transfer (const char *label,
const char *amount,
const struct TALER_BANK_AuthenticationData *auth,
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.
*
* @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,7 +168,7 @@ 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,
@ -178,6 +178,7 @@ TALER_TESTING_cmd_batch (const char *label,
};
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;

View File

@ -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.
*

View File

@ -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,7 +150,7 @@ 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,
@ -161,6 +160,7 @@ TALER_TESTING_cmd_exec_aggregator (const char *label,
};
return cmd;
}
}

View File

@ -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.

View File

@ -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,7 +189,7 @@ 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,
@ -199,6 +199,7 @@ TALER_TESTING_cmd_exec_keyup_with_now
};
return cmd;
}
}
@ -218,7 +219,7 @@ 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,
@ -228,6 +229,7 @@ TALER_TESTING_cmd_exec_keyup (const char *label,
};
return cmd;
}
}

View File

@ -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,7 +151,7 @@ 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,
@ -162,6 +161,7 @@ TALER_TESTING_cmd_exec_wirewatch (const char *label,
};
return cmd;
}
}

View File

@ -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;
{
struct TALER_TESTING_Command cmd = {
.cls = ids,
.label = label,
.run = &insert_deposit_run,
.cleanup = &insert_deposit_cleanup,
.traits = &insert_deposit_traits
};
return cmd;
}
}

View File

@ -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

View File

@ -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,8 +1322,7 @@ refresh_reveal_traits (void *cls,
* @return the command.
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_refresh_reveal
(const char *label,
TALER_TESTING_cmd_refresh_reveal (const char *label,
const char *melt_reference,
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
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_refresh_link
(const char *label,
TALER_TESTING_cmd_refresh_link (const char *label,
const char *reveal_reference,
unsigned int expected_response_code)
{
@ -1384,7 +1382,7 @@ TALER_TESTING_cmd_refresh_link
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,
@ -1393,6 +1391,7 @@ TALER_TESTING_cmd_refresh_link
};
return cmd;
}
}

View File

@ -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,6 +250,7 @@ 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,
@ -262,6 +260,7 @@ TALER_TESTING_cmd_serialize_keys (const char *label)
};
return cmd;
}
}
@ -284,7 +283,7 @@ 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,
@ -293,4 +292,5 @@ TALER_TESTING_cmd_connect_with_state (const char *label,
};
return cmd;
}
}

View File

@ -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 */

View File

@ -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

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.
*
* @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.
*

View File

@ -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