summaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-07-15 22:33:49 +0200
committerChristian Grothoff <christian@grothoff.org>2023-07-15 22:33:49 +0200
commitcd5fafffe22608d3d9ec6c620417ecdbd6c076d3 (patch)
tree02d04097ef86ec334b387e320809cf27e3d3d1f1 /src/testing
parent5b14fd547e0f1497d62cdc92c27af9ddf19b6105 (diff)
downloadexchange-cd5fafffe22608d3d9ec6c620417ecdbd6c076d3.tar.gz
exchange-cd5fafffe22608d3d9ec6c620417ecdbd6c076d3.tar.bz2
exchange-cd5fafffe22608d3d9ec6c620417ecdbd6c076d3.zip
-get taler-exchange-benchmark to work
Diffstat (limited to 'src/testing')
-rwxr-xr-xsrc/testing/taler-unified-setup.sh13
-rw-r--r--src/testing/test_exchange_api.conf1
-rw-r--r--src/testing/testing_api_cmd_bank_admin_add_incoming.c5
-rw-r--r--src/testing/testing_api_cmd_batch.c2
-rw-r--r--src/testing/testing_api_cmd_reserve_history.c6
-rw-r--r--src/testing/testing_api_cmd_reserve_status.c6
-rw-r--r--src/testing/testing_api_cmd_stat.c47
-rw-r--r--src/testing/testing_api_cmd_withdraw.c3
-rw-r--r--src/testing/testing_api_loop.c13
9 files changed, 65 insertions, 31 deletions
diff --git a/src/testing/taler-unified-setup.sh b/src/testing/taler-unified-setup.sh
index bd05c9bc1..7a19091a3 100755
--- a/src/testing/taler-unified-setup.sh
+++ b/src/testing/taler-unified-setup.sh
@@ -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
diff --git a/src/testing/test_exchange_api.conf b/src/testing/test_exchange_api.conf
index 6a285f55d..4b0ac2cb6 100644
--- a/src/testing/test_exchange_api.conf
+++ b/src/testing/test_exchange_api.conf
@@ -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]
diff --git a/src/testing/testing_api_cmd_bank_admin_add_incoming.c b/src/testing/testing_api_cmd_bank_admin_add_incoming.c
index fcf6079a1..5c031d0b3 100644
--- a/src/testing/testing_api_cmd_bank_admin_add_incoming.c
+++ b/src/testing/testing_api_cmd_bank_admin_add_incoming.c
@@ -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)
diff --git a/src/testing/testing_api_cmd_batch.c b/src/testing/testing_api_cmd_batch.c
index bd6454a56..5bb7b974e 100644
--- a/src/testing/testing_api_cmd_batch.c
+++ b/src/testing/testing_api_cmd_batch.c
@@ -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 ()
};
diff --git a/src/testing/testing_api_cmd_reserve_history.c b/src/testing/testing_api_cmd_reserve_history.c
index a7df69e6e..ff0a8a554 100644
--- a/src/testing/testing_api_cmd_reserve_history.c
+++ b/src/testing/testing_api_cmd_reserve_history.c
@@ -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);
diff --git a/src/testing/testing_api_cmd_reserve_status.c b/src/testing/testing_api_cmd_reserve_status.c
index 001582ed8..2438b2c21 100644
--- a/src/testing/testing_api_cmd_reserve_status.c
+++ b/src/testing/testing_api_cmd_reserve_status.c
@@ -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' */
diff --git a/src/testing/testing_api_cmd_stat.c b/src/testing/testing_api_cmd_stat.c
index f85072a17..8723aac0d 100644
--- a/src/testing/testing_api_cmd_stat.c
+++ b/src/testing/testing_api_cmd_stat.c
@@ -28,6 +28,19 @@
/**
+ * 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.
*
* @param timings where to add up times
@@ -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 */
diff --git a/src/testing/testing_api_cmd_withdraw.c b/src/testing/testing_api_cmd_withdraw.c
index 2550e55a4..cf0b49983 100644
--- a/src/testing/testing_api_cmd_withdraw.c
+++ b/src/testing/testing_api_cmd_withdraw.c
@@ -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 (
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c
index 411e47c45..2a8e3d0b7 100644
--- a/src/testing/testing_api_loop.c
+++ b/src/testing/testing_api_loop.c
@@ -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)