Compare commits

...

11 Commits

Author SHA1 Message Date
Christian Grothoff
3ce29a711b
clean up taler-bank-benchmark 2023-07-16 12:09:23 +02:00
Christian Grothoff
ec03f262b6
fix taler-aggregator-benchmark 2023-07-16 11:25:22 +02:00
Christian Grothoff
942dd73794
-ignore 2023-07-15 22:37:21 +02:00
Christian Grothoff
cd5fafffe2
-get taler-exchange-benchmark to work 2023-07-15 22:33:49 +02:00
Christian Grothoff
5b14fd547e
fix crash with -a option 2023-07-15 19:58:55 +02:00
Christian Grothoff
cd45ba408a
-fix up config 2023-07-15 19:29:13 +02:00
Christian Grothoff
ea47fb40c0
include taler-unified-setup in Debian package 2023-07-15 19:13:48 +02:00
Christian Grothoff
22ad41a2b4
-update man pages 2023-07-15 19:11:24 +02:00
Christian Grothoff
3976729af1
-update man pages 2023-07-15 19:08:19 +02:00
c86a169fb5
-typo fix fix 2023-07-15 18:20:48 +02:00
3bebbfc2da
-typo fix 2023-07-15 18:19:12 +02:00
25 changed files with 314 additions and 624 deletions

View File

@ -4,6 +4,7 @@ usr/bin/taler-exchange-benchmark
usr/bin/taler-fakebank-run usr/bin/taler-fakebank-run
usr/bin/taler-bank-benchmark usr/bin/taler-bank-benchmark
usr/bin/taler-exchange-kyc-tester usr/bin/taler-exchange-kyc-tester
usr/bin/taler-unified-setup.sh
# Only used in test cases. Maybe these # Only used in test cases. Maybe these
# shouldn't even be installed? # shouldn't even be installed?
@ -28,4 +29,5 @@ usr/lib/*/libtalerfakebank.so
# Documentation # Documentation
usr/share/man/man1/taler-exchange-benchmark* usr/share/man/man1/taler-exchange-benchmark*
usr/share/man/man1/taler-unified-setup
usr/share/info/taler-developer-manual* usr/share/info/taler-developer-manual*

View File

@ -39,7 +39,8 @@ man_MANS = \
prebuilt/man/taler-helper-auditor-deposits.1\ prebuilt/man/taler-helper-auditor-deposits.1\
prebuilt/man/taler-helper-auditor-purses.1\ prebuilt/man/taler-helper-auditor-purses.1\
prebuilt/man/taler-helper-auditor-reserves.1\ prebuilt/man/taler-helper-auditor-reserves.1\
prebuilt/man/taler-helper-auditor-wire.1 prebuilt/man/taler-helper-auditor-wire.1 \
prebuilt/man/taler-unified-setup.1
info_TEXINFOS = \ info_TEXINFOS = \
prebuilt/texinfo/taler-auditor.texi \ prebuilt/texinfo/taler-auditor.texi \

@ -1 +1 @@
Subproject commit 66e99d09d4351bb6e6c5fd442f14ec7cf1363a81 Subproject commit 02380e2e7318c7fd75fcfe7b03d1596b56c8d505

View File

@ -1,2 +1,3 @@
taler-bank-benchmark taler-bank-benchmark
taler-aggregator-benchmark taler-aggregator-benchmark
*.edited

View File

@ -16,6 +16,12 @@ BASE_URL="http://localhost:8081/"
AGGREGATOR_SHARD_SIZE=67108864 AGGREGATOR_SHARD_SIZE=67108864
WIREWATCH_IDLE_SLEEP_INTERVAL=5 ms WIREWATCH_IDLE_SLEEP_INTERVAL=5 ms
[exchangedb-postgres]
CONFIG="postgres:///talercheck"
[exchange-offline]
MASTER_PRIV_FILE=${TALER_DATA_HOME}/exchange/offline-keys/master.priv
[taler-exchange-secmod-rsa] [taler-exchange-secmod-rsa]
LOOKAHEAD_SIGN="1 d" LOOKAHEAD_SIGN="1 d"
@ -26,6 +32,29 @@ LOOKAHEAD_SIGN="1 d"
DURATION="2 d" DURATION="2 d"
LOOKAHEAD_SIGN="1 d" LOOKAHEAD_SIGN="1 d"
# account-2 is suitable for fakebank
[exchange-account-1]
PAYTO_URI = "payto://x-taler-bank/localhost/42?receiver-name=42"
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
PASSWORD = x
WIRE_GATEWAY_URL = "http://localhost:8082/facades/test-facade/taler-wire-gateway/"
# Trust local exchange for "EUR" currency # Trust local exchange for "EUR" currency
[merchant-exchange-benchmark] [merchant-exchange-benchmark]
EXCHANGE_BASE_URL = http://localhost:8081/ EXCHANGE_BASE_URL = http://localhost:8081/
@ -35,9 +64,6 @@ MASTER_KEY=98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG
CURRENCY = EUR CURRENCY = EUR
[exchangedb-postgres]
CONFIG="postgres:///talercheck"
[merchantdb-postgres] [merchantdb-postgres]
CONFIG="postgres:///talercheck" CONFIG="postgres:///talercheck"
@ -47,26 +73,15 @@ CONFIG="postgres:///talercheck"
[syncdb-postgres] [syncdb-postgres]
CONFIG="postgres:///talercheck" CONFIG="postgres:///talercheck"
[exchange-offline]
MASTER_PRIV_FILE=${TALER_DATA_HOME}/exchange/offline-keys/master.priv
[bank] [bank]
HTTP_PORT=8082 HTTP_PORT=8082
SERVE=http SERVE=http
MAX_DEBT=EUR:100000000000.0
MAX_DEBT_BANK=EUR:1000000000000000.0
DATABASE=bank-db.sqlite3
[libeufin-nexus] [libeufin-nexus]
DB_CONNECTION="jdbc:postgresql://localhost/talercheck?socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory$FactoryArg&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432" DB_CONNECTION="jdbc:postgresql://localhost/talercheck?socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory$FactoryArg&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432"
#DB_CONNECTION="jdbc:sqlite:libeufin-nexus.sqlite3"
[libeufin-sandbox] [libeufin-sandbox]
DB_CONNECTION="jdbc:postgresql://localhost/talercheck?socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory$FactoryArg&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432" DB_CONNECTION="jdbc:postgresql://localhost/talercheck?socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory$FactoryArg&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432"
#DB_CONNECTION="jdbc:sqlite:libeufin-sandbox.sqlite3"
[auditor] [auditor]
BASE_URL="http://localhost:8083/" BASE_URL="http://localhost:8083/"
[benchmark]
USER_PAYTO_URI="payto://x-taler-bank/localhost:8082/42?receiver-name=user42"

View File

@ -1 +0,0 @@
p<EFBFBD>^<5E>-<2D>33<33><33>XX<>!<04>\0q<30><71><EFBFBD><EFBFBD><18>mU<6D>_<EFBFBD><5F>

View File

@ -251,7 +251,7 @@ add_refund (const struct Merchant *m,
r.details.rtransaction_id = 42; r.details.rtransaction_id = 42;
make_amount (0, 5000000, &r.details.refund_amount); make_amount (0, 5000000, &r.details.refund_amount);
make_amount (0, 5, &r.details.refund_fee); make_amount (0, 5, &r.details.refund_fee);
if (0 <= if (0 >=
plugin->insert_refund (plugin->cls, plugin->insert_refund (plugin->cls,
&r)) &r))
{ {
@ -307,8 +307,13 @@ add_deposit (const struct Merchant *m)
deposit.wire_salt = m->wire_salt; deposit.wire_salt = m->wire_salt;
deposit.receiver_wire_account = m->payto_uri; deposit.receiver_wire_account = m->payto_uri;
deposit.timestamp = random_time (); deposit.timestamp = random_time ();
do {
deposit.refund_deadline = random_time (); deposit.refund_deadline = random_time ();
deposit.wire_deadline = random_time (); deposit.wire_deadline = random_time ();
} while (GNUNET_TIME_timestamp_cmp (deposit.wire_deadline,
<,
deposit.refund_deadline));
make_amount (1, 0, &deposit.amount_with_fee); make_amount (1, 0, &deposit.amount_with_fee);
make_amount (0, 5, &deposit.deposit_fee); make_amount (0, 5, &deposit.deposit_fee);
if (0 >= if (0 >=
@ -446,6 +451,9 @@ run (void *cls,
} }
GNUNET_SCHEDULER_add_shutdown (&do_shutdown, GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
NULL); NULL);
memset (&issue,
0,
sizeof (issue));
RANDOMIZE (&issue.signature); RANDOMIZE (&issue.signature);
issue.start issue.start
= start; = start;
@ -478,6 +486,7 @@ run (void *cls,
TALER_DENOMINATION_RSA, TALER_DENOMINATION_RSA,
1024)); 1024));
alg_values.cipher = TALER_DENOMINATION_RSA; alg_values.cipher = TALER_DENOMINATION_RSA;
denom_pub.age_mask = issue.age_mask;
TALER_denom_pub_hash (&denom_pub, TALER_denom_pub_hash (&denom_pub,
&h_denom_pub); &h_denom_pub);
make_amount (2, 0, &issue.value); make_amount (2, 0, &issue.value);
@ -497,7 +506,6 @@ run (void *cls,
return; return;
} }
TALER_planchet_blinding_secret_create (&ps, TALER_planchet_blinding_secret_create (&ps,
&alg_values, &alg_values,
&bks); &bks);

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
(C) 2014-2021 Taler Systems SA (C) 2014-2023 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it TALER is free software; you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as under the terms of the GNU Affero General Public License as
@ -39,65 +39,16 @@
#include "taler_error_codes.h" #include "taler_error_codes.h"
/* Error codes. */
enum BenchmarkError
{
MISSING_BANK_URL,
FAILED_TO_LAUNCH_BANK,
BAD_CLI_ARG,
BAD_CONFIG_FILE,
NO_CONFIG_FILE_GIVEN
};
/** /**
* What mode should the benchmark run in? * Credentials to use for the benchmark.
*/ */
enum BenchmarkMode static struct TALER_TESTING_Credentials cred;
{
/**
* Run as client against the bank.
*/
MODE_CLIENT = 1,
/**
* Run the bank.
*/
MODE_BANK = 2,
/**
* Run both, for a local benchmark.
*/
MODE_BOTH = 3,
};
/**
* Hold information regarding which bank has the exchange account.
*/
static const struct TALER_EXCHANGEDB_AccountInfo *exchange_bank_account;
/**
* Time snapshot taken right before executing the CMDs.
*/
static struct GNUNET_TIME_Absolute start_time;
/**
* Benchmark duration time taken right after the CMD interpreter
* returns.
*/
static struct GNUNET_TIME_Relative duration;
/** /**
* Array of all the commands the benchmark is running. * Array of all the commands the benchmark is running.
*/ */
static struct TALER_TESTING_Command *all_commands; static struct TALER_TESTING_Command *all_commands;
/**
* Dummy keepalive task.
*/
static struct GNUNET_SCHEDULER_Task *keepalive;
/** /**
* Name of our configuration file. * Name of our configuration file.
*/ */
@ -105,27 +56,14 @@ static char *cfg_filename;
/** /**
* Use the fakebank instead of LibEuFin. * Use the fakebank instead of LibEuFin.
* NOTE: LibEuFin not yet supported! Set
* to 0 once we do support it!
*/ */
static int use_fakebank = 1; static int use_fakebank;
/**
* Number of taler-exchange-wirewatchers to launch.
*/
static unsigned int start_wirewatch;
/** /**
* Verbosity level. * Verbosity level.
*/ */
static unsigned int verbose; static unsigned int verbose;
/**
* Size of the transaction history the fakebank
* should keep in RAM.
*/
static unsigned long long history_size = 65536;
/** /**
* How many reserves we want to create per client. * How many reserves we want to create per client.
*/ */
@ -141,6 +79,11 @@ static unsigned int howmany_clients = 1;
*/ */
static unsigned int howmany_threads; static unsigned int howmany_threads;
/**
* How many wirewatch processes do we want to create.
*/
static unsigned int start_wirewatch;
/** /**
* Log level used during the run. * Log level used during the run.
*/ */
@ -151,32 +94,17 @@ static char *loglev;
*/ */
static char *logfile; static char *logfile;
/**
* Benchmarking mode (run as client, exchange, both) as string.
*/
static char *mode_str;
/**
* Benchmarking mode (run as client, bank, both).
*/
static enum BenchmarkMode mode;
/**
* Don't kill exchange/fakebank/wirewatch until
* requested by the user explicitly.
*/
static int linger;
/**
* Do not initialize or reset the database.
*/
static int incremental;
/** /**
* Configuration. * Configuration.
*/ */
static struct GNUNET_CONFIGURATION_Handle *cfg; static struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Section with the configuration data for the exchange
* bank account.
*/
static char *exchange_bank_section;
/** /**
* Currency used. * Currency used.
*/ */
@ -237,10 +165,10 @@ print_stats (void)
total = GNUNET_strdup ( total = GNUNET_strdup (
GNUNET_STRINGS_relative_time_to_string (timings[i].total_duration, GNUNET_STRINGS_relative_time_to_string (timings[i].total_duration,
GNUNET_YES)); true));
latency = GNUNET_strdup ( latency = GNUNET_strdup (
GNUNET_STRINGS_relative_time_to_string (timings[i].success_latency, GNUNET_STRINGS_relative_time_to_string (timings[i].success_latency,
GNUNET_YES)); true));
fprintf (stderr, fprintf (stderr,
"%s-%d took %s in total with %s for latency for %u executions (%u repeats)\n", "%s-%d took %s in total with %s for latency for %u executions (%u repeats)\n",
timings[i].prefix, timings[i].prefix,
@ -270,38 +198,39 @@ run (void *cls,
(void) cls; (void) cls;
len = howmany_reserves + 2; len = howmany_reserves + 2;
all_commands = GNUNET_malloc_large (len all_commands = GNUNET_malloc_large ((1 + len)
* sizeof (struct TALER_TESTING_Command)); * sizeof (struct TALER_TESTING_Command));
GNUNET_assert (NULL != all_commands); GNUNET_assert (NULL != all_commands);
all_commands[0]
= TALER_TESTING_cmd_get_exchange ("get-exchange",
cred.cfg,
NULL,
true,
true);
GNUNET_asprintf (&total_reserve_amount, GNUNET_asprintf (&total_reserve_amount,
"%s:5", "%s:5",
currency); currency);
for (unsigned int j = 0; j < howmany_reserves; j++) for (unsigned int j = 0; j < howmany_reserves; j++)
{ {
char *create_reserve_label; char *create_reserve_label;
char *user_payto_uri;
// FIXME: vary user accounts more...
GNUNET_assert (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_string (cfg,
"benchmark",
"USER_PAYTO_URI",
&user_payto_uri));
GNUNET_asprintf (&create_reserve_label, GNUNET_asprintf (&create_reserve_label,
"createreserve-%u", "createreserve-%u",
j); j);
all_commands[j] // TODO: vary user accounts more...
all_commands[1 + j]
= TALER_TESTING_cmd_admin_add_incoming_retry ( = TALER_TESTING_cmd_admin_add_incoming_retry (
TALER_TESTING_cmd_admin_add_incoming (add_label ( TALER_TESTING_cmd_admin_add_incoming (add_label (
create_reserve_label), create_reserve_label),
total_reserve_amount, total_reserve_amount,
exchange_bank_account->auth, &cred.ba,
add_label (user_payto_uri))); cred.user42_payto));
} }
GNUNET_free (total_reserve_amount); GNUNET_free (total_reserve_amount);
all_commands[howmany_reserves] all_commands[1 + howmany_reserves]
= TALER_TESTING_cmd_stat (timings); = TALER_TESTING_cmd_stat (timings);
all_commands[howmany_reserves + 1] all_commands[1 + howmany_reserves + 1]
= TALER_TESTING_cmd_end (); = TALER_TESTING_cmd_end ();
TALER_TESTING_run2 (is, TALER_TESTING_run2 (is,
all_commands, all_commands,
@ -318,7 +247,6 @@ launch_clients (void)
enum GNUNET_GenericReturnValue result = GNUNET_OK; enum GNUNET_GenericReturnValue result = GNUNET_OK;
pid_t cpids[howmany_clients]; pid_t cpids[howmany_clients];
start_time = GNUNET_TIME_absolute_get ();
if (1 == howmany_clients) if (1 == howmany_clients)
{ {
/* do everything in this process */ /* do everything in this process */
@ -387,78 +315,6 @@ again:
} }
/**
* Stop the fakebank.
*
* @param cls fakebank handle
*/
static void
stop_fakebank (void *cls)
{
struct TALER_FAKEBANK_Handle *fakebank = cls;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Stopping fakebank\n");
TALER_FAKEBANK_stop (fakebank);
GNUNET_SCHEDULER_cancel (keepalive);
keepalive = NULL;
}
/**
* Dummy task that is never run.
*/
static void
never_task (void *cls)
{
(void) cls;
GNUNET_assert (0);
}
/**
* Start the fakebank.
*
* @param cls NULL
*/
static void
launch_fakebank (void *cls)
{
struct TALER_FAKEBANK_Handle *fakebank;
unsigned long long pnum;
(void) cls;
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (cfg,
"bank",
"HTTP_PORT",
&pnum))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
"bank",
"HTTP_PORT",
"must be valid port number");
return;
}
fakebank
= TALER_FAKEBANK_start2 ((uint16_t) pnum,
currency,
history_size,
howmany_threads);
if (NULL == fakebank)
{
GNUNET_break (0);
return;
}
keepalive
= GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&never_task,
NULL);
GNUNET_SCHEDULER_add_shutdown (&stop_fakebank,
fakebank);
}
/** /**
* Run the benchmark in parallel in many (client) processes * Run the benchmark in parallel in many (client) processes
* and summarize result. * and summarize result.
@ -469,114 +325,11 @@ static enum GNUNET_GenericReturnValue
parallel_benchmark (void) parallel_benchmark (void)
{ {
enum GNUNET_GenericReturnValue result = GNUNET_OK; enum GNUNET_GenericReturnValue result = GNUNET_OK;
pid_t fakebank = -1;
struct GNUNET_OS_Process *bankd = NULL;
struct GNUNET_OS_Process *wirewatch[GNUNET_NZL (start_wirewatch)]; struct GNUNET_OS_Process *wirewatch[GNUNET_NZL (start_wirewatch)];
memset (wirewatch, memset (wirewatch,
0, 0,
sizeof (wirewatch)); sizeof (wirewatch));
if ( (MODE_BANK == mode) ||
(MODE_BOTH == mode) )
{
if (use_fakebank)
{
unsigned long long pnum;
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (cfg,
"bank",
"HTTP_PORT",
&pnum))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
"bank",
"HTTP_PORT",
"must be valid port number");
return GNUNET_SYSERR;
}
/* start fakebank */
fakebank = fork ();
if (0 == fakebank)
{
GNUNET_log_setup ("benchmark-fakebank",
NULL == loglev ? "INFO" : loglev,
logfile);
GNUNET_SCHEDULER_run (&launch_fakebank,
NULL);
exit (0);
}
if (-1 == fakebank)
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
"fork");
return GNUNET_SYSERR;
}
/* wait for fakebank to be ready */
{
char *bank_url;
int ret;
GNUNET_asprintf (&bank_url,
"http://localhost:%u/",
(unsigned int) (uint16_t) pnum);
ret = TALER_TESTING_wait_httpd_ready (bank_url);
GNUNET_free (bank_url);
if (0 != ret)
{
int wstatus;
kill (fakebank,
SIGTERM);
if (fakebank !=
waitpid (fakebank,
&wstatus,
0))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
"waitpid");
}
fakebank = -1;
exit (ret);
}
}
}
else
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"FIXME #7273: launching LibEuFin not yet supported\n");
bankd = NULL; // FIXME #7273
return GNUNET_SYSERR;
}
if (0 == incremental)
{
struct GNUNET_OS_Process *dbinit;
dbinit = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
NULL, NULL, NULL,
"taler-exchange-dbinit",
"taler-exchange-dbinit",
"-c", cfg_filename,
"-r",
(NULL != loglev) ? "-L" : NULL,
loglev,
NULL);
if (NULL == dbinit)
{
if (NULL != bankd)
{
GNUNET_OS_process_kill (bankd,
SIGTERM);
GNUNET_OS_process_destroy (bankd);
bankd = NULL;
}
return GNUNET_SYSERR;
}
GNUNET_break (GNUNET_OK ==
GNUNET_OS_process_wait (dbinit));
GNUNET_OS_process_destroy (dbinit);
}
/* start exchange wirewatch */ /* start exchange wirewatch */
for (unsigned int w = 0; w<start_wirewatch; w++) for (unsigned int w = 0; w<start_wirewatch; w++)
{ {
@ -602,51 +355,10 @@ parallel_benchmark (void)
GNUNET_OS_process_destroy (wirewatch[x]); GNUNET_OS_process_destroy (wirewatch[x]);
wirewatch[x] = NULL; wirewatch[x] = NULL;
} }
if (-1 != fakebank)
{
int wstatus;
kill (fakebank,
SIGTERM);
if (fakebank !=
waitpid (fakebank,
&wstatus,
0))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
"waitpid");
}
fakebank = -1;
}
if (NULL != bankd)
{
GNUNET_OS_process_kill (bankd,
SIGTERM);
GNUNET_OS_process_destroy (bankd);
bankd = NULL;
}
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
} }
}
if ( (MODE_CLIENT == mode) ||
(MODE_BOTH == mode) )
result = launch_clients (); result = launch_clients ();
if ( (GNUNET_YES == linger) ||
(MODE_BANK == mode) )
{
printf ("Press ENTER to stop!\n");
if (MODE_BANK != mode)
duration = GNUNET_TIME_absolute_get_duration (start_time);
(void) getchar ();
if (MODE_BANK == mode)
duration = GNUNET_TIME_absolute_get_duration (start_time);
}
if ( (MODE_BANK == mode) ||
(MODE_BOTH == mode) )
{
/* Ensure wirewatch runs to completion! */ /* Ensure wirewatch runs to completion! */
if (0 != start_wirewatch) if (0 != start_wirewatch)
{ {
@ -701,46 +413,6 @@ parallel_benchmark (void)
wirewatch[0] = NULL; wirewatch[0] = NULL;
} }
/* Now stop the time, if this was the right mode */
if ( (GNUNET_YES != linger) &&
(MODE_BANK != mode) )
duration = GNUNET_TIME_absolute_get_duration (start_time);
/* stop fakebank */
if (-1 != fakebank)
{
int wstatus;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Telling fakebank to shut down\n");
kill (fakebank,
SIGTERM);
if (fakebank !=
waitpid (fakebank,
&wstatus,
0))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
"waitpid");
}
else
{
if ( (! WIFEXITED (wstatus)) ||
(0 != WEXITSTATUS (wstatus)) )
{
GNUNET_break (0);
result = GNUNET_SYSERR;
}
}
fakebank = -1;
}
if (NULL != bankd)
{
GNUNET_OS_process_kill (bankd,
SIGTERM);
GNUNET_OS_process_destroy (bankd);
}
}
return result; return result;
} }
@ -760,32 +432,17 @@ main (int argc,
struct GNUNET_GETOPT_CommandLineOption options[] = { struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_option_mandatory ( GNUNET_GETOPT_option_mandatory (
GNUNET_GETOPT_option_cfgfile (&cfg_filename)), GNUNET_GETOPT_option_cfgfile (&cfg_filename)),
#if FIXME_SUPPORT_LIBEUFIN
GNUNET_GETOPT_option_flag ('f', GNUNET_GETOPT_option_flag ('f',
"fakebank", "fakebank",
"start a fakebank instead of the Python bank", "we are using fakebank",
&use_fakebank), &use_fakebank),
#endif
GNUNET_GETOPT_option_help ("taler-bank benchmark"), GNUNET_GETOPT_option_help ("taler-bank benchmark"),
GNUNET_GETOPT_option_flag ('K',
"linger",
"linger around until key press",
&linger),
GNUNET_GETOPT_option_flag ('i',
"incremental",
"skip initializing and resetting the database",
&incremental),
GNUNET_GETOPT_option_string ('l', GNUNET_GETOPT_option_string ('l',
"logfile", "logfile",
"LF", "LF",
"will log to file LF", "will log to file LF",
&logfile), &logfile),
GNUNET_GETOPT_option_loglevel (&loglev), GNUNET_GETOPT_option_loglevel (&loglev),
GNUNET_GETOPT_option_string ('m',
"mode",
"MODE",
"run as bank, client or both",
&mode_str),
GNUNET_GETOPT_option_uint ('p', GNUNET_GETOPT_option_uint ('p',
"worker-parallelism", "worker-parallelism",
"NPROCS", "NPROCS",
@ -801,11 +458,12 @@ main (int argc,
"NRESERVES", "NRESERVES",
"How many reserves per client we should create", "How many reserves per client we should create",
&howmany_reserves), &howmany_reserves),
GNUNET_GETOPT_option_ulong ('s', GNUNET_GETOPT_option_string (
"size", 'u',
"HISTORY_SIZE", "exchange-account-section",
"Maximum history size kept in memory by the fakebank", "SECTION",
&history_size), "use exchange bank account configuration from the given SECTION",
&exchange_bank_section),
GNUNET_GETOPT_option_version (PACKAGE_VERSION " " VCS_VERSION), GNUNET_GETOPT_option_version (PACKAGE_VERSION " " VCS_VERSION),
GNUNET_GETOPT_option_verbose (&verbose), GNUNET_GETOPT_option_verbose (&verbose),
GNUNET_GETOPT_option_uint ('w', GNUNET_GETOPT_option_uint ('w',
@ -815,6 +473,7 @@ main (int argc,
&start_wirewatch), &start_wirewatch),
GNUNET_GETOPT_OPTION_END GNUNET_GETOPT_OPTION_END
}; };
struct GNUNET_TIME_Relative duration;
unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME"); unsetenv ("XDG_CONFIG_HOME");
@ -827,35 +486,15 @@ main (int argc,
GNUNET_free (cfg_filename); GNUNET_free (cfg_filename);
if (GNUNET_NO == result) if (GNUNET_NO == result)
return 0; return 0;
return BAD_CLI_ARG; return EXIT_INVALIDARGUMENT;
} }
if (NULL == exchange_bank_section)
exchange_bank_section = "exchange-account-1";
if (NULL == loglev)
loglev = "INFO";
GNUNET_log_setup ("taler-bank-benchmark", GNUNET_log_setup ("taler-bank-benchmark",
NULL == loglev ? "INFO" : loglev, loglev,
logfile); logfile);
if (history_size < 10)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"History size too small, this can hardly work\n");
return BAD_CLI_ARG;
}
if (NULL == mode_str)
mode = MODE_BOTH;
else if (0 == strcasecmp (mode_str,
"bank"))
mode = MODE_BANK;
else if (0 == strcasecmp (mode_str,
"client"))
mode = MODE_CLIENT;
else if (0 == strcasecmp (mode_str,
"both"))
mode = MODE_BOTH;
else
{
TALER_LOG_ERROR ("Unknown mode given: '%s'\n",
mode_str);
GNUNET_free (cfg_filename);
return BAD_CONFIG_FILE;
}
if (NULL == cfg_filename) if (NULL == cfg_filename)
cfg_filename = GNUNET_CONFIGURATION_default_filename (); cfg_filename = GNUNET_CONFIGURATION_default_filename ();
if (NULL == cfg_filename) if (NULL == cfg_filename)
@ -871,7 +510,7 @@ main (int argc,
{ {
TALER_LOG_ERROR ("Could not parse configuration\n"); TALER_LOG_ERROR ("Could not parse configuration\n");
GNUNET_free (cfg_filename); GNUNET_free (cfg_filename);
return BAD_CONFIG_FILE; return EXIT_NOTCONFIGURED;
} }
if (GNUNET_OK != if (GNUNET_OK !=
TALER_config_get_currency (cfg, TALER_config_get_currency (cfg,
@ -879,52 +518,30 @@ main (int argc,
{ {
GNUNET_CONFIGURATION_destroy (cfg); GNUNET_CONFIGURATION_destroy (cfg);
GNUNET_free (cfg_filename); GNUNET_free (cfg_filename);
return BAD_CONFIG_FILE; return EXIT_NOTCONFIGURED;
}
if (MODE_BANK != mode)
{
if (howmany_clients > 10240)
{
TALER_LOG_ERROR ("-p option value given is too large\n");
return BAD_CLI_ARG;
}
if (0 == howmany_clients)
{
TALER_LOG_ERROR ("-p option value must not be zero\n");
GNUNET_free (cfg_filename);
return BAD_CLI_ARG;
}
} }
if (GNUNET_OK != if (GNUNET_OK !=
TALER_EXCHANGEDB_load_accounts (cfg, TALER_TESTING_get_credentials (
TALER_EXCHANGEDB_ALO_AUTHDATA cfg_filename,
| TALER_EXCHANGEDB_ALO_CREDIT)) exchange_bank_section,
use_fakebank
? TALER_TESTING_BS_FAKEBANK
: TALER_TESTING_BS_IBAN,
&cred))
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Configuration fails to provide exchange bank details\n"); "Required bank credentials not given in configuration\n");
GNUNET_free (cfg_filename); GNUNET_free (cfg_filename);
return BAD_CONFIG_FILE; return EXIT_NOTCONFIGURED;
} }
exchange_bank_account
= TALER_EXCHANGEDB_find_account_by_method ("x-taler-bank");
if (NULL == exchange_bank_account)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, struct GNUNET_TIME_Absolute start_time;
"No bank account for `x-taler-bank` given in configuration\n");
GNUNET_free (cfg_filename); start_time = GNUNET_TIME_absolute_get ();
return BAD_CONFIG_FILE;
}
result = parallel_benchmark (); result = parallel_benchmark ();
TALER_EXCHANGEDB_unload_accounts (); duration = GNUNET_TIME_absolute_get_duration (start_time);
GNUNET_CONFIGURATION_destroy (cfg);
GNUNET_free (cfg_filename);
if (MODE_BANK == mode)
{
/* If we're the bank, we're done now. No need to print results. */
return (GNUNET_OK == result) ? 0 : result;
} }
if (GNUNET_OK == result) if (GNUNET_OK == result)
@ -952,7 +569,7 @@ main (int argc,
tps); tps);
} }
fprintf (stdout, fprintf (stdout,
"CPU time: sys %llu user %llu\n", \ "CPU time: sys %llu user %llu\n",
(unsigned long long) (usage.ru_stime.tv_sec * 1000 * 1000 (unsigned long long) (usage.ru_stime.tv_sec * 1000 * 1000
+ usage.ru_stime.tv_usec), + usage.ru_stime.tv_usec),
(unsigned long long) (usage.ru_utime.tv_sec * 1000 * 1000 (unsigned long long) (usage.ru_utime.tv_sec * 1000 * 1000
@ -963,5 +580,7 @@ main (int argc,
GNUNET_array_grow (labels, GNUNET_array_grow (labels,
label_len, label_len,
0); 0);
GNUNET_CONFIGURATION_destroy (cfg);
GNUNET_free (cfg_filename);
return (GNUNET_OK == result) ? 0 : result; return (GNUNET_OK == result) ? 0 : result;
} }

View File

@ -102,7 +102,7 @@ static int use_fakebank;
* Section with the configuration data for the exchange * Section with the configuration data for the exchange
* bank account. * bank account.
*/ */
static char *exchange_bank_section = "exchange-account-1"; static char *exchange_bank_section;
/** /**
* Currency used. * Currency used.
@ -210,12 +210,20 @@ run (void *cls,
char *amount_1; char *amount_1;
(void) cls; (void) cls;
all_commands = GNUNET_new_array ( all_commands = GNUNET_malloc_large (
howmany_reserves * (1 /* Withdraw block */ (1 /* exchange CMD */
+ howmany_reserves
* (1 /* Withdraw block */
+ howmany_coins) /* All units */ + howmany_coins) /* All units */
+ 1 /* stat CMD */ + 1 /* stat CMD */
+ 1 /* End CMD */, + 1 /* End CMD */) * sizeof (struct TALER_TESTING_Command));
struct TALER_TESTING_Command); GNUNET_assert (NULL != all_commands);
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_5, "%s:5", currency);
GNUNET_asprintf (&amount_4, "%s:4", currency); GNUNET_asprintf (&amount_4, "%s:4", currency);
GNUNET_asprintf (&amount_1, "%s:1", currency); GNUNET_asprintf (&amount_1, "%s:1", currency);
@ -252,9 +260,9 @@ run (void *cls,
GNUNET_asprintf (&batch_label, GNUNET_asprintf (&batch_label,
"batch-start-%u", "batch-start-%u",
j); j);
all_commands[reserves_first all_commands[1 + (reserves_first
? j ? j
: j * (howmany_coins + 1)] : j * (howmany_coins + 1))]
= TALER_TESTING_cmd_batch (add_label (batch_label), = TALER_TESTING_cmd_batch (add_label (batch_label),
make_reserve); make_reserve);
} }
@ -334,16 +342,16 @@ run (void *cls,
"unit-%u-%u", "unit-%u-%u",
i, i,
j); j);
all_commands[reserves_first all_commands[1 + (reserves_first
? howmany_reserves + j * howmany_coins + i ? howmany_reserves + j * howmany_coins + i
: j * (howmany_coins + 1) + (1 + i)] : j * (howmany_coins + 1) + (1 + i))]
= TALER_TESTING_cmd_batch (add_label (unit_label), = TALER_TESTING_cmd_batch (add_label (unit_label),
unit); unit);
} }
} }
all_commands[howmany_reserves * (1 + howmany_coins)] all_commands[1 + howmany_reserves * (1 + howmany_coins)]
= TALER_TESTING_cmd_stat (timings); = 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_cmd_end ();
TALER_TESTING_run2 (is, TALER_TESTING_run2 (is,
all_commands, all_commands,
@ -417,7 +425,7 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
{ {
/* I am the child, do the work! */ /* I am the child, do the work! */
GNUNET_log_setup ("benchmark-worker", GNUNET_log_setup ("benchmark-worker",
NULL == loglev ? "INFO" : loglev, loglev,
logfile); logfile);
result = TALER_TESTING_loop (main_cb, result = TALER_TESTING_loop (main_cb,
main_cb_cls); main_cb_cls);
@ -556,10 +564,12 @@ main (int argc,
return 0; return 0;
return EXIT_INVALIDARGUMENT; 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", GNUNET_log_setup ("taler-exchange-benchmark",
NULL == loglev loglev,
? "INFO"
: loglev,
logfile); logfile);
if (NULL == cfg_filename) if (NULL == cfg_filename)
cfg_filename = GNUNET_CONFIGURATION_default_filename (); cfg_filename = GNUNET_CONFIGURATION_default_filename ();

View File

@ -849,6 +849,9 @@ build_wire_state (void)
wire_method = TALER_payto_get_method (payto_uri); wire_method = TALER_payto_get_method (payto_uri);
if (NULL == wire_method) if (NULL == wire_method)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"No wire method in `%s'\n",
payto_uri);
wsh->http_status = MHD_HTTP_INTERNAL_SERVER_ERROR; wsh->http_status = MHD_HTTP_INTERNAL_SERVER_ERROR;
wsh->wire_reply wsh->wire_reply
= TALER_MHD_make_error ( = TALER_MHD_make_error (
@ -888,26 +891,21 @@ build_wire_state (void)
GNUNET_CRYPTO_hash_context_abort (hc); GNUNET_CRYPTO_hash_context_abort (hc);
return wsh; return wsh;
} }
if (0 == json_array_size (ac.a)) if (0 != json_array_size (ac.a))
{ {
json_decref (ac.a); wsh->cache_expiration
json_decref (wire_accounts_array); = GNUNET_TIME_absolute_min (ac.max_seen,
json_decref (wire_fee_object);
wsh->http_status = MHD_HTTP_INTERNAL_SERVER_ERROR;
wsh->wire_reply
= TALER_MHD_make_error (TALER_EC_EXCHANGE_WIRE_FEES_NOT_CONFIGURED,
wire_method);
GNUNET_free (wire_method);
GNUNET_CRYPTO_hash_context_abort (hc);
return wsh;
}
wsh->cache_expiration = GNUNET_TIME_absolute_min (ac.max_seen,
wsh->cache_expiration); wsh->cache_expiration);
GNUNET_assert (0 == GNUNET_assert (0 ==
json_object_set_new (wire_fee_object, json_object_set_new (wire_fee_object,
wire_method, wire_method,
ac.a)); ac.a));
} }
else
{
json_decref (ac.a);
}
}
GNUNET_free (wire_method); GNUNET_free (wire_method);
} }
} }
@ -2438,6 +2436,11 @@ create_krd (struct TEH_KeyStateHandle *ksh,
json_t *keys; json_t *keys;
wsh = get_wire_state (); wsh = get_wire_state ();
if (MHD_HTTP_OK != wsh->http_status)
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
GNUNET_assert (! GNUNET_TIME_absolute_is_zero ( GNUNET_assert (! GNUNET_TIME_absolute_is_zero (
last_cherry_pick_date.abs_time)); last_cherry_pick_date.abs_time));
GNUNET_assert (NULL != signkeys); GNUNET_assert (NULL != signkeys);

View File

@ -296,7 +296,7 @@ add_account_cb (void *cls,
if (! in_ai->credit_enabled) if (! in_ai->credit_enabled)
return; /* not enabled for us, skip */ return; /* not enabled for us, skip */
if ( (NULL != account_section) && if ( (NULL != account_section) &&
(0 != strcasecmp (ai->section_name, (0 != strcasecmp (in_ai->section_name,
account_section)) ) account_section)) )
return; /* not enabled for us, skip */ return; /* not enabled for us, skip */
if (NULL != ai) if (NULL != ai)

View File

@ -97,8 +97,6 @@ TEH_PG_insert_deposit (void *cls,
" FROM known_coins" " FROM known_coins"
" WHERE coin_pub=$1" " WHERE coin_pub=$1"
" ON CONFLICT DO NOTHING;"); " ON CONFLICT DO NOTHING;");
return GNUNET_PQ_eval_prepared_non_select (pg->conn, return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_deposit", "insert_deposit",
params); params);

View File

@ -45,7 +45,6 @@ TEH_PG_insert_refund (void *cls,
TALER_amount_cmp_currency (&refund->details.refund_amount, TALER_amount_cmp_currency (&refund->details.refund_amount,
&refund->details.refund_fee)); &refund->details.refund_fee));
/* Used in #postgres_insert_refund() to store refund information */
PREPARE (pg, PREPARE (pg,
"insert_refund", "insert_refund",
"INSERT INTO refunds " "INSERT INTO refunds "

View File

@ -26,6 +26,7 @@
#include "pg_helper.h" #include "pg_helper.h"
#include "pg_get_wire_fee.h" #include "pg_get_wire_fee.h"
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_insert_wire_fee (void *cls, TEH_PG_insert_wire_fee (void *cls,
const char *type, const char *type,

View File

@ -2882,7 +2882,7 @@ typedef void
* Used internally by the `struct TALER_EXCHANGE_BatchWithdrawHandle` * Used internally by the `struct TALER_EXCHANGE_BatchWithdrawHandle`
* implementation as well as for the reward logic of merchants. * implementation as well as for the reward logic of merchants.
*/ */
struct TALER_EXCHANGE_BatchWithdraw2Handle; struct TALER_EXCHANGE_AgeWithdrawBlindedHandle;
/** /**
* Withdraw age-restricted coins from the exchange using a * Withdraw age-restricted coins from the exchange using a

View File

@ -2668,7 +2668,7 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
op (order_id, const char) \ op (order_id, const char) \
op (amount, const struct TALER_Amount) \ op (amount, const struct TALER_Amount) \
op (amount_with_fee, 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 (uuid, const struct GNUNET_Uuid) \
op (fresh_coins, const struct TALER_TESTING_FreshCoinData *) \ op (fresh_coins, const struct TALER_TESTING_FreshCoinData *) \
op (claim_token, const struct TALER_ClaimTokenP) \ op (claim_token, const struct TALER_ClaimTokenP) \

View File

@ -74,7 +74,7 @@ LOGLEVEL="DEBUG"
DEFAULT_SLEEP="0.2" DEFAULT_SLEEP="0.2"
# Parse command-line options # Parse command-line options
while getopts ':abc:d:efghl:mnr:stu:vwW' OPTION; do while getopts ':abc:d:efghL:mnr:stu:vwW' OPTION; do
case "$OPTION" in case "$OPTION" in
a) a)
START_AUDITOR="1" START_AUDITOR="1"
@ -102,8 +102,9 @@ while getopts ':abc:d:efghl:mnr:stu:vwW' OPTION; do
echo ' -d $METHOD -- use wire method (default: x-taler-bank)' echo ' -d $METHOD -- use wire method (default: x-taler-bank)'
echo ' -e -- start exchange' echo ' -e -- start exchange'
echo ' -f -- start fakebank' echo ' -f -- start fakebank'
echo ' -g -- start aggregator'
echo ' -h -- print this help' echo ' -h -- print this help'
echo ' -l $LOGLEVEL -- set log level' echo ' -L $LOGLEVEL -- set log level'
echo ' -m -- start merchant' echo ' -m -- start merchant'
echo ' -n -- start nexus' echo ' -n -- start nexus'
echo ' -r $MEX -- which exchange to use at the merchant (optional)' echo ' -r $MEX -- which exchange to use at the merchant (optional)'
@ -117,7 +118,7 @@ while getopts ':abc:d:efghl:mnr:stu:vwW' OPTION; do
g) g)
START_AGGREGATOR="1" START_AGGREGATOR="1"
;; ;;
l) L)
LOGLEVEL="$OPTARG" LOGLEVEL="$OPTARG"
;; ;;
m) m)
@ -249,7 +250,11 @@ then
# Create the default demobank. # Create the default demobank.
echo -n "Configuring sandbox " 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 "DONE"
echo -n "Launching sandbox ... " echo -n "Launching sandbox ... "
export LIBEUFIN_SANDBOX_ADMIN_PASSWORD="secret" export LIBEUFIN_SANDBOX_ADMIN_PASSWORD="secret"
@ -456,7 +461,11 @@ fi
if [ "1" = "$START_WIREWATCH" ] if [ "1" = "$START_WIREWATCH" ]
then then
echo -n "Starting wirewatch ..." 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=$! WIREWATCH_PID=$!
echo " DONE" echo " DONE"
fi fi

View File

@ -28,21 +28,21 @@ PORT = 8081
MASTER_PUBLIC_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG MASTER_PUBLIC_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG
DB = postgres DB = postgres
BASE_URL = "http://localhost:8081/" BASE_URL = "http://localhost:8081/"
EXPIRE_SHARD_SIZE = 300 ms EXPIRE_SHARD_SIZE ="300 ms"
EXPIRE_IDLE_SLEEP_INTERVAL = 1 s EXPIRE_IDLE_SLEEP_INTERVAL ="1 s"
[exchangedb-postgres] [exchangedb-postgres]
CONFIG = "postgres:///talercheck" CONFIG = "postgres:///talercheck"
[taler-exchange-secmod-cs] [taler-exchange-secmod-cs]
LOOKAHEAD_SIGN = 24 days LOOKAHEAD_SIGN = "24 days"
[taler-exchange-secmod-rsa] [taler-exchange-secmod-rsa]
LOOKAHEAD_SIGN = 24 days LOOKAHEAD_SIGN = "24 days"
[taler-exchange-secmod-eddsa] [taler-exchange-secmod-eddsa]
LOOKAHEAD_SIGN = 24 days LOOKAHEAD_SIGN = "24 days"
DURATION = 14 days DURATION = "14 days"
[exchange-account-1] [exchange-account-1]
@ -51,6 +51,7 @@ ENABLE_DEBIT = YES
ENABLE_CREDIT = YES ENABLE_CREDIT = YES
[exchange-accountcredentials-1] [exchange-accountcredentials-1]
WIRE_GATEWAY_AUTH_METHOD = none
WIRE_GATEWAY_URL = "http://localhost:8082/42/" WIRE_GATEWAY_URL = "http://localhost:8082/42/"
[exchange-account-2] [exchange-account-2]

View File

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

View File

@ -128,7 +128,7 @@ batch_traits (void *cls,
{ {
struct BatchState *bs = cls; struct BatchState *bs = cls;
struct TALER_TESTING_Trait traits[] = { 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 () TALER_TESTING_trait_end ()
}; };

View File

@ -131,7 +131,7 @@ analyze_command (void *cls,
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 !=
@ -142,9 +142,9 @@ analyze_command (void *cls,
ac->failure = true; ac->failure = true;
return; 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, analyze_command (ac,
step); step);

View File

@ -122,7 +122,7 @@ analyze_command (void *cls,
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 !=
@ -133,9 +133,9 @@ analyze_command (void *cls,
ac->failure = true; ac->failure = true;
return; 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) 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' */

View File

@ -27,6 +27,19 @@
#include "taler_testing_lib.h" #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. * 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 duration;
struct GNUNET_TIME_Relative lat; 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))
{ {
/* 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); GNUNET_break (0);
}
return; return;
} }
duration = GNUNET_TIME_absolute_get_difference (cmd->start_time, duration = GNUNET_TIME_absolute_get_difference (cmd->start_time,
@ -85,7 +109,7 @@ do_stat (void *cls,
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,19 +118,16 @@ do_stat (void *cls,
GNUNET_break (0); GNUNET_break (0);
return; return;
} }
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]);
return;
} }
else
{
stat_cmd (timings, stat_cmd (timings,
cmd); cmd);
} }
}
/** /**
@ -136,7 +157,7 @@ TALER_TESTING_cmd_stat (struct TALER_TESTING_Timer *timers)
{ {
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.label = "stat", .label = "stat",
.run = stat_run, .run = &stat_run,
.cls = (void *) timers .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,6 +349,7 @@ withdraw_run (void *cls,
const struct TALER_TESTING_Command *create_reserve; const struct TALER_TESTING_Command *create_reserve;
const struct TALER_EXCHANGE_DenomPublicKey *dpk; const struct TALER_EXCHANGE_DenomPublicKey *dpk;
if (NULL != cmd)
ws->cmd = cmd; ws->cmd = cmd;
ws->is = is; ws->is = is;
create_reserve create_reserve

View File

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