diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-03-19 21:44:54 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-03-19 21:44:54 +0100 |
commit | 7a1c6769e428f6f8bb413fb74383c82e16871d2c (patch) | |
tree | 049947c0cac5cc5a70996683df7bd88b4e51c593 /src/testing | |
parent | f76e7c46e6609d39d5b28cb489a946833ca58bfb (diff) |
enable using python bank with benchmark
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/test_bank_api.c | 1 | ||||
-rw-r--r-- | src/testing/test_bank_api_twisted.c | 1 | ||||
-rw-r--r-- | src/testing/testing_api_helpers_bank.c | 97 |
3 files changed, 53 insertions, 46 deletions
diff --git a/src/testing/test_bank_api.c b/src/testing/test_bank_api.c index 75e22b59e..b0b61a166 100644 --- a/src/testing/test_bank_api.c +++ b/src/testing/test_bank_api.c @@ -171,6 +171,7 @@ main (int argc, cfgfilename = CONFIG_FILE_PYBANK; if (GNUNET_OK != TALER_TESTING_prepare_bank (CONFIG_FILE_PYBANK, + GNUNET_YES, "exchange-account-2", &bc)) { diff --git a/src/testing/test_bank_api_twisted.c b/src/testing/test_bank_api_twisted.c index 4ec4a1b9e..c2382db96 100644 --- a/src/testing/test_bank_api_twisted.c +++ b/src/testing/test_bank_api_twisted.c @@ -177,6 +177,7 @@ main (int argc, TALER_LOG_DEBUG ("Running against the Pybank.\n"); if (GNUNET_OK != TALER_TESTING_prepare_bank (cfgfilename, + GNUNET_YES, "exchange-account-2", &bc)) { diff --git a/src/testing/testing_api_helpers_bank.c b/src/testing/testing_api_helpers_bank.c index 3cfb693ae..30813da71 100644 --- a/src/testing/testing_api_helpers_bank.c +++ b/src/testing/testing_api_helpers_bank.c @@ -169,7 +169,7 @@ TALER_TESTING_run_bank (const char *config_filename, GNUNET_free (serve_cfg); bank_proc = GNUNET_OS_start_process (GNUNET_NO, - GNUNET_OS_INHERIT_STD_ALL, + GNUNET_OS_INHERIT_STD_NONE, NULL, NULL, NULL, "taler-bank-manage-testing", "taler-bank-manage-testing", @@ -222,6 +222,7 @@ TALER_TESTING_run_bank (const char *config_filename, * and reset database. * * @param config_filename configuration file name. + * @param reset_db should we reset the bank's database * @param config_section section of the configuration with the exchange's account * @param[out] bc set to the bank's configuration data * @return the base url, or NULL upon errors. Must be freed @@ -229,6 +230,7 @@ TALER_TESTING_run_bank (const char *config_filename, */ int TALER_TESTING_prepare_bank (const char *config_filename, + int reset_db, const char *config_section, struct TALER_TESTING_BankConfiguration *bc) { @@ -305,56 +307,59 @@ TALER_TESTING_prepare_bank (const char *config_filename, } /* DB preparation */ - if (NULL == - (dbreset_proc = GNUNET_OS_start_process ( - GNUNET_NO, - GNUNET_OS_INHERIT_STD_ALL, - NULL, NULL, NULL, - "taler-bank-manage", - "taler-bank-manage", - "-c", config_filename, - "--with-db", database, - "django", - "flush", - "--no-input", NULL))) + if (GNUNET_YES == reset_db) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to flush the bank db.\n"); + if (NULL == + (dbreset_proc = GNUNET_OS_start_process ( + GNUNET_NO, + GNUNET_OS_INHERIT_STD_NONE, + NULL, NULL, NULL, + "taler-bank-manage", + "taler-bank-manage", + "-c", config_filename, + "--with-db", database, + "django", + "flush", + "--no-input", NULL))) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to flush the bank db.\n"); + GNUNET_free (database); + GNUNET_CONFIGURATION_destroy (cfg); + return GNUNET_SYSERR; + } GNUNET_free (database); - GNUNET_CONFIGURATION_destroy (cfg); - return GNUNET_SYSERR; - } - GNUNET_free (database); - if (GNUNET_SYSERR == - GNUNET_OS_process_wait_status (dbreset_proc, - &type, - &code)) - { + if (GNUNET_SYSERR == + GNUNET_OS_process_wait_status (dbreset_proc, + &type, + &code)) + { + GNUNET_OS_process_destroy (dbreset_proc); + GNUNET_break (0); + GNUNET_CONFIGURATION_destroy (cfg); + return GNUNET_SYSERR; + } + if ( (type == GNUNET_OS_PROCESS_EXITED) && + (0 != code) ) + { + fprintf (stderr, + "Failed to setup database\n"); + GNUNET_break (0); + GNUNET_CONFIGURATION_destroy (cfg); + return GNUNET_SYSERR; + } + if ( (type != GNUNET_OS_PROCESS_EXITED) || + (0 != code) ) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Unexpected error running `taler-bank-manage django flush'!\n"); + GNUNET_break (0); + GNUNET_CONFIGURATION_destroy (cfg); + return GNUNET_SYSERR; + } GNUNET_OS_process_destroy (dbreset_proc); - GNUNET_break (0); - GNUNET_CONFIGURATION_destroy (cfg); - return GNUNET_SYSERR; - } - if ( (type == GNUNET_OS_PROCESS_EXITED) && - (0 != code) ) - { - fprintf (stderr, - "Failed to setup database\n"); - GNUNET_break (0); - GNUNET_CONFIGURATION_destroy (cfg); - return GNUNET_SYSERR; - } - if ( (type != GNUNET_OS_PROCESS_EXITED) || - (0 != code) ) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected error running `taler-bank-manage django flush'!\n"); - GNUNET_break (0); - GNUNET_CONFIGURATION_destroy (cfg); - return GNUNET_SYSERR; } - GNUNET_OS_process_destroy (dbreset_proc); if (GNUNET_OK != TALER_BANK_auth_parse_cfg (cfg, config_section, |