-get taler-exchange-benchmark to work

This commit is contained in:
Christian Grothoff 2023-07-15 22:33:49 +02:00
parent 5b14fd547e
commit cd5fafffe2
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
12 changed files with 94 additions and 49 deletions

View File

@ -39,18 +39,20 @@ ENABLE_DEBIT = YES
ENABLE_CREDIT = YES
[exchange-accountcredentials-1]
WIRE_GATEWAY_AUTH_METHOD = none
WIRE_GATEWAY_URL = "http://localhost:8082/42/"
# account-2 is suitable for libeufin
[exchange-account-2]
ENABLE_DEBIT = YES
ENABLE_CREDIT = YES
PAYTO_URI = payto://iban/SANDBOXX/DE033310?receiver-name=Exchange+Company
[exchange-accountcredentials-2]
WIRE_GATEWAY_AUTH_METHOD = basic
USERNAME = Exchange
USERNAME = exchange
PASSWORD = x
WIRE_GATEWAY_URL = "http://localhost:8082/2/"
WIRE_GATEWAY_URL = "http://localhost:8082/facades/test-facade/taler-wire-gateway/"
# Trust local exchange for "EUR" currency

View File

@ -102,7 +102,7 @@ static int use_fakebank;
* Section with the configuration data for the exchange
* bank account.
*/
static char *exchange_bank_section = "exchange-account-1";
static char *exchange_bank_section;
/**
* Currency used.
@ -211,11 +211,18 @@ run (void *cls,
(void) cls;
all_commands = GNUNET_new_array (
howmany_reserves * (1 /* Withdraw block */
+ howmany_coins) /* All units */
1 /* exchange CMD */
+ howmany_reserves * (1 /* Withdraw block */
+ howmany_coins) /* All units */
+ 1 /* stat CMD */
+ 1 /* End CMD */,
struct TALER_TESTING_Command);
all_commands[0]
= TALER_TESTING_cmd_get_exchange ("get-exchange",
cred.cfg,
NULL,
true,
true);
GNUNET_asprintf (&amount_5, "%s:5", currency);
GNUNET_asprintf (&amount_4, "%s:4", currency);
GNUNET_asprintf (&amount_1, "%s:1", currency);
@ -252,9 +259,9 @@ run (void *cls,
GNUNET_asprintf (&batch_label,
"batch-start-%u",
j);
all_commands[reserves_first
? j
: j * (howmany_coins + 1)]
all_commands[1 + (reserves_first
? j
: j * (howmany_coins + 1))]
= TALER_TESTING_cmd_batch (add_label (batch_label),
make_reserve);
}
@ -334,16 +341,16 @@ run (void *cls,
"unit-%u-%u",
i,
j);
all_commands[reserves_first
? howmany_reserves + j * howmany_coins + i
: j * (howmany_coins + 1) + (1 + i)]
all_commands[1 + (reserves_first
? howmany_reserves + j * howmany_coins + i
: j * (howmany_coins + 1) + (1 + i))]
= TALER_TESTING_cmd_batch (add_label (unit_label),
unit);
}
}
all_commands[howmany_reserves * (1 + howmany_coins)]
all_commands[1 + howmany_reserves * (1 + howmany_coins)]
= TALER_TESTING_cmd_stat (timings);
all_commands[howmany_reserves * (1 + howmany_coins) + 1]
all_commands[1 + howmany_reserves * (1 + howmany_coins) + 1]
= TALER_TESTING_cmd_end ();
TALER_TESTING_run2 (is,
all_commands,
@ -417,7 +424,7 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
{
/* I am the child, do the work! */
GNUNET_log_setup ("benchmark-worker",
NULL == loglev ? "INFO" : loglev,
loglev,
logfile);
result = TALER_TESTING_loop (main_cb,
main_cb_cls);
@ -556,10 +563,12 @@ main (int argc,
return 0;
return EXIT_INVALIDARGUMENT;
}
if (NULL == exchange_bank_section)
exchange_bank_section = "exchange-account-1";
if (NULL == loglev)
loglev = "INFO";
GNUNET_log_setup ("taler-exchange-benchmark",
NULL == loglev
? "INFO"
: loglev,
loglev,
logfile);
if (NULL == cfg_filename)
cfg_filename = GNUNET_CONFIGURATION_default_filename ();

View File

@ -2668,7 +2668,7 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
op (order_id, const char) \
op (amount, const struct TALER_Amount) \
op (amount_with_fee, const struct TALER_Amount) \
op (batch_cmds, struct TALER_TESTING_Command *) \
op (batch_cmds, struct TALER_TESTING_Command) \
op (uuid, const struct GNUNET_Uuid) \
op (fresh_coins, const struct TALER_TESTING_FreshCoinData *) \
op (claim_token, const struct TALER_ClaimTokenP) \

View File

@ -102,6 +102,7 @@ while getopts ':abc:d:efghL:mnr:stu:vwW' OPTION; do
echo ' -d $METHOD -- use wire method (default: x-taler-bank)'
echo ' -e -- start exchange'
echo ' -f -- start fakebank'
echo ' -g -- start aggregator'
echo ' -h -- print this help'
echo ' -L $LOGLEVEL -- set log level'
echo ' -m -- start merchant'
@ -249,7 +250,11 @@ then
# Create the default demobank.
echo -n "Configuring sandbox "
libeufin-sandbox config --currency "$CURRENCY" default &> libeufin-sandbox-config.log
libeufin-sandbox config \
--currency "$CURRENCY" \
--users-debt-limit 99999999 \
--bank-debt-limit 99999999 \
default &> libeufin-sandbox-config.log
echo "DONE"
echo -n "Launching sandbox ... "
export LIBEUFIN_SANDBOX_ADMIN_PASSWORD="secret"
@ -456,7 +461,11 @@ fi
if [ "1" = "$START_WIREWATCH" ]
then
echo -n "Starting wirewatch ..."
$USE_VALGRIND taler-exchange-wirewatch -c "$CONF" 2> taler-exchange-wirewatch.log &
$USE_VALGRIND taler-exchange-wirewatch \
--account="$USE_ACCOUNT" \
-c "$CONF" \
--longpoll-timeout="1 s" \
2> taler-exchange-wirewatch.log &
WIREWATCH_PID=$!
echo " DONE"
fi

View File

@ -51,6 +51,7 @@ ENABLE_DEBIT = YES
ENABLE_CREDIT = YES
[exchange-accountcredentials-1]
WIRE_GATEWAY_AUTH_METHOD = none
WIRE_GATEWAY_URL = "http://localhost:8082/42/"
[exchange-account-2]

View File

@ -225,8 +225,9 @@ confirmation_cb (void *cls,
}
if (air->http_status != fts->expected_http_status)
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (is);
TALER_TESTING_unexpected_status (is,
air->http_status,
fts->expected_http_status);
return;
}
switch (air->http_status)

View File

@ -128,7 +128,7 @@ batch_traits (void *cls,
{
struct BatchState *bs = cls;
struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_batch_cmds (&bs->batch),
TALER_TESTING_make_trait_batch_cmds (bs->batch),
TALER_TESTING_trait_end ()
};

View File

@ -131,7 +131,7 @@ analyze_command (void *cls,
if (TALER_TESTING_cmd_is_batch (cmd))
{
struct TALER_TESTING_Command *cur;
struct TALER_TESTING_Command **bcmd;
struct TALER_TESTING_Command *bcmd;
cur = TALER_TESTING_cmd_batch_get_current (cmd);
if (GNUNET_OK !=
@ -142,9 +142,9 @@ analyze_command (void *cls,
ac->failure = true;
return;
}
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];
analyze_command (ac,
step);

View File

@ -122,7 +122,7 @@ analyze_command (void *cls,
if (TALER_TESTING_cmd_is_batch (cmd))
{
struct TALER_TESTING_Command *cur;
struct TALER_TESTING_Command **bcmd;
struct TALER_TESTING_Command *bcmd;
cur = TALER_TESTING_cmd_batch_get_current (cmd);
if (GNUNET_OK !=
@ -133,9 +133,9 @@ analyze_command (void *cls,
ac->failure = true;
return;
}
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)
break; /* if *we* are in a batch, make sure not to analyze commands past 'now' */

View File

@ -27,6 +27,19 @@
#include "taler_testing_lib.h"
/**
* Run a "stat" CMD.
*
* @param cls closure.
* @param cmd the command being run.
* @param is the interpreter state.
*/
static void
stat_run (void *cls,
const struct TALER_TESTING_Command *cmd,
struct TALER_TESTING_Interpreter *is);
/**
* Add the time @a cmd took to the respective duration in @a timings.
*
@ -40,9 +53,20 @@ stat_cmd (struct TALER_TESTING_Timer *timings,
struct GNUNET_TIME_Relative duration;
struct GNUNET_TIME_Relative lat;
if (cmd->start_time.abs_value_us > cmd->finish_time.abs_value_us)
if (GNUNET_TIME_absolute_cmp (cmd->start_time,
>,
cmd->finish_time))
{
GNUNET_break (0);
/* This is a problem, except of course for
this command itself, as we clearly did not yet
finish... */
if (cmd->run != &stat_run)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Bad timings for `%s'\n",
cmd->label);
GNUNET_break (0);
}
return;
}
duration = GNUNET_TIME_absolute_get_difference (cmd->start_time,
@ -85,7 +109,7 @@ do_stat (void *cls,
if (TALER_TESTING_cmd_is_batch (cmd))
{
struct TALER_TESTING_Command **bcmd;
struct TALER_TESTING_Command *bcmd;
if (GNUNET_OK !=
TALER_TESTING_get_trait_batch_cmds (cmd,
@ -94,18 +118,15 @@ do_stat (void *cls,
GNUNET_break (0);
return;
}
for (unsigned int j = 0;
NULL != (*bcmd)[j].label;
NULL != bcmd[j].label;
j++)
do_stat (timings,
&(*bcmd)[j]);
}
else
{
stat_cmd (timings,
cmd);
&bcmd[j]);
return;
}
stat_cmd (timings,
cmd);
}
@ -136,7 +157,7 @@ TALER_TESTING_cmd_stat (struct TALER_TESTING_Timer *timers)
{
struct TALER_TESTING_Command cmd = {
.label = "stat",
.run = stat_run,
.run = &stat_run,
.cls = (void *) timers
};
@ -144,4 +165,4 @@ TALER_TESTING_cmd_stat (struct TALER_TESTING_Timer *timers)
}
/* end of testing_api_cmd_sleep.c */
/* end of testing_api_cmd_stat.c */

View File

@ -349,7 +349,8 @@ withdraw_run (void *cls,
const struct TALER_TESTING_Command *create_reserve;
const struct TALER_EXCHANGE_DenomPublicKey *dpk;
ws->cmd = cmd;
if (NULL != cmd)
ws->cmd = cmd;
ws->is = is;
create_reserve
= TALER_TESTING_interpreter_lookup_command (

View File

@ -107,7 +107,7 @@ TALER_TESTING_interpreter_lookup_command (struct TALER_TESTING_Interpreter *is,
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 *icmd;
const struct TALER_TESTING_Command *match;
@ -119,7 +119,7 @@ TALER_TESTING_interpreter_lookup_command (struct TALER_TESTING_Interpreter *is,
/* We must do the loop forward, but we can find the last match */
match = NULL;
for (unsigned int j = 0;
NULL != (icmd = &(*batch)[j])->label;
NULL != (icmd = &batch[j])->label;
j++)
{
if (current == icmd)
@ -205,8 +205,9 @@ TALER_TESTING_interpreter_next (struct TALER_TESTING_Interpreter *is)
if (TALER_TESTING_cmd_batch_next (is,
cmd->cls))
{
/* batch is done */
cmd->finish_time = GNUNET_TIME_absolute_get ();
is->ip++; /* batch is done */
is->ip++;
}
}
else
@ -221,7 +222,7 @@ TALER_TESTING_interpreter_next (struct TALER_TESTING_Interpreter *is)
"Interpreter executed 1000 instructions in %s\n",
GNUNET_STRINGS_relative_time_to_string (
GNUNET_TIME_absolute_get_duration (last_report),
GNUNET_YES));
true));
last_report = GNUNET_TIME_absolute_get ();
}
ipc++;
@ -733,7 +734,7 @@ seek_batch (struct TALER_TESTING_Interpreter *is,
const struct TALER_TESTING_Command *target)
{
unsigned int new_ip;
struct TALER_TESTING_Command **batch;
struct TALER_TESTING_Command *batch;
struct TALER_TESTING_Command *current;
struct TALER_TESTING_Command *icmd;
struct TALER_TESTING_Command *match;
@ -744,7 +745,7 @@ seek_batch (struct TALER_TESTING_Interpreter *is,
&batch));
match = NULL;
for (new_ip = 0;
NULL != (icmd = &(*batch)[new_ip]);
NULL != (icmd = &batch[new_ip]);
new_ip++)
{
if (current == target)