diff options
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/.gitignore | 9 | ||||
-rw-r--r-- | src/testing/Makefile.am | 150 | ||||
-rw-r--r-- | src/testing/test_auditor_api.c | 50 | ||||
-rw-r--r-- | src/testing/test_exchange_api.c | 50 | ||||
-rw-r--r-- | src/testing/test_exchange_api_keys_cherry_picking.c | 22 | ||||
-rw-r--r-- | src/testing/test_exchange_api_revocation.c | 32 | ||||
-rw-r--r-- | src/testing/test_exchange_api_twisted.c | 33 |
7 files changed, 244 insertions, 102 deletions
diff --git a/src/testing/.gitignore b/src/testing/.gitignore index 61e3a4c06..700bda4cd 100644 --- a/src/testing/.gitignore +++ b/src/testing/.gitignore @@ -1,13 +1,16 @@ -test_auditor_api_version +test_auditor_api_version_cs +test_auditor_api_version_rsa test_bank_api_with_fakebank test_bank_api_with_fakebank_twisted test_bank_api_with_pybank test_bank_api_with_pybank_twisted test_taler_exchange_aggregator-postgres test_taler_exchange_wirewatch-postgres -test_exchange_api_revocation +test_exchange_api_revocation_cs +test_exchange_api_revocation_rsa report* -test_exchange_management_api +test_exchange_management_api_cs +test_exchange_management_api_rsa test_exchange_api_home/.local/share/taler/crypto-eddsa/ test_exchange_api_home/.local/share/taler/crypto-rsa/ test_exchange_api_home/.local/share/taler/exchange/offline-keys/secm_tofus.priv diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am index bc78217b3..712001750 100644 --- a/src/testing/Makefile.am +++ b/src/testing/Makefile.am @@ -114,16 +114,23 @@ AM_TESTS_ENVIRONMENT=export TALER_PREFIX=$${TALER_PREFIX:-@libdir@};export PATH= .NOTPARALLEL: check_PROGRAMS = \ - test_auditor_api \ - test_auditor_api_version \ + test_auditor_api_cs \ + test_auditor_api_rsa \ + test_auditor_api_version_rsa \ + test_auditor_api_version_cs \ test_bank_api_with_fakebank \ test_bank_api_with_pybank \ test_bank_api_with_nexus \ - test_exchange_api \ - test_exchange_api_keys_cherry_picking \ - test_exchange_api_revocation \ - test_exchange_api_overlapping_keys_bug \ - test_exchange_management_api \ + test_exchange_api_cs \ + test_exchange_api_rsa \ + test_exchange_api_keys_cherry_picking_cs \ + test_exchange_api_keys_cherry_picking_rsa \ + test_exchange_api_revocation_cs \ + test_exchange_api_revocation_rsa \ + test_exchange_api_overlapping_keys_bug_cs \ + test_exchange_api_overlapping_keys_bug_rsa \ + test_exchange_management_api_cs \ + test_exchange_management_api_rsa \ test_kyc_api \ test_taler_exchange_aggregator-postgres \ test_taler_exchange_wirewatch-postgres @@ -139,9 +146,9 @@ endif TESTS = \ $(check_PROGRAMS) -test_auditor_api_SOURCES = \ +test_auditor_api_cs_SOURCES = \ test_auditor_api.c -test_auditor_api_LDADD = \ +test_auditor_api_cs_LDADD = \ $(top_builddir)/src/lib/libtalerauditor.la \ libtalertesting.la \ $(top_builddir)/src/lib/libtalerexchange.la \ @@ -155,10 +162,38 @@ test_auditor_api_LDADD = \ -ljansson \ $(XLIB) +test_auditor_api_rsa_SOURCES = \ + test_auditor_api.c +test_auditor_api_rsa_LDADD = \ + $(top_builddir)/src/lib/libtalerauditor.la \ + libtalertesting.la \ + $(top_builddir)/src/lib/libtalerexchange.la \ + $(LIBGCRYPT_LIBS) \ + $(top_builddir)/src/bank-lib/libtalerfakebank.la \ + $(top_builddir)/src/bank-lib/libtalerbank.la \ + $(top_builddir)/src/json/libtalerjson.la \ + $(top_builddir)/src/util/libtalerutil.la \ + -lgnunetcurl \ + -lgnunetutil \ + -ljansson \ + $(XLIB) + + +test_auditor_api_version_cs_SOURCES = \ + test_auditor_api_version.c +test_auditor_api_version_cs_LDADD = \ + libtalertesting.la \ + $(top_builddir)/src/lib/libtalerauditor.la \ + $(LIBGCRYPT_LIBS) \ + $(top_builddir)/src/util/libtalerutil.la \ + -lgnunetcurl \ + -lgnunetutil \ + -ljansson \ + $(XLIB) -test_auditor_api_version_SOURCES = \ +test_auditor_api_version_rsa_SOURCES = \ test_auditor_api_version.c -test_auditor_api_version_LDADD = \ +test_auditor_api_version_rsa_LDADD = \ libtalertesting.la \ $(top_builddir)/src/lib/libtalerauditor.la \ $(LIBGCRYPT_LIBS) \ @@ -195,9 +230,9 @@ test_bank_api_with_pybank_LDADD = \ $(top_builddir)/src/bank-lib/libtalerbank.la \ $(XLIB) -test_exchange_api_SOURCES = \ +test_exchange_api_cs_SOURCES = \ test_exchange_api.c -test_exchange_api_LDADD = \ +test_exchange_api_cs_LDADD = \ libtalertesting.la \ $(top_builddir)/src/lib/libtalerexchange.la \ $(LIBGCRYPT_LIBS) \ @@ -210,18 +245,52 @@ test_exchange_api_LDADD = \ -ljansson \ $(XLIB) -test_exchange_management_api_SOURCES = \ - test_exchange_management_api.c -test_exchange_management_api_LDADD = \ +test_exchange_api_rsa_SOURCES = \ + test_exchange_api.c +test_exchange_api_rsa_LDADD = \ + libtalertesting.la \ + $(top_builddir)/src/lib/libtalerexchange.la \ + $(LIBGCRYPT_LIBS) \ + $(top_builddir)/src/bank-lib/libtalerfakebank.la \ + $(top_builddir)/src/bank-lib/libtalerbank.la \ + $(top_builddir)/src/json/libtalerjson.la \ + $(top_builddir)/src/util/libtalerutil.la \ + -lgnunetcurl \ + -lgnunetutil \ + -ljansson \ + $(XLIB) + +test_exchange_api_keys_cherry_picking_cs_SOURCES = \ + test_exchange_api_keys_cherry_picking.c +test_exchange_api_keys_cherry_picking_cs_LDADD = \ libtalertesting.la \ $(top_builddir)/src/lib/libtalerexchange.la \ + $(LIBGCRYPT_LIBS) \ + $(top_builddir)/src/json/libtalerjson.la \ $(top_builddir)/src/util/libtalerutil.la \ + $(top_builddir)/src/bank-lib/libtalerbank.la \ + -lgnunetcurl \ -lgnunetutil \ + -ljansson \ $(XLIB) -test_exchange_api_revocation_SOURCES = \ +test_exchange_api_keys_cherry_picking_rsa_SOURCES = \ + test_exchange_api_keys_cherry_picking.c +test_exchange_api_keys_cherry_picking_rsa_LDADD = \ + libtalertesting.la \ + $(top_builddir)/src/lib/libtalerexchange.la \ + $(LIBGCRYPT_LIBS) \ + $(top_builddir)/src/json/libtalerjson.la \ + $(top_builddir)/src/util/libtalerutil.la \ + $(top_builddir)/src/bank-lib/libtalerbank.la \ + -lgnunetcurl \ + -lgnunetutil \ + -ljansson \ + $(XLIB) + +test_exchange_api_revocation_cs_SOURCES = \ test_exchange_api_revocation.c -test_exchange_api_revocation_LDADD = \ +test_exchange_api_revocation_cs_LDADD = \ libtalertesting.la \ $(top_builddir)/src/lib/libtalerexchange.la \ $(LIBGCRYPT_LIBS) \ @@ -234,9 +303,25 @@ test_exchange_api_revocation_LDADD = \ -ljansson \ $(XLIB) -test_exchange_api_keys_cherry_picking_SOURCES = \ - test_exchange_api_keys_cherry_picking.c -test_exchange_api_keys_cherry_picking_LDADD = \ +test_exchange_api_revocation_rsa_SOURCES = \ + test_exchange_api_revocation.c +test_exchange_api_revocation_rsa_LDADD = \ + libtalertesting.la \ + $(top_builddir)/src/lib/libtalerexchange.la \ + $(LIBGCRYPT_LIBS) \ + $(top_builddir)/src/bank-lib/libtalerfakebank.la \ + $(top_builddir)/src/bank-lib/libtalerbank.la \ + $(top_builddir)/src/json/libtalerjson.la \ + $(top_builddir)/src/util/libtalerutil.la \ + -lgnunetcurl \ + -lgnunetutil \ + -ljansson \ + $(XLIB) + + +test_exchange_api_overlapping_keys_bug_cs_SOURCES = \ + test_exchange_api_overlapping_keys_bug.c +test_exchange_api_overlapping_keys_bug_cs_LDADD = \ libtalertesting.la \ $(top_builddir)/src/lib/libtalerexchange.la \ $(LIBGCRYPT_LIBS) \ @@ -248,9 +333,9 @@ test_exchange_api_keys_cherry_picking_LDADD = \ -ljansson \ $(XLIB) -test_exchange_api_overlapping_keys_bug_SOURCES = \ +test_exchange_api_overlapping_keys_bug_rsa_SOURCES = \ test_exchange_api_overlapping_keys_bug.c -test_exchange_api_overlapping_keys_bug_LDADD = \ +test_exchange_api_overlapping_keys_bug_rsa_LDADD = \ libtalertesting.la \ $(top_builddir)/src/lib/libtalerexchange.la \ $(LIBGCRYPT_LIBS) \ @@ -262,6 +347,25 @@ test_exchange_api_overlapping_keys_bug_LDADD = \ -ljansson \ $(XLIB) +test_exchange_management_api_cs_SOURCES = \ + test_exchange_management_api.c +test_exchange_management_api_cs_LDADD = \ + libtalertesting.la \ + $(top_builddir)/src/lib/libtalerexchange.la \ + $(top_builddir)/src/util/libtalerutil.la \ + -lgnunetutil \ + $(XLIB) + +test_exchange_management_api_rsa_SOURCES = \ + test_exchange_management_api.c +test_exchange_management_api_rsa_LDADD = \ + libtalertesting.la \ + $(top_builddir)/src/lib/libtalerexchange.la \ + $(top_builddir)/src/util/libtalerutil.la \ + -lgnunetutil \ + $(XLIB) + + test_taler_exchange_aggregator_postgres_SOURCES = \ test_taler_exchange_aggregator.c test_taler_exchange_aggregator_postgres_LDADD = \ diff --git a/src/testing/test_auditor_api.c b/src/testing/test_auditor_api.c index 90675dd92..6f3b220b6 100644 --- a/src/testing/test_auditor_api.c +++ b/src/testing/test_auditor_api.c @@ -39,10 +39,9 @@ * Configuration file we use. One (big) configuration is used * for the various components for this test. */ -#define CONFIG_FILE "test_auditor_api.conf" +static char *config_file; -#define CONFIG_FILE_EXPIRE_RESERVE_NOW \ - "test_auditor_api_expire_reserve_now.conf" +static char *config_file_expire_reserve_now; /** * Exchange configuration data. @@ -61,7 +60,7 @@ static struct TALER_TESTING_BankConfiguration bc; * @param label label to use for the command. */ #define CMD_EXEC_WIREWATCH(label) \ - TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE) + TALER_TESTING_cmd_exec_wirewatch (label, config_file) /** * Execute the taler-exchange-aggregator, closer and transfer commands with @@ -71,8 +70,8 @@ static struct TALER_TESTING_BankConfiguration bc; */ #define CMD_EXEC_AGGREGATOR(label) \ TALER_TESTING_cmd_sleep (label "-sleep", 1), \ - TALER_TESTING_cmd_exec_aggregator (label, CONFIG_FILE), \ - TALER_TESTING_cmd_exec_transfer (label, CONFIG_FILE) + TALER_TESTING_cmd_exec_aggregator (label, config_file), \ + TALER_TESTING_cmd_exec_transfer (label, config_file) /** * Run wire transfer of funds from some user's account to the @@ -92,7 +91,7 @@ static struct TALER_TESTING_BankConfiguration bc; * @param label label to use for the command. */ #define CMD_RUN_AUDITOR(label) \ - TALER_TESTING_cmd_exec_auditor (label, CONFIG_FILE) + TALER_TESTING_cmd_exec_auditor (label, config_file) /** @@ -406,7 +405,7 @@ run (void *cls, TALER_TESTING_cmd_revoke ("revoke-1", MHD_HTTP_OK, "recoup-withdraw-coin-1", - CONFIG_FILE), + config_file), TALER_TESTING_cmd_recoup ("recoup-1", MHD_HTTP_OK, "recoup-withdraw-coin-1", @@ -426,9 +425,9 @@ run (void *cls, CMD_TRANSFER_TO_EXCHANGE ("short-lived-reserve", "EUR:5.01"), TALER_TESTING_cmd_exec_wirewatch ("short-lived-aggregation", - CONFIG_FILE_EXPIRE_RESERVE_NOW), + config_file_expire_reserve_now), TALER_TESTING_cmd_exec_aggregator ("close-reserves", - CONFIG_FILE_EXPIRE_RESERVE_NOW), + config_file_expire_reserve_now), /** * Fill reserve with EUR:2.02, as withdraw fee is 1 ct per * config, then withdraw two coin, partially spend one, and @@ -466,7 +465,7 @@ run (void *cls, TALER_TESTING_cmd_revoke ("revoke-2", MHD_HTTP_OK, "recoup-withdraw-coin-2a", - CONFIG_FILE), + config_file), TALER_TESTING_cmd_recoup ("recoup-2", MHD_HTTP_OK, "recoup-withdraw-coin-2a", @@ -631,7 +630,7 @@ run (void *cls, struct TALER_TESTING_Command commands[] = { TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", - CONFIG_FILE, + config_file, "EUR:0.01", "EUR:0.01"), TALER_TESTING_cmd_auditor_add ("add-auditor-OK", @@ -642,11 +641,11 @@ run (void *cls, MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", - CONFIG_FILE), + config_file), TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys", 2), TALER_TESTING_cmd_exec_auditor_offline ("auditor-offline", - CONFIG_FILE), + config_file), CMD_RUN_AUDITOR ("virgin-auditor"), TALER_TESTING_cmd_exchanges_with_url ("check-exchange", MHD_HTTP_OK, @@ -682,25 +681,36 @@ int main (int argc, char *const *argv) { + const char *cipher; + (void) argc; - (void) argv; /* These environment variables get in the way... */ unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_CONFIG_HOME"); - GNUNET_log_setup ("test-auditor-api", + GNUNET_log_setup (argv[0], "INFO", NULL); + /* Check fakebank port is available and get configuration data. */ if (GNUNET_OK != - TALER_TESTING_prepare_fakebank (CONFIG_FILE, + TALER_TESTING_prepare_fakebank (config_file, "exchange-account-2", &bc)) return 77; - TALER_TESTING_cleanup_files (CONFIG_FILE); + cipher = GNUNET_TESTING_get_testname_from_underscore (argv[0]); + GNUNET_assert (NULL != cipher); + GNUNET_asprintf (&config_file, + "test_auditor_api-%s.conf", + cipher); + GNUNET_asprintf (&config_file_expire_reserve_now, + "test_auditor_api_expire_reserve_now-%s.conf", + cipher); + + TALER_TESTING_cleanup_files (config_file); /* @helpers. Run keyup, create tables, ... Note: it * fetches the port number from config in order to see * if it's available. */ - switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, + switch (TALER_TESTING_prepare_exchange (config_file, GNUNET_YES, &ec)) { @@ -717,7 +727,7 @@ main (int argc, */ TALER_TESTING_auditor_setup (&run, NULL, - CONFIG_FILE)) + config_file)) return 1; break; default: diff --git a/src/testing/test_exchange_api.c b/src/testing/test_exchange_api.c index ac5dfdc00..bae57fa66 100644 --- a/src/testing/test_exchange_api.c +++ b/src/testing/test_exchange_api.c @@ -38,10 +38,9 @@ * Configuration file we use. One (big) configuration is used * for the various components for this test. */ -#define CONFIG_FILE "test_exchange_api.conf" +static char *config_file; -#define CONFIG_FILE_EXPIRE_RESERVE_NOW \ - "test_exchange_api_expire_reserve_now.conf" +static char *config_file_expire_reserve_now; /** @@ -62,7 +61,7 @@ static struct TALER_TESTING_BankConfiguration bc; * @param label label to use for the command. */ #define CMD_EXEC_WIREWATCH(label) \ - TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE) + TALER_TESTING_cmd_exec_wirewatch (label, config_file) /** * Execute the taler-exchange-aggregator, closer and transfer commands with @@ -71,8 +70,8 @@ static struct TALER_TESTING_BankConfiguration bc; * @param label label to use for the command. */ #define CMD_EXEC_AGGREGATOR(label) \ - TALER_TESTING_cmd_exec_aggregator (label "-aggregator", CONFIG_FILE), \ - TALER_TESTING_cmd_exec_transfer (label "-transfer", CONFIG_FILE) + TALER_TESTING_cmd_exec_aggregator (label "-aggregator", config_file), \ + TALER_TESTING_cmd_exec_transfer (label "-transfer", config_file) /** @@ -679,7 +678,7 @@ run (void *cls, TALER_TESTING_cmd_revoke ("revoke-0-EUR:5", MHD_HTTP_OK, "recoup-withdraw-coin-1", - CONFIG_FILE), + config_file), /* Recoup coin to reserve */ TALER_TESTING_cmd_recoup ("recoup-1", MHD_HTTP_OK, @@ -779,14 +778,14 @@ run (void *cls, bc.exchange_payto, "short-lived-reserve"), TALER_TESTING_cmd_exec_wirewatch ("short-lived-aggregation", - CONFIG_FILE_EXPIRE_RESERVE_NOW), + config_file_expire_reserve_now), TALER_TESTING_cmd_exec_closer ("close-reserves", - CONFIG_FILE_EXPIRE_RESERVE_NOW, + config_file_expire_reserve_now, "EUR:5", "EUR:0.01", "short-lived-reserve"), TALER_TESTING_cmd_exec_transfer ("close-reserves-transfer", - CONFIG_FILE_EXPIRE_RESERVE_NOW), + config_file_expire_reserve_now), TALER_TESTING_cmd_status ("short-lived-status", "short-lived-reserve", @@ -836,7 +835,7 @@ run (void *cls, TALER_TESTING_cmd_revoke ("revoke-1-EUR:1", MHD_HTTP_OK, "recoup-withdraw-coin-2a", - CONFIG_FILE), + config_file), /* Check recoup is failing for the coin with the reused coin key */ TALER_TESTING_cmd_recoup ("recoup-2x", MHD_HTTP_CONFLICT, @@ -1047,10 +1046,10 @@ run (void *cls, "EUR:20"); reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 1] = TALER_TESTING_cmd_exec_wirewatch ("reserve-open-close-wirewatch", - CONFIG_FILE_EXPIRE_RESERVE_NOW); + config_file_expire_reserve_now); reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 2] = TALER_TESTING_cmd_exec_closer ("reserve-open-close-aggregation", - CONFIG_FILE_EXPIRE_RESERVE_NOW, + config_file_expire_reserve_now, "EUR:19.99", "EUR:0.01", "reserve-open-close-key"); @@ -1074,9 +1073,9 @@ run (void *cls, MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", - CONFIG_FILE), + config_file), TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", - CONFIG_FILE, + config_file, "EUR:0.01", "EUR:0.01"), TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys", @@ -1123,25 +1122,34 @@ int main (int argc, char *const *argv) { + const char *cipher; + (void) argc; - (void) argv; /* These environment variables get in the way... */ unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_CONFIG_HOME"); - GNUNET_log_setup ("test-exchange-api", + GNUNET_log_setup (argv[0], "INFO", NULL); + cipher = GNUNET_TESTING_get_testname_from_underscore (argv[0]); + GNUNET_assert (NULL != cipher); + GNUNET_asprintf (&config_file, + "test_exchange_api-%s.conf", + cipher); + GNUNET_asprintf (&config_file_expire_reserve_now, + "test_exchange_api_expire_reserve_now-%s.conf", + cipher); /* Check fakebank port is available and get config */ if (GNUNET_OK != - TALER_TESTING_prepare_fakebank (CONFIG_FILE, + TALER_TESTING_prepare_fakebank (config_file, "exchange-account-2", &bc)) return 77; - TALER_TESTING_cleanup_files (CONFIG_FILE); + TALER_TESTING_cleanup_files (config_file); /* @helpers. Run keyup, create tables, ... Note: it * fetches the port number from config in order to see * if it's available. */ - switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, + switch (TALER_TESTING_prepare_exchange (config_file, GNUNET_YES, &ec)) { @@ -1158,7 +1166,7 @@ main (int argc, */ TALER_TESTING_setup_with_exchange (&run, NULL, - CONFIG_FILE)) + config_file)) return 1; break; default: diff --git a/src/testing/test_exchange_api_keys_cherry_picking.c b/src/testing/test_exchange_api_keys_cherry_picking.c index 6ab17c634..2a7dea14d 100644 --- a/src/testing/test_exchange_api_keys_cherry_picking.c +++ b/src/testing/test_exchange_api_keys_cherry_picking.c @@ -39,7 +39,7 @@ lished * Configuration file we use. One (big) configuration is used * for the various components for this test. */ -#define CONFIG_FILE "test_exchange_api_keys_cherry_picking.conf" +static char *config_file; /** * Exchange configuration data. @@ -66,11 +66,11 @@ run (void *cls, MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", - CONFIG_FILE, + config_file, "EUR:0.01", "EUR:0.01"), TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", - CONFIG_FILE), + config_file), TALER_TESTING_cmd_check_keys_pull_all_keys ("initial-/keys", 1), TALER_TESTING_cmd_sleep ("sleep", @@ -109,19 +109,25 @@ int main (int argc, char *const *argv) { + const char *cipher; + (void) argc; - (void) argv; /* These environment variables get in the way... */ unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_CONFIG_HOME"); - GNUNET_log_setup ("test-exchange-api-cherry-picking", + GNUNET_log_setup (argv[0], "DEBUG", NULL); - TALER_TESTING_cleanup_files (CONFIG_FILE); + cipher = GNUNET_TESTING_get_testname_from_underscore (argv[0]); + GNUNET_assert (NULL != cipher); + GNUNET_asprintf (&config_file, + "test_exchange_api_keys_cherry_picking-%s.conf", + cipher); + TALER_TESTING_cleanup_files (config_file); /* @helpers. Run keyup, create tables, ... Note: it * fetches the port number from config in order to see * if it's available. */ - switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, + switch (TALER_TESTING_prepare_exchange (config_file, GNUNET_YES, &ec)) { @@ -138,7 +144,7 @@ main (int argc, */ TALER_TESTING_setup_with_exchange (&run, NULL, - CONFIG_FILE)) + config_file)) return 1; break; default: diff --git a/src/testing/test_exchange_api_revocation.c b/src/testing/test_exchange_api_revocation.c index 0531c5b83..40bc4d536 100644 --- a/src/testing/test_exchange_api_revocation.c +++ b/src/testing/test_exchange_api_revocation.c @@ -38,7 +38,7 @@ * Configuration file we use. One (big) configuration is used * for the various components for this test. */ -#define CONFIG_FILE "test_exchange_api.conf" +static char *config_file; /** * Exchange configuration data. @@ -70,7 +70,7 @@ run (void *cls, MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", - CONFIG_FILE), + config_file), TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys", 1), /** @@ -90,7 +90,7 @@ run (void *cls, * Run wire-watch to trigger the reserve creation. */ TALER_TESTING_cmd_exec_wirewatch ("wirewatch-4", - CONFIG_FILE), + config_file), /* Withdraw a 5 EUR coin, at fee of 1 ct */ TALER_TESTING_cmd_withdraw_amount ("withdraw-revocation-coin-1", "create-reserve-1", @@ -144,12 +144,12 @@ run (void *cls, TALER_TESTING_cmd_revoke ("revoke-2-EUR:5", MHD_HTTP_OK, "refresh-melt-1", - CONFIG_FILE), + config_file), /* Also make fully spent coin invalid (should be same denom) */ TALER_TESTING_cmd_revoke ("revoke-2-EUR:5", MHD_HTTP_OK, "withdraw-revocation-coin-2", - CONFIG_FILE), + config_file), /* Refund fully spent coin (which should fail) */ TALER_TESTING_cmd_recoup ("recoup-fully-spent", MHD_HTTP_CONFLICT, @@ -211,12 +211,12 @@ run (void *cls, TALER_TESTING_cmd_revoke ("revoke-3-EUR:0.1", MHD_HTTP_OK, "refresh-reveal-2", - CONFIG_FILE), + config_file), /* Revoke also original coin denomination */ TALER_TESTING_cmd_revoke ("revoke-4-EUR:5", MHD_HTTP_OK, "withdraw-revocation-coin-1", - CONFIG_FILE), + config_file), /* Refund coin EUR:0.1 to original coin, creating zombie! */ TALER_TESTING_cmd_recoup_refresh ("recoup-2", MHD_HTTP_OK, @@ -248,25 +248,31 @@ int main (int argc, char *const *argv) { + const char *cipher; + (void) argc; - (void) argv; /* These environment variables get in the way... */ unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_CONFIG_HOME"); - GNUNET_log_setup ("test-exchange-api-revocation", + GNUNET_log_setup (argv[0], "INFO", NULL); + cipher = GNUNET_TESTING_get_testname_from_underscore (argv[0]); + GNUNET_assert (NULL != cipher); + GNUNET_asprintf (&config_file, + "test_exchange_api-%s.conf", + cipher); /* Check fakebank port is available and get config */ if (GNUNET_OK != - TALER_TESTING_prepare_fakebank (CONFIG_FILE, + TALER_TESTING_prepare_fakebank (config_file, "exchange-account-2", &bc)) return 77; - TALER_TESTING_cleanup_files (CONFIG_FILE); + TALER_TESTING_cleanup_files (config_file); /* @helpers. Run keyup, create tables, ... Note: it * fetches the port number from config in order to see * if it's available. */ - switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, + switch (TALER_TESTING_prepare_exchange (config_file, GNUNET_YES, &ec)) { @@ -283,7 +289,7 @@ main (int argc, */ TALER_TESTING_setup_with_exchange (&run, NULL, - CONFIG_FILE)) + config_file)) return 1; break; default: diff --git a/src/testing/test_exchange_api_twisted.c b/src/testing/test_exchange_api_twisted.c index 02471eb91..2f4ba3a22 100644 --- a/src/testing/test_exchange_api_twisted.c +++ b/src/testing/test_exchange_api_twisted.c @@ -40,7 +40,7 @@ * Configuration file we use. One (big) configuration is used * for the various components for this test. */ -#define CONFIG_FILE "test_exchange_api_twisted.conf" +static char *config_file; /** * (real) Twister URL. Used at startup time to check if it runs. @@ -73,7 +73,7 @@ static struct TALER_TESTING_Command CMD_EXEC_WIREWATCH (const char *label) { return TALER_TESTING_cmd_exec_wirewatch (label, - CONFIG_FILE); + config_file); } @@ -142,7 +142,7 @@ run (void *cls, NULL), /* Trigger 409 Conflict. */ TALER_TESTING_cmd_flip_upload ("flip-upload", - CONFIG_FILE, + config_file, "transfer_privs.0"), TALER_TESTING_cmd_refresh_reveal ("refresh-(flipped-)reveal", "refresh-melt", @@ -178,7 +178,7 @@ run (void *cls, "USD:5", "deposit-refund-1"), TALER_TESTING_cmd_flip_upload ("flip-upload", - CONFIG_FILE, + config_file, "merchant_sig"), TALER_TESTING_cmd_refund ("refund-bad-sig", MHD_HTTP_FORBIDDEN, @@ -217,7 +217,7 @@ run (void *cls, */ struct TALER_TESTING_Command expired_keys[] = { TALER_TESTING_cmd_modify_header_dl ("modify-expiration", - CONFIG_FILE, + config_file, MHD_HTTP_HEADER_EXPIRES, "Wed, 19 Jan 586524 08:01:49 GMT"), TALER_TESTING_cmd_check_keys_pull_all_keys ( @@ -243,7 +243,7 @@ run (void *cls, MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", - CONFIG_FILE), + config_file), TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys", 1), TALER_TESTING_cmd_batch ("refresh-reveal-409-conflict", @@ -283,26 +283,31 @@ int main (int argc, char *const *argv) { + const char *cipher; int ret; (void) argc; - (void) argv; /* These environment variables get in the way... */ unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_CONFIG_HOME"); - GNUNET_log_setup ("test-exchange-api-twisted", + GNUNET_log_setup (argv[0], "DEBUG", NULL); + cipher = GNUNET_TESTING_get_testname_from_underscore (argv[0]); + GNUNET_assert (NULL != cipher); + GNUNET_asprintf (&config_file, + "test_exchange_api_twisted-%s.conf", + cipher); if (GNUNET_OK != - TALER_TESTING_prepare_fakebank (CONFIG_FILE, + TALER_TESTING_prepare_fakebank (config_file, "exchange-account-2", &bc)) return 77; if (NULL == (twister_url = TALER_TWISTER_prepare_twister - (CONFIG_FILE))) + (config_file))) return 77; - TALER_TESTING_cleanup_files (CONFIG_FILE); - switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, + TALER_TESTING_cleanup_files (config_file); + switch (TALER_TESTING_prepare_exchange (config_file, GNUNET_YES, &ec)) { @@ -312,11 +317,11 @@ main (int argc, case GNUNET_NO: return 77; case GNUNET_OK: - if (NULL == (twisterd = TALER_TWISTER_run_twister (CONFIG_FILE))) + if (NULL == (twisterd = TALER_TWISTER_run_twister (config_file))) return 77; ret = TALER_TESTING_setup_with_exchange (&run, NULL, - CONFIG_FILE); + config_file); purge_process (twisterd); GNUNET_free (twister_url); |