From 12aa516024eb13ad5ccde4e176fd6765d3ebb763 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Thu, 11 Apr 2019 00:10:00 +0200 Subject: Fix history CMD loop, + make fakebank demonize. This latter enable us to call the "check-service" CMD against the Fakebank, instead of doing forced X seconds sleep. --- src/bank-lib/test_bank_api_new.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/bank-lib/test_bank_api_new.c') diff --git a/src/bank-lib/test_bank_api_new.c b/src/bank-lib/test_bank_api_new.c index 5031a3089..ab0358c3a 100644 --- a/src/bank-lib/test_bank_api_new.c +++ b/src/bank-lib/test_bank_api_new.c @@ -40,26 +40,27 @@ #define CONFIG_FILE "bank.conf" /** - * Adds to the current time. + * Add seconds. * - * @param relative number of _seconds_ to add to the current time. + * @param base absolute time to add seconds to. + * @param relative number of seconds to add. * @return a new absolute time, modified according to @e relative. */ -#define NOWPLUSSECS(secs) \ +#define ADDSECS(base, secs) \ GNUNET_TIME_absolute_add \ - (now, \ + (base, \ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \ secs)) - /** - * Subtracts from the current time. + * Subtract seconds. * - * @param relative number of _seconds_ to add to the current time. + * @param base absolute time to subtract seconds to. + * @param secs relative number of _seconds_ to subtract. * @return a new absolute time, modified according to @e relative. */ -#define NOWMINUSSECS(secs) \ +#define SUBSECS(base, secs) \ GNUNET_TIME_absolute_subtract \ - (now, \ + (base, \ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \ secs)) /** @@ -84,12 +85,8 @@ run (void *cls, { extern struct TALER_BANK_AuthenticationData AUTHS[]; - struct GNUNET_TIME_Absolute now; + struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Bank serves at `%s'\n", - bank_url); - now = GNUNET_TIME_absolute_get (); struct TALER_TESTING_Command commands[] = { TALER_TESTING_cmd_bank_history ("history-0", @@ -106,9 +103,10 @@ run (void *cls, EXCHANGE_ACCOUNT_NUMBER, TALER_BANK_DIRECTION_BOTH, GNUNET_NO, - NOWMINUSSECS (5), - NOWPLUSSECS (5)), - + SUBSECS (now, + 5), + ADDSECS (now, + 5)), TALER_TESTING_cmd_fakebank_transfer_with_subject ("deposit-1", "KUDOS:5.01", @@ -173,8 +171,10 @@ run (void *cls, EXCHANGE_ACCOUNT_NUMBER, TALER_BANK_DIRECTION_BOTH, GNUNET_NO, - NOWMINUSSECS (5), - NOWPLUSSECS (5)), + SUBSECS (now, + 50), + ADDSECS (now, + 5)), TALER_TESTING_cmd_bank_reject ("reject-1", bank_url, -- cgit v1.2.3