summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bank-lib/fakebank.c4
-rw-r--r--src/bank-lib/test_bank_api_new.c38
-rw-r--r--src/bank-lib/test_bank_api_with_fakebank_twisted.c4
-rw-r--r--src/bank-lib/testing_api_cmd_history.c43
-rw-r--r--src/lib/test_exchange_api_keys_cherry_picking_new.c2
5 files changed, 57 insertions, 34 deletions
diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c
index 1220fa05..a72d978f 100644
--- a/src/bank-lib/fakebank.c
+++ b/src/bank-lib/fakebank.c
@@ -980,7 +980,9 @@ TALER_FAKEBANK_start (uint16_t port)
h = GNUNET_new (struct TALER_FAKEBANK_Handle);
h->mhd_bank = MHD_start_daemon (MHD_USE_DEBUG
#if EPOLL_SUPPORT
- | MHD_USE_EPOLL
+ | MHD_USE_EPOLL_INTERNAL_THREAD
+#else
+ | MHD_USE_INTERNAL_POLLING_THREAD
#endif
| MHD_USE_DUAL_STACK,
port,
diff --git a/src/bank-lib/test_bank_api_new.c b/src/bank-lib/test_bank_api_new.c
index 5031a308..ab0358c3 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,
diff --git a/src/bank-lib/test_bank_api_with_fakebank_twisted.c b/src/bank-lib/test_bank_api_with_fakebank_twisted.c
index 4cf500fb..2b4a5493 100644
--- a/src/bank-lib/test_bank_api_with_fakebank_twisted.c
+++ b/src/bank-lib/test_bank_api_with_fakebank_twisted.c
@@ -82,8 +82,8 @@ run (void *cls,
* Can't use the "wait service" CMD here because the
* fakebank runs inside the same process of the test.
*/
- TALER_TESTING_cmd_sleep ("wait interface",
- 2),
+ TALER_TESTING_cmd_wait_service ("wait-service",
+ TWISTED_BANK_URL),
TALER_TESTING_cmd_bank_history ("history-0",
TWISTED_BANK_URL,
diff --git a/src/bank-lib/testing_api_cmd_history.c b/src/bank-lib/testing_api_cmd_history.c
index a50fd9ba..efaa6a99 100644
--- a/src/bank-lib/testing_api_cmd_history.c
+++ b/src/bank-lib/testing_api_cmd_history.c
@@ -1,4 +1,4 @@
- /*
+/*
This file is part of TALER
Copyright (C) 2018 Taler Systems SA
@@ -354,12 +354,13 @@ build_history (struct TALER_TESTING_Interpreter *is,
(add_incoming_cmd, 0, &row_id_start));
}
- GNUNET_assert ((0 != hs->num_results) ||
- (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us !=
+ GNUNET_assert ((0 != hs->num_results) || /* "/history" */
+ (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us != /* "/history-range" */
hs->start_date.abs_value_us));
if (0 == is->ip)
{
+ TALER_LOG_DEBUG ("Checking history at first CMD..\n");
*rh = NULL;
return 0;
}
@@ -416,14 +417,19 @@ build_history (struct TALER_TESTING_Interpreter *is,
}
/* Seek "/history-range" starting row, _if_ that's the case */
- if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us !=
- hs->start_date.abs_value_us)
+ if ((GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us !=
+ hs->start_date.abs_value_us) && (GNUNET_YES != ok))
{
const struct GNUNET_TIME_Absolute *timestamp;
TALER_TESTING_get_trait_absolute_time (pos,
0,
&timestamp);
+ TALER_LOG_DEBUG
+ ("Seeking first row, start vs timestamp: %llu vs %llu\n",
+ hs->start_date.abs_value_us,
+ timestamp->abs_value_us);
+
if (hs->start_date.abs_value_us <= timestamp->abs_value_us)
{
total = 0;
@@ -436,10 +442,15 @@ build_history (struct TALER_TESTING_Interpreter *is,
if (GNUNET_NO == ok)
continue; /* skip until we find the marker */
+ TALER_LOG_DEBUG ("Found first row\n");
+
if (build_history_hit_limit (total,
hs,
pos))
+ {
+ TALER_LOG_DEBUG ("Hit history limit\n");
break;
+ }
cancelled = test_cancelled (is, off);
@@ -478,11 +489,11 @@ build_history (struct TALER_TESTING_Interpreter *is,
}
}
-
GNUNET_assert (GNUNET_YES == ok);
if (0 == total)
{
+ TALER_LOG_DEBUG ("Checking history at first CMD.. (2)\n");
*rh = NULL;
return 0;
}
@@ -517,8 +528,10 @@ build_history (struct TALER_TESTING_Interpreter *is,
if (*row_id_start == *row_id)
{
- /* Warning: this zeroing is superfluous, as total doesn't
- * get incremented if 'start' was given and couldn't be found.
+ /**
+ * Warning: this zeroing is superfluous, as
+ * total doesn't get incremented if 'start'
+ * was given and couldn't be found.
*/
total = 0;
ok = GNUNET_YES;
@@ -527,14 +540,19 @@ build_history (struct TALER_TESTING_Interpreter *is,
}
/* Seek "/history-range" starting row, _if_ that's the case */
- if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us !=
- hs->start_date.abs_value_us)
+ if ((GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us !=
+ hs->start_date.abs_value_us) && (GNUNET_YES != ok))
{
const struct GNUNET_TIME_Absolute *timestamp;
TALER_TESTING_get_trait_absolute_time (pos,
0,
&timestamp);
+ TALER_LOG_DEBUG
+ ("Seeking first row, start vs timestamp (2): %llu vs %llu\n",
+ hs->start_date.abs_value_us,
+ timestamp->abs_value_us);
+
if (hs->start_date.abs_value_us <= timestamp->abs_value_us)
{
total = 0;
@@ -543,6 +561,8 @@ build_history (struct TALER_TESTING_Interpreter *is,
}
}
+ TALER_LOG_INFO ("Found first row (2)\n");
+
if (GNUNET_NO == ok)
{
TALER_LOG_INFO ("Skip on `%s'\n",
@@ -554,7 +574,7 @@ build_history (struct TALER_TESTING_Interpreter *is,
hs,
pos))
{
- TALER_LOG_INFO ("hit limit specified by command\n");
+ TALER_LOG_INFO ("Hit history limit (2)\n");
break;
}
@@ -1149,6 +1169,7 @@ TALER_TESTING_cmd_bank_history_range_with_dates
hs->account_no = account_no;
hs->direction = direction;
hs->ascending = ascending;
+ hs->start_row_reference = NULL;
hs->start_date = start_date;
hs->end_date = end_date;
diff --git a/src/lib/test_exchange_api_keys_cherry_picking_new.c b/src/lib/test_exchange_api_keys_cherry_picking_new.c
index 916af33f..490961f8 100644
--- a/src/lib/test_exchange_api_keys_cherry_picking_new.c
+++ b/src/lib/test_exchange_api_keys_cherry_picking_new.c
@@ -75,7 +75,7 @@
* @return a new absolute time, modified according to @e relative.
*/
#define SUBSECS(base, secs) \
- GNUNET_TIME_absolute_sub \
+ GNUNET_TIME_absolute_subtract \
(base, \
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \
secs))