summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-05-03 15:06:20 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2018-05-03 15:06:20 +0200
commit96939050ef7d6afe8f0d6ff5b68dbdd940c1c85e (patch)
tree4a16f36acf205818394cda59f1e070990f6ccf24 /src/lib
parentd89d64100d97b8987521b35fc1d869b9cc65979c (diff)
downloadmerchant-96939050ef7d6afe8f0d6ff5b68dbdd940c1c85e.tar.gz
merchant-96939050ef7d6afe8f0d6ff5b68dbdd940c1c85e.tar.bz2
merchant-96939050ef7d6afe8f0d6ff5b68dbdd940c1c85e.zip
conditions in test code.
It is now possible to use a custom config file and purge the test database only if certains symbols are defined. This is needed for the upcoming payment generator, as it should never purge the database it works on, and supposedly always use the ~/.config/taler.conf default database.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Makefile.am1
-rw-r--r--src/lib/testing_api_helpers.c15
2 files changed, 12 insertions, 4 deletions
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 39acd3ad..dbc0f074 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -127,6 +127,7 @@ test_merchant_api_new_LDADD = \
-lgnunetcurl \
-lgnunetutil \
-ljansson
+test_merchant_api_new_CFLAGS = -DCUSTOM_CONFIG -DPURGE_DATABASE
test_merchant_api_SOURCES = \
test_merchant_api.c
diff --git a/src/lib/testing_api_helpers.c b/src/lib/testing_api_helpers.c
index 43ace621..dbb65bb0 100644
--- a/src/lib/testing_api_helpers.c
+++ b/src/lib/testing_api_helpers.c
@@ -74,7 +74,9 @@ TALER_TESTING_run_merchant (const char *config_filename)
NULL, NULL, NULL,
"taler-merchant-httpd",
"taler-merchant-httpd",
+ #ifdef CUSTOM_CONFIG
"-c", config_filename,
+ #endif
NULL);
if (NULL == merchant_proc)
MERCHANT_FAIL ();
@@ -126,9 +128,6 @@ TALER_TESTING_prepare_merchant (const char *config_filename)
{
struct GNUNET_CONFIGURATION_Handle *cfg;
unsigned long long port;
- struct GNUNET_OS_Process *dbinit_proc;
- enum GNUNET_OS_ProcessStatusType type;
- unsigned long code;
char *base_url;
cfg = GNUNET_CONFIGURATION_create ();
@@ -161,6 +160,11 @@ TALER_TESTING_prepare_merchant (const char *config_filename)
MERCHANT_FAIL ();
}
+ #ifdef PURGE_DATABASE
+ struct GNUNET_OS_Process *dbinit_proc;
+ enum GNUNET_OS_ProcessStatusType type;
+ unsigned long code;
+
/* DB preparation */
if (NULL == (dbinit_proc = GNUNET_OS_start_process
(GNUNET_NO,
@@ -168,7 +172,9 @@ TALER_TESTING_prepare_merchant (const char *config_filename)
NULL, NULL, NULL,
"taler-merchant-dbinit",
"taler-merchant-dbinit",
+ #ifdef CUSTOM_CONFIG
"-c", config_filename,
+ #endif
"-r",
NULL)))
{
@@ -201,8 +207,9 @@ TALER_TESTING_prepare_merchant (const char *config_filename)
" `taler-merchant-dbinit'!\n");
MERCHANT_FAIL ();
}
- GNUNET_OS_process_destroy (dbinit_proc);
+ GNUNET_OS_process_destroy (dbinit_proc);
+ #endif
GNUNET_asprintf (&base_url,