From 4f713b40e3571fef9f29fa8c16043a9dd7d8b841 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Fri, 17 Apr 2020 00:32:18 +0200 Subject: Prepare and launch Nexus for tests. --- src/testing/test_bank_api.c | 47 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-) (limited to 'src/testing/test_bank_api.c') diff --git a/src/testing/test_bank_api.c b/src/testing/test_bank_api.c index b0b61a166..9d182f293 100644 --- a/src/testing/test_bank_api.c +++ b/src/testing/test_bank_api.c @@ -35,6 +35,7 @@ #define CONFIG_FILE_FAKEBANK "test_bank_api_fakebank.conf" #define CONFIG_FILE_PYBANK "test_bank_api_pybank.conf" +#define CONFIG_FILE_NEXUS "test_bank_api_nexus.conf" /** * Bank configuration data. @@ -141,8 +142,8 @@ int main (int argc, char *const *argv) { - const char *cfgfilename; int rv; + const char *cfgfile; /* These environment variables get in the way... */ unsetenv ("XDG_DATA_HOME"); @@ -150,12 +151,12 @@ main (int argc, GNUNET_log_setup ("test-bank-api", "DEBUG", NULL); - with_fakebank = TALER_TESTING_has_in_name (argv[0], - "_with_fakebank"); - if (GNUNET_YES == with_fakebank) + + if (GNUNET_YES == TALER_TESTING_has_in_name (argv[0], + "_with_fakebank")) { TALER_LOG_DEBUG ("Running against the Fakebank.\n"); - cfgfilename = CONFIG_FILE_FAKEBANK; + cfgfile = CONFIG_FILE_FAKEBANK; if (GNUNET_OK != TALER_TESTING_prepare_fakebank (CONFIG_FILE_FAKEBANK, "exchange-account-2", @@ -165,10 +166,11 @@ main (int argc, return 77; } } - else + else if (GNUNET_YES == TALER_TESTING_has_in_name (argv[0], + "_with_pybank")) { TALER_LOG_DEBUG ("Running against the Pybank.\n"); - cfgfilename = CONFIG_FILE_PYBANK; + cfgfile = CONFIG_FILE_FAKEBANK; if (GNUNET_OK != TALER_TESTING_prepare_bank (CONFIG_FILE_PYBANK, GNUNET_YES, @@ -186,9 +188,38 @@ main (int argc, GNUNET_break (0); return 77; } + } else if (GNUNET_YES == TALER_TESTING_has_in_name (argv[0], + "_with_nexus")) + { + TALER_LOG_DEBUG ("Running against Nexus.\n"); + cfgfile = CONFIG_FILE_FAKEBANK; + if (GNUNET_OK != TALER_TESTING_prepare_nexus (CONFIG_FILE_NEXUS, + GNUNET_YES, + "exchange-account-2", + &bc)) + { + GNUNET_break (0); + return 77; + } + if (NULL == (bankd = TALER_TESTING_run_nexus (&bc))) + { + GNUNET_break (0); + return 77; + } + GNUNET_OS_process_kill (bankd, + SIGKILL); + GNUNET_OS_process_wait (bankd); + GNUNET_OS_process_destroy (bankd); + return 99; } + else + { + GNUNET_break (0); + return 77; + } + if (GNUNET_OK != - GNUNET_CONFIGURATION_parse_and_run (cfgfilename, + GNUNET_CONFIGURATION_parse_and_run (cfgfile, &setup_with_cfg, NULL)) rv = 1; -- cgit v1.2.3