libtalertesting compiles

This commit is contained in:
Christian Grothoff 2021-10-27 22:28:52 +02:00
parent 382fb837bd
commit 0996b83a65
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
8 changed files with 128 additions and 276 deletions

View File

@ -1555,7 +1555,6 @@ TALER_TESTING_cmd_refresh_link_with_retry (struct TALER_TESTING_Command cmd);
* @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
@ -1576,15 +1575,12 @@ TALER_TESTING_cmd_track_transaction (const char *label,
* a wtid. If NULL is given, then a all zeroed WTID is * a wtid. If NULL is given, then a all zeroed WTID is
* used that will at 99.9999% probability NOT match any * used that will at 99.9999% probability NOT match any
* existing WTID known to the exchange. * existing WTID known to the exchange.
* @param index index number of the WTID to track, in case there
* 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
TALER_TESTING_cmd_track_transfer_empty (const char *label, TALER_TESTING_cmd_track_transfer_empty (const char *label,
const char *wtid_reference, const char *wtid_reference,
unsigned int index,
unsigned int expected_response_code); unsigned int expected_response_code);
@ -1595,8 +1591,6 @@ TALER_TESTING_cmd_track_transfer_empty (const char *label,
* @param label the command label. * @param label the command label.
* @param wtid_reference reference to any command which can provide * @param wtid_reference reference to any command which can provide
* a wtid. Will be the one tracked. * a wtid. Will be the one tracked.
* @param index in case there are multiple WTID offered, this
* parameter selects a particular one.
* @param expected_response_code expected HTTP response code. * @param expected_response_code expected HTTP response code.
* @param expected_total_amount how much money we expect being moved * @param expected_total_amount how much money we expect being moved
* with this wire-transfer. * with this wire-transfer.
@ -1606,11 +1600,11 @@ TALER_TESTING_cmd_track_transfer_empty (const char *label,
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_track_transfer (const char *label, TALER_TESTING_cmd_track_transfer (const char *label,
const char *wtid_reference, const char *wtid_reference,
unsigned int index,
unsigned int expected_response_code, unsigned int expected_response_code,
const char *expected_total_amount, const char *expected_total_amount,
const char *expected_wire_fee); const char *expected_wire_fee);
/** /**
* Make a "bank check" CMD. It checks whether a particular wire transfer from * Make a "bank check" CMD. It checks whether a particular wire transfer from
* the exchange (debit) has been made or not. * the exchange (debit) has been made or not.
@ -2283,7 +2277,7 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
} \ } \
struct TALER_TESTING_Trait \ struct TALER_TESTING_Trait \
TALER_TESTING_make_trait_ ## name ( \ TALER_TESTING_make_trait_ ## name ( \
const type * value) \ type * value) \
{ \ { \
struct TALER_TESTING_Trait ret = { \ struct TALER_TESTING_Trait ret = { \
.trait_name = TALER_S (name), \ .trait_name = TALER_S (name), \

View File

@ -131,7 +131,7 @@ serialize_keys_cleanup (void *cls,
* @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 enum GNUNET_GenericReturnValue
serialize_keys_traits (void *cls, serialize_keys_traits (void *cls,
const void **ret, const void **ret,
const char *trait, const char *trait,
@ -139,9 +139,9 @@ serialize_keys_traits (void *cls,
{ {
struct SerializeKeysState *sks = cls; struct SerializeKeysState *sks = cls;
struct TALER_TESTING_Trait traits[] = { struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_exchange_keys (0, sks->keys), TALER_TESTING_make_trait_exchange_keys (sks->keys),
TALER_TESTING_make_trait_url (TALER_TESTING_UT_EXCHANGE_BASE_URL, TALER_TESTING_make_trait_exchange_url (
sks->exchange_url), (const char **) &sks->exchange_url),
TALER_TESTING_trait_end () TALER_TESTING_trait_end ()
}; };
@ -167,7 +167,7 @@ connect_with_state_run (void *cls,
struct ConnectWithStateState *cwss = cls; struct ConnectWithStateState *cwss = cls;
const struct TALER_TESTING_Command *state_cmd; const struct TALER_TESTING_Command *state_cmd;
const json_t *serialized_keys; const json_t *serialized_keys;
const char *exchange_url; const char **exchange_url;
/* This command usually gets rescheduled after serialized /* This command usually gets rescheduled after serialized
* reconnection. */ * reconnection. */
@ -178,8 +178,8 @@ connect_with_state_run (void *cls,
} }
cwss->is = is; cwss->is = is;
state_cmd = TALER_TESTING_interpreter_lookup_command state_cmd = TALER_TESTING_interpreter_lookup_command (is,
(is, cwss->state_reference); cwss->state_reference);
/* Command providing serialized keys not found. */ /* Command providing serialized keys not found. */
if (NULL == state_cmd) if (NULL == state_cmd)
@ -191,7 +191,6 @@ connect_with_state_run (void *cls,
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_TESTING_get_trait_exchange_keys (state_cmd, TALER_TESTING_get_trait_exchange_keys (state_cmd,
0,
&serialized_keys)); &serialized_keys));
{ {
char *dump; char *dump;
@ -204,11 +203,10 @@ connect_with_state_run (void *cls,
} }
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_TESTING_get_trait_url (state_cmd, TALER_TESTING_get_trait_exchange_url (state_cmd,
TALER_TESTING_UT_EXCHANGE_BASE_URL,
&exchange_url)); &exchange_url));
is->exchange = TALER_EXCHANGE_connect (is->ctx, is->exchange = TALER_EXCHANGE_connect (is->ctx,
exchange_url, *exchange_url,
&TALER_TESTING_cert_cb, &TALER_TESTING_cert_cb,
cwss, cwss,
TALER_EXCHANGE_OPTION_DATA, TALER_EXCHANGE_OPTION_DATA,

View File

@ -83,7 +83,7 @@ do_stat (struct TALER_TESTING_Timer *timings,
{ {
if (TALER_TESTING_cmd_is_batch (cmd)) if (TALER_TESTING_cmd_is_batch (cmd))
{ {
struct TALER_TESTING_Command *bcmd; struct TALER_TESTING_Command **bcmd;
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_get_trait_batch_cmds (cmd, TALER_TESTING_get_trait_batch_cmds (cmd,
@ -94,10 +94,10 @@ do_stat (struct TALER_TESTING_Timer *timings,
} }
for (unsigned int j = 0; for (unsigned int j = 0;
NULL != bcmd[j].label; NULL != (*bcmd)[j].label;
j++) j++)
do_stat (timings, do_stat (timings,
&bcmd[j]); &(*bcmd)[j]);
} }
else else
{ {

View File

@ -156,7 +156,7 @@ analyze_command (const struct TALER_ReservePublicKeyP *reserve_pub,
if (TALER_TESTING_cmd_is_batch (cmd)) if (TALER_TESTING_cmd_is_batch (cmd))
{ {
struct TALER_TESTING_Command *cur; struct TALER_TESTING_Command *cur;
struct TALER_TESTING_Command *bcmd; struct TALER_TESTING_Command **bcmd;
cur = TALER_TESTING_cmd_batch_get_current (cmd); cur = TALER_TESTING_cmd_batch_get_current (cmd);
if (GNUNET_OK != if (GNUNET_OK !=
@ -166,9 +166,9 @@ analyze_command (const struct TALER_ReservePublicKeyP *reserve_pub,
GNUNET_break (0); GNUNET_break (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
for (unsigned int i = 0; NULL != bcmd[i].label; i++) for (unsigned int i = 0; NULL != (*bcmd)[i].label; i++)
{ {
struct TALER_TESTING_Command *step = &bcmd[i]; struct TALER_TESTING_Command *step = &(*bcmd)[i];
if (step == cur) if (step == cur)
break; /* if *we* are in a batch, make sure not to analyze commands past 'now' */ break; /* if *we* are in a batch, make sure not to analyze commands past 'now' */
@ -189,7 +189,6 @@ analyze_command (const struct TALER_ReservePublicKeyP *reserve_pub,
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_get_trait_reserve_pub (cmd, TALER_TESTING_get_trait_reserve_pub (cmd,
0,
&rp)) &rp))
return GNUNET_OK; /* command does nothing for reserves */ return GNUNET_OK; /* command does nothing for reserves */
if (0 != if (0 !=
@ -198,7 +197,6 @@ analyze_command (const struct TALER_ReservePublicKeyP *reserve_pub,
return GNUNET_OK; /* command affects some _other_ reserve */ return GNUNET_OK; /* command affects some _other_ reserve */
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_get_trait_reserve_history (cmd, TALER_TESTING_get_trait_reserve_history (cmd,
0,
&he)) &he))
{ {
/* NOTE: only for debugging... */ /* NOTE: only for debugging... */
@ -344,7 +342,6 @@ status_run (void *cls,
} }
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_get_trait_reserve_pub (create_reserve, TALER_TESTING_get_trait_reserve_pub (create_reserve,
0,
&ss->reserve_pubp)) &ss->reserve_pubp))
{ {
GNUNET_break (0); GNUNET_break (0);

View File

@ -79,11 +79,6 @@ struct TrackTransferState
*/ */
unsigned int expected_response_code; unsigned int expected_response_code;
/**
* Index to the WTID to pick, in case @a wtid_reference has
* many on offer.
*/
unsigned int index;
}; };
@ -219,11 +214,12 @@ track_transfer_cb (void *cls,
* or any operation that could provide wire-details. (2) * or any operation that could provide wire-details. (2)
* Total amount for this transfer matches the one from any * Total amount for this transfer matches the one from any
* referenced command that could provide one. * referenced command that could provide one.
*/if (NULL != tts->wire_details_reference) */
if (NULL != tts->wire_details_reference)
{ {
const struct TALER_TESTING_Command *wire_details_cmd; const struct TALER_TESTING_Command *wire_details_cmd;
const json_t *wire_details; const json_t *wire_details;
struct GNUNET_HashCode h_wire_details; struct TALER_MerchantWireHash h_wire_details;
wire_details_cmd wire_details_cmd
= TALER_TESTING_interpreter_lookup_command (is, = TALER_TESTING_interpreter_lookup_command (is,
@ -236,7 +232,6 @@ track_transfer_cb (void *cls,
} }
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_get_trait_wire_details (wire_details_cmd, TALER_TESTING_get_trait_wire_details (wire_details_cmd,
0,
&wire_details)) &wire_details))
{ {
GNUNET_break (0); GNUNET_break (0);
@ -274,8 +269,7 @@ track_transfer_cb (void *cls,
return; return;
} }
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_get_trait_amount_obj (total_amount_cmd, TALER_TESTING_get_trait_amount (total_amount_cmd,
0,
&total_amount_from_reference)) &total_amount_from_reference))
{ {
GNUNET_break (0); GNUNET_break (0);
@ -319,7 +313,9 @@ track_transfer_run (void *cls,
/* If no reference is given, we'll use a all-zeros /* If no reference is given, we'll use a all-zeros
* WTID */ * WTID */
memset (&wtid, 0, sizeof (wtid)); memset (&wtid,
0,
sizeof (wtid));
wtid_ptr = &wtid; wtid_ptr = &wtid;
tts->is = is; tts->is = is;
@ -327,9 +323,8 @@ track_transfer_run (void *cls,
{ {
const struct TALER_TESTING_Command *wtid_cmd; const struct TALER_TESTING_Command *wtid_cmd;
wtid_cmd = TALER_TESTING_interpreter_lookup_command wtid_cmd = TALER_TESTING_interpreter_lookup_command (tts->is,
(tts->is, tts->wtid_reference); tts->wtid_reference);
if (NULL == wtid_cmd) if (NULL == wtid_cmd)
{ {
GNUNET_break (0); GNUNET_break (0);
@ -337,8 +332,9 @@ track_transfer_run (void *cls,
return; return;
} }
if (GNUNET_OK != TALER_TESTING_get_trait_wtid if (GNUNET_OK !=
(wtid_cmd, tts->index, &wtid_ptr)) TALER_TESTING_get_trait_wtid (wtid_cmd,
&wtid_ptr))
{ {
GNUNET_break (0); GNUNET_break (0);
TALER_TESTING_interpreter_fail (tts->is); TALER_TESTING_interpreter_fail (tts->is);
@ -354,33 +350,15 @@ track_transfer_run (void *cls,
} }
/**
* Make a "track transfer" CMD where no "expected"-arguments,
* except the HTTP response code, are given. The best use case
* is when what matters to check is the HTTP response code, e.g.
* when a bogus WTID was passed.
*
* @param label the command label
* @param wtid_reference reference to any command which can provide
* a wtid. If NULL is given, then a all zeroed WTID is
* used that will at 99.9999% probability NOT match any
* existing WTID known to the exchange.
* @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 struct TALER_TESTING_Command
TALER_TESTING_cmd_track_transfer_empty (const char *label, TALER_TESTING_cmd_track_transfer_empty (const char *label,
const char *wtid_reference, const char *wtid_reference,
unsigned int index,
unsigned int expected_response_code) unsigned int expected_response_code)
{ {
struct TrackTransferState *tts; struct TrackTransferState *tts;
tts = GNUNET_new (struct TrackTransferState); tts = GNUNET_new (struct TrackTransferState);
tts->wtid_reference = wtid_reference; tts->wtid_reference = wtid_reference;
tts->index = index;
tts->expected_response_code = expected_response_code; tts->expected_response_code = expected_response_code;
{ {
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
@ -395,25 +373,9 @@ TALER_TESTING_cmd_track_transfer_empty (const char *label,
} }
/**
* Make a "track transfer" command, specifying which amount and
* wire fee are expected.
*
* @param label the command label.
* @param wtid_reference reference to any command which can provide
* a wtid. Will be the one tracked.
* @param index in case there are multiple WTID offered, this
* parameter selects a particular one.
* @param expected_response_code expected HTTP response code.
* @param expected_total_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 struct TALER_TESTING_Command
TALER_TESTING_cmd_track_transfer (const char *label, TALER_TESTING_cmd_track_transfer (const char *label,
const char *wtid_reference, const char *wtid_reference,
unsigned int index,
unsigned int expected_response_code, unsigned int expected_response_code,
const char *expected_total_amount, const char *expected_total_amount,
const char *expected_wire_fee) const char *expected_wire_fee)
@ -422,7 +384,6 @@ TALER_TESTING_cmd_track_transfer (const char *label,
tts = GNUNET_new (struct TrackTransferState); tts = GNUNET_new (struct TrackTransferState);
tts->wtid_reference = wtid_reference; tts->wtid_reference = wtid_reference;
tts->index = index;
tts->expected_response_code = expected_response_code; tts->expected_response_code = expected_response_code;
tts->expected_total_amount = expected_total_amount; tts->expected_total_amount = expected_total_amount;
tts->expected_wire_fee = expected_wire_fee; tts->expected_wire_fee = expected_wire_fee;

View File

@ -194,7 +194,7 @@ hack_response_code_cleanup
* @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 enum GNUNET_GenericReturnValue
hack_response_code_traits (void *cls, hack_response_code_traits (void *cls,
const void **ret, const void **ret,
const char *trait, const char *trait,
@ -203,7 +203,7 @@ hack_response_code_traits (void *cls,
struct HackResponseCodeState *hrcs = cls; struct HackResponseCodeState *hrcs = cls;
struct TALER_TESTING_Trait traits[] = { struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_process (0, &hrcs->proc), TALER_TESTING_make_trait_process (&hrcs->proc),
TALER_TESTING_trait_end () TALER_TESTING_trait_end ()
}; };
@ -251,16 +251,6 @@ hack_response_code_run (void *cls,
} }
/**
* Define a "hack response code" CMD. This causes the next
* response code (from the service proxied by the twister) to
* be substituted with @a http_status.
*
* @param label command label
* @param config_filename configuration filename.
* @param http_status new response code to use
* @return the command
*/
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_hack_response_code (const char *label, TALER_TESTING_cmd_hack_response_code (const char *label,
const char *config_filename, const char *config_filename,
@ -271,7 +261,7 @@ TALER_TESTING_cmd_hack_response_code (const char *label,
hrcs = GNUNET_new (struct HackResponseCodeState); hrcs = GNUNET_new (struct HackResponseCodeState);
hrcs->http_status = http_status; hrcs->http_status = http_status;
hrcs->config_filename = config_filename; hrcs->config_filename = config_filename;
{
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.label = label, .label = label,
.run = &hack_response_code_run, .run = &hack_response_code_run,
@ -282,6 +272,7 @@ TALER_TESTING_cmd_hack_response_code (const char *label,
return cmd; return cmd;
} }
}
/** /**
@ -320,7 +311,7 @@ delete_object_cleanup
* @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 enum GNUNET_GenericReturnValue
delete_object_traits (void *cls, delete_object_traits (void *cls,
const void **ret, const void **ret,
const char *trait, const char *trait,
@ -329,7 +320,7 @@ delete_object_traits (void *cls,
struct DeleteObjectState *dos = cls; struct DeleteObjectState *dos = cls;
struct TALER_TESTING_Trait traits[] = { struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_process (0, &dos->proc), TALER_TESTING_make_trait_process (&dos->proc),
TALER_TESTING_trait_end () TALER_TESTING_trait_end ()
}; };
@ -379,8 +370,7 @@ delete_object_run (void *cls,
* @param cmd the command being cleaned up. * @param cmd the command being cleaned up.
*/ */
static void static void
modify_object_cleanup modify_object_cleanup (void *cls,
(void *cls,
const struct TALER_TESTING_Command *cmd) const struct TALER_TESTING_Command *cmd)
{ {
struct ModifyObjectState *mos = cls; struct ModifyObjectState *mos = cls;
@ -407,7 +397,7 @@ modify_object_cleanup
* @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 enum GNUNET_GenericReturnValue
modify_object_traits (void *cls, modify_object_traits (void *cls,
const void **ret, const void **ret,
const char *trait, const char *trait,
@ -416,7 +406,7 @@ modify_object_traits (void *cls,
struct ModifyObjectState *mos = cls; struct ModifyObjectState *mos = cls;
struct TALER_TESTING_Trait traits[] = { struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_process (0, &mos->proc), TALER_TESTING_make_trait_process (&mos->proc),
TALER_TESTING_trait_end () TALER_TESTING_trait_end ()
}; };
@ -523,16 +513,6 @@ modify_header_dl_run (void *cls,
} }
/**
* Create a "delete object" CMD. This command deletes
* the JSON object pointed by @a path.
*
* @param label command label
* @param config_filename configuration filename.
* @param path object-like path notation to point the object
* to delete.
* @return the command
*/
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_delete_object (const char *label, TALER_TESTING_cmd_delete_object (const char *label,
const char *config_filename, const char *config_filename,
@ -598,10 +578,9 @@ flip_object_traits (void *cls,
const char *trait, const char *trait,
unsigned int index) unsigned int index)
{ {
struct FlipObjectState *fos = cls; struct FlipObjectState *fos = cls;
struct TALER_TESTING_Trait traits[] = { struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_process (0, &fos->proc), TALER_TESTING_make_trait_process (&fos->proc),
TALER_TESTING_trait_end () TALER_TESTING_trait_end ()
}; };
@ -674,15 +653,6 @@ flip_download_run (void *cls,
} }
/**
* Define a "flip object" command, for objects to upload.
*
* @param label command label
* @param config_filename configuration filename.
* @param path object-like path notation to point the object
* to flip.
* @return the command
*/
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_flip_upload (const char *label, TALER_TESTING_cmd_flip_upload (const char *label,
const char *config_filename, const char *config_filename,
@ -693,7 +663,7 @@ TALER_TESTING_cmd_flip_upload (const char *label,
dos = GNUNET_new (struct FlipObjectState); dos = GNUNET_new (struct FlipObjectState);
dos->path = path; dos->path = path;
dos->config_filename = config_filename; dos->config_filename = config_filename;
{
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.label = label, .label = label,
.run = &flip_upload_run, .run = &flip_upload_run,
@ -704,17 +674,9 @@ TALER_TESTING_cmd_flip_upload (const char *label,
return cmd; return cmd;
} }
}
/**
* Define a "flip object" command, for objects to download.
*
* @param label command label
* @param config_filename configuration filename.
* @param path object-like path notation to point the object
* to flip.
* @return the command
*/
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_flip_download (const char *label, TALER_TESTING_cmd_flip_download (const char *label,
const char *config_filename, const char *config_filename,
@ -725,7 +687,7 @@ TALER_TESTING_cmd_flip_download (const char *label,
dos = GNUNET_new (struct FlipObjectState); dos = GNUNET_new (struct FlipObjectState);
dos->path = path; dos->path = path;
dos->config_filename = config_filename; dos->config_filename = config_filename;
{
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.label = label, .label = label,
.run = &flip_download_run, .run = &flip_download_run,
@ -736,6 +698,7 @@ TALER_TESTING_cmd_flip_download (const char *label,
return cmd; return cmd;
} }
}
/** /**
@ -773,7 +736,7 @@ malform_request_cleanup (void *cls,
* @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 enum GNUNET_GenericReturnValue
malform_request_traits (void *cls, malform_request_traits (void *cls,
const void **ret, const void **ret,
const char *trait, const char *trait,
@ -781,7 +744,7 @@ malform_request_traits (void *cls,
{ {
struct MalformRequestState *mrs = cls; struct MalformRequestState *mrs = cls;
struct TALER_TESTING_Trait traits[] = { struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_process (0, &mrs->proc), TALER_TESTING_make_trait_process (&mrs->proc),
TALER_TESTING_trait_end () TALER_TESTING_trait_end ()
}; };
@ -831,8 +794,7 @@ malform_request_run (void *cls,
* @param cmd the command being cleaned up. * @param cmd the command being cleaned up.
*/ */
static void static void
malform_response_cleanup malform_response_cleanup (void *cls,
(void *cls,
const struct TALER_TESTING_Command *cmd) const struct TALER_TESTING_Command *cmd)
{ {
struct MalformResponseState *mrs = cls; struct MalformResponseState *mrs = cls;
@ -859,7 +821,7 @@ malform_response_cleanup
* @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 enum GNUNET_GenericReturnValue
malform_response_traits (void *cls, malform_response_traits (void *cls,
const void **ret, const void **ret,
const char *trait, const char *trait,
@ -867,7 +829,7 @@ malform_response_traits (void *cls,
{ {
struct MalformResponseState *mrs = cls; struct MalformResponseState *mrs = cls;
struct TALER_TESTING_Trait traits[] = { struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_process (0, &mrs->proc), TALER_TESTING_make_trait_process (&mrs->proc),
TALER_TESTING_trait_end () TALER_TESTING_trait_end ()
}; };
@ -909,14 +871,6 @@ malform_response_run (void *cls,
} }
/**
* Create a "malform request" CMD. This command makes the
* next request randomly malformed (by truncating it).
*
* @param label command label
* @param config_filename configuration filename.
* @return the command
*/
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_malform_request (const char *label, TALER_TESTING_cmd_malform_request (const char *label,
const char *config_filename) const char *config_filename)
@ -925,7 +879,7 @@ TALER_TESTING_cmd_malform_request (const char *label,
mrs = GNUNET_new (struct MalformRequestState); mrs = GNUNET_new (struct MalformRequestState);
mrs->config_filename = config_filename; mrs->config_filename = config_filename;
{
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.label = label, .label = label,
.run = &malform_request_run, .run = &malform_request_run,
@ -936,17 +890,9 @@ TALER_TESTING_cmd_malform_request (const char *label,
return cmd; return cmd;
} }
}
/**
* Create a "malform response" CMD. This command makes
* the next response randomly malformed (by truncating it).
*
* @param label command label
* @param config_filename configuration filename.
*
* @return the command
*/
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_malform_response (const char *label, TALER_TESTING_cmd_malform_response (const char *label,
const char *config_filename) const char *config_filename)
@ -969,19 +915,6 @@ TALER_TESTING_cmd_malform_response (const char *label,
} }
/**
* Create a "modify object" CMD. This command instructs
* the twister to modify the next object that is downloaded
* from the proxied service.
*
* @param label command label
* @param config_filename configuration filename.
* @param path object-like path notation to point the object
* to modify.
* @param value value to put as the object's.
*
* @return the command
*/
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_modify_object_dl (const char *label, TALER_TESTING_cmd_modify_object_dl (const char *label,
const char *config_filename, const char *config_filename,
@ -994,7 +927,7 @@ TALER_TESTING_cmd_modify_object_dl (const char *label,
mos->path = path; mos->path = path;
mos->value = value; mos->value = value;
mos->config_filename = config_filename; mos->config_filename = config_filename;
{
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.label = label, .label = label,
.run = &modify_object_dl_run, .run = &modify_object_dl_run,
@ -1005,20 +938,9 @@ TALER_TESTING_cmd_modify_object_dl (const char *label,
return cmd; return cmd;
} }
}
/**
* Create a "modify object" CMD. This command instructs
* the twister to modify the next object that will be uploaded
* to the proxied service.
*
* @param label command label
* @param config_filename configuration filename.
* @param path object-like path notation pointing the object
* to modify.
* @param value value to put as the object's.
* @return the command
*/
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_modify_object_ul (const char *label, TALER_TESTING_cmd_modify_object_ul (const char *label,
const char *config_filename, const char *config_filename,
@ -1031,7 +953,7 @@ TALER_TESTING_cmd_modify_object_ul (const char *label,
mos->path = path; mos->path = path;
mos->value = value; mos->value = value;
mos->config_filename = config_filename; mos->config_filename = config_filename;
{
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.label = label, .label = label,
.run = &modify_object_ul_run, .run = &modify_object_ul_run,
@ -1042,18 +964,9 @@ TALER_TESTING_cmd_modify_object_ul (const char *label,
return cmd; return cmd;
} }
}
/**
* Create a "modify header" CMD. This command instructs
* the twister to modify a header in the next HTTP response.
*
* @param label command label
* @param config_filename configuration filename.
* @param path identifies the location to modify
* @param value value to set the header to.
* @return the command
*/
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_modify_header_dl (const char *label, TALER_TESTING_cmd_modify_header_dl (const char *label,
const char *config_filename, const char *config_filename,
@ -1066,7 +979,7 @@ TALER_TESTING_cmd_modify_header_dl (const char *label,
mos->path = path; mos->path = path;
mos->value = value; mos->value = value;
mos->config_filename = config_filename; mos->config_filename = config_filename;
{
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.label = label, .label = label,
.run = &modify_header_dl_run, .run = &modify_header_dl_run,
@ -1077,6 +990,7 @@ TALER_TESTING_cmd_modify_header_dl (const char *label,
return cmd; return cmd;
} }
}
/* end of testing_api_cmd_exec_client.c */ /* end of testing_api_cmd_exec_client.c */

View File

@ -240,8 +240,8 @@ reserve_withdraw_cb (void *cls,
switch (wr->hr.http_status) switch (wr->hr.http_status)
{ {
case MHD_HTTP_OK: case MHD_HTTP_OK:
ws->sig.rsa_signature = GNUNET_CRYPTO_rsa_signature_dup ( TALER_denom_sig_deep_copy (&ws->sig,
wr->details.success.sig.rsa_signature); &wr->details.success.sig);
if (0 != ws->total_backoff.rel_value_us) if (0 != ws->total_backoff.rel_value_us)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@ -349,7 +349,6 @@ withdraw_run (void *cls,
} }
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_get_trait_reserve_priv (create_reserve, TALER_TESTING_get_trait_reserve_priv (create_reserve,
0,
&rp)) &rp))
{ {
GNUNET_break (0); GNUNET_break (0);
@ -451,11 +450,7 @@ withdraw_cleanup (void *cls,
GNUNET_SCHEDULER_cancel (ws->retry_task); GNUNET_SCHEDULER_cancel (ws->retry_task);
ws->retry_task = NULL; ws->retry_task = NULL;
} }
if (NULL != ws->sig.rsa_signature) TALER_denom_sig_free (&ws->sig);
{
GNUNET_CRYPTO_rsa_signature_free (ws->sig.rsa_signature);
ws->sig.rsa_signature = NULL;
}
if (NULL != ws->pk) if (NULL != ws->pk)
{ {
TALER_EXCHANGE_destroy_denomination_key (ws->pk); TALER_EXCHANGE_destroy_denomination_key (ws->pk);
@ -476,7 +471,7 @@ withdraw_cleanup (void *cls,
* @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 enum GNUNET_GenericReturnValue
withdraw_traits (void *cls, withdraw_traits (void *cls,
const void **ret, const void **ret,
const char *trait, const char *trait,
@ -501,7 +496,6 @@ withdraw_traits (void *cls,
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_get_trait_reserve_priv (reserve_cmd, TALER_TESTING_get_trait_reserve_priv (reserve_cmd,
0,
&reserve_priv)) &reserve_priv))
{ {
GNUNET_break (0); GNUNET_break (0);
@ -510,7 +504,6 @@ withdraw_traits (void *cls,
} }
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_get_trait_reserve_pub (reserve_cmd, TALER_TESTING_get_trait_reserve_pub (reserve_cmd,
0,
&reserve_pub)) &reserve_pub))
{ {
GNUNET_break (0); GNUNET_break (0);
@ -523,8 +516,7 @@ withdraw_traits (void *cls,
{ {
struct TALER_TESTING_Trait traits[] = { struct TALER_TESTING_Trait traits[] = {
/* history entry MUST be first due to response code logic below! */ /* history entry MUST be first due to response code logic below! */
TALER_TESTING_make_trait_reserve_history (0, TALER_TESTING_make_trait_reserve_history (&ws->reserve_history),
&ws->reserve_history),
TALER_TESTING_make_trait_coin_priv (0 /* only one coin */, TALER_TESTING_make_trait_coin_priv (0 /* only one coin */,
&ws->ps.coin_priv), &ws->ps.coin_priv),
TALER_TESTING_make_trait_blinding_key (0 /* only one coin */, TALER_TESTING_make_trait_blinding_key (0 /* only one coin */,
@ -533,14 +525,11 @@ withdraw_traits (void *cls,
ws->pk), ws->pk),
TALER_TESTING_make_trait_denom_sig (0 /* only one coin */, TALER_TESTING_make_trait_denom_sig (0 /* only one coin */,
&ws->sig), &ws->sig),
TALER_TESTING_make_trait_reserve_priv (0, TALER_TESTING_make_trait_reserve_priv (reserve_priv),
reserve_priv), TALER_TESTING_make_trait_reserve_pub (reserve_pub),
TALER_TESTING_make_trait_reserve_pub (0, TALER_TESTING_make_trait_amount (&ws->amount),
reserve_pub), TALER_TESTING_make_trait_exchange_url (
TALER_TESTING_make_trait_amount_obj (0, (const char **) &ws->exchange_url),
&ws->amount),
TALER_TESTING_make_trait_url (TALER_TESTING_UT_EXCHANGE_BASE_URL,
ws->exchange_url),
TALER_TESTING_trait_end () TALER_TESTING_trait_end ()
}; };

View File

@ -66,7 +66,7 @@ TALER_TESTING_interpreter_lookup_command (struct TALER_TESTING_Interpreter *is,
if (TALER_TESTING_cmd_is_batch (cmd)) if (TALER_TESTING_cmd_is_batch (cmd))
{ {
struct TALER_TESTING_Command *batch; struct TALER_TESTING_Command **batch;
struct TALER_TESTING_Command *current; struct TALER_TESTING_Command *current;
struct TALER_TESTING_Command *icmd; struct TALER_TESTING_Command *icmd;
const struct TALER_TESTING_Command *match; const struct TALER_TESTING_Command *match;
@ -78,7 +78,7 @@ TALER_TESTING_interpreter_lookup_command (struct TALER_TESTING_Interpreter *is,
/* We must do the loop forward, but we can find the last match */ /* We must do the loop forward, but we can find the last match */
match = NULL; match = NULL;
for (unsigned int j = 0; for (unsigned int j = 0;
NULL != (icmd = &batch[j])->label; NULL != (icmd = &(*batch)[j])->label;
j++) j++)
{ {
if (current == icmd) if (current == icmd)
@ -381,7 +381,6 @@ maint_child_death (void *cls)
sizeof (c))); sizeof (c)));
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_get_trait_process (cmd, TALER_TESTING_get_trait_process (cmd,
0,
&processp)) &processp))
{ {
GNUNET_break (0); GNUNET_break (0);