aboutsummaryrefslogtreecommitdiff
path: root/src/exchange-lib
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-08-09 21:10:56 +0200
committerChristian Grothoff <christian@grothoff.org>2018-08-09 21:10:56 +0200
commitc51b19512bfc5bf3848211e6a4e9f3534ece7ee2 (patch)
tree46f5506ca113129e5a36897be25ca898a08c6866 /src/exchange-lib
parente3f7083b3eb39ed28eee27b6104a3a508437c929 (diff)
downloadexchange-c51b19512bfc5bf3848211e6a4e9f3534ece7ee2.tar.xz
report ore precisely where commands went wrong
Diffstat (limited to 'src/exchange-lib')
-rw-r--r--src/exchange-lib/testing_api_cmd_batch.c13
-rw-r--r--src/exchange-lib/testing_api_cmd_deposit.c6
-rw-r--r--src/exchange-lib/testing_api_cmd_payback.c6
-rw-r--r--src/exchange-lib/testing_api_cmd_refresh.c25
-rw-r--r--src/exchange-lib/testing_api_cmd_refund.c6
-rw-r--r--src/exchange-lib/testing_api_cmd_status.c6
-rw-r--r--src/exchange-lib/testing_api_cmd_track.c14
-rw-r--r--src/exchange-lib/testing_api_cmd_withdraw.c10
8 files changed, 56 insertions, 30 deletions
diff --git a/src/exchange-lib/testing_api_cmd_batch.c b/src/exchange-lib/testing_api_cmd_batch.c
index 3912762f1..738012b80 100644
--- a/src/exchange-lib/testing_api_cmd_batch.c
+++ b/src/exchange-lib/testing_api_cmd_batch.c
@@ -33,10 +33,14 @@
*/
struct BatchState
{
- /* CMDs batch. */
+ /**
+ * CMDs batch.
+ */
struct TALER_TESTING_Command *batch;
- /* Internal comand pointer. */
+ /**
+ * Internal comand pointer.
+ */
int batch_ip;
};
@@ -56,7 +60,6 @@ batch_run (void *cls,
struct BatchState *bs = cls;
bs->batch_ip++;
-
TALER_LOG_DEBUG ("Running batched command: %s\n",
bs->batch[bs->batch_ip].label);
@@ -113,8 +116,8 @@ batch_traits (void *cls,
const char *trait,
unsigned int index)
{
- #define CURRENT_CMD_INDEX 0
- #define BATCH_INDEX 1
+#define CURRENT_CMD_INDEX 0
+#define BATCH_INDEX 1
struct BatchState *bs = cls;
diff --git a/src/exchange-lib/testing_api_cmd_deposit.c b/src/exchange-lib/testing_api_cmd_deposit.c
index 4060e660b..c07e8fbb5 100644
--- a/src/exchange-lib/testing_api_cmd_deposit.c
+++ b/src/exchange-lib/testing_api_cmd_deposit.c
@@ -121,9 +121,11 @@ deposit_cb (void *cls,
if (ds->expected_response_code != http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected response code %u to command %s\n",
+ "Unexpected response code %u to command %s in %s:%u\n",
http_status,
- ds->is->commands[ds->is->ip].label);
+ ds->is->commands[ds->is->ip].label,
+ __FILE__,
+ __LINE__);
json_dumpf (obj, stderr, 0);
TALER_TESTING_interpreter_fail (ds->is);
return;
diff --git a/src/exchange-lib/testing_api_cmd_payback.c b/src/exchange-lib/testing_api_cmd_payback.c
index 8d0dfb956..56026162a 100644
--- a/src/exchange-lib/testing_api_cmd_payback.c
+++ b/src/exchange-lib/testing_api_cmd_payback.c
@@ -142,9 +142,11 @@ payback_cb (void *cls,
if (ps->expected_response_code != http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected response code %u to command %s\n",
+ "Unexpected response code %u to command %s in %s:%u\n",
http_status,
- cmd->label);
+ cmd->label,
+ __FILE__,
+ __LINE__);
json_dumpf (full_response, stderr, 0);
fprintf (stderr, "\n");
TALER_TESTING_interpreter_fail (is);
diff --git a/src/exchange-lib/testing_api_cmd_refresh.c b/src/exchange-lib/testing_api_cmd_refresh.c
index 89c7852c2..a7cd2e65e 100644
--- a/src/exchange-lib/testing_api_cmd_refresh.c
+++ b/src/exchange-lib/testing_api_cmd_refresh.c
@@ -232,9 +232,11 @@ reveal_cb (void *cls,
if (rrs->expected_response_code != http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected response code %u to command %s\n",
+ "Unexpected response code %u to command %s in %s:%u\n",
http_status,
- rrs->is->commands[rrs->is->ip].label);
+ rrs->is->commands[rrs->is->ip].label,
+ __FILE__,
+ __LINE__);
json_dumpf (full_response, stderr, 0);
TALER_TESTING_interpreter_fail (rrs->is);
return;
@@ -400,9 +402,11 @@ link_cb (void *cls,
if (rls->expected_response_code != http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected response code %u to command %s\n",
+ "Unexpected response code %u to command %s in %s:%u\n",
http_status,
- link_cmd->label);
+ link_cmd->label,
+ __FILE__,
+ __LINE__);
json_dumpf (full_response, stderr, 0);
TALER_TESTING_interpreter_fail (rls->is);
return;
@@ -431,8 +435,11 @@ link_cb (void *cls,
if (num_coins != *num_fresh_coins)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected number of fresh coins: %d vs %d\n",
- num_coins, *num_fresh_coins);
+ "Unexpected number of fresh coins: %d vs %d in %s:%u\n",
+ num_coins,
+ *num_fresh_coins,
+ __FILE__,
+ __LINE__);
TALER_TESTING_interpreter_fail (rls->is);
return;
}
@@ -626,9 +633,11 @@ melt_cb (void *cls,
if (rms->expected_response_code != http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected response code %u to command %s\n",
+ "Unexpected response code %u to command %s in %s:%u\n",
http_status,
- rms->is->commands[rms->is->ip].label);
+ rms->is->commands[rms->is->ip].label,
+ __FILE__,
+ __LINE__);
json_dumpf (full_response, stderr, 0);
TALER_TESTING_interpreter_fail (rms->is);
return;
diff --git a/src/exchange-lib/testing_api_cmd_refund.c b/src/exchange-lib/testing_api_cmd_refund.c
index caf5dcfda..c6e3f9580 100644
--- a/src/exchange-lib/testing_api_cmd_refund.c
+++ b/src/exchange-lib/testing_api_cmd_refund.c
@@ -105,9 +105,11 @@ refund_cb (void *cls,
if (rs->expected_response_code != http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected response code %u to command %s\n",
+ "Unexpected response code %u to command %s in %s:%u\n",
http_status,
- refund_cmd->label);
+ refund_cmd->label,
+ __FILE__,
+ __LINE__);
json_dumpf (obj, stderr, 0);
TALER_TESTING_interpreter_fail (rs->is);
return;
diff --git a/src/exchange-lib/testing_api_cmd_status.c b/src/exchange-lib/testing_api_cmd_status.c
index 1e5f6710d..41144d3d8 100644
--- a/src/exchange-lib/testing_api_cmd_status.c
+++ b/src/exchange-lib/testing_api_cmd_status.c
@@ -95,8 +95,10 @@ reserve_status_cb
if (ss->expected_response_code != http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected HTTP response code: %d\n",
- http_status);
+ "Unexpected HTTP response code: %d in %s:%u\n",
+ http_status,
+ __FILE__,
+ __LINE__);
TALER_TESTING_interpreter_fail (ss->is);
return;
}
diff --git a/src/exchange-lib/testing_api_cmd_track.c b/src/exchange-lib/testing_api_cmd_track.c
index 60f412c8b..8ce9b7bc4 100644
--- a/src/exchange-lib/testing_api_cmd_track.c
+++ b/src/exchange-lib/testing_api_cmd_track.c
@@ -184,9 +184,11 @@ deposit_wtid_cb
if (tts->expected_response_code != http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected response code %u to command %s\n",
+ "Unexpected response code %u to command %s in %s:%u\n",
http_status,
- cmd->label);
+ cmd->label,
+ __FILE__,
+ __LINE__);
json_dumpf (json, stderr, 0);
TALER_TESTING_interpreter_fail (is);
return;
@@ -224,7 +226,7 @@ deposit_wtid_cb
TALER_TESTING_interpreter_fail (is);
return;
}
-
+
/* Compare that expected and gotten subjects match. */
if (0 != strcmp (ws, transfer_subject))
{
@@ -527,9 +529,11 @@ track_transfer_cb
if (tts->expected_response_code != http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected response code %u to command %s\n",
+ "Unexpected response code %u to command %s in %s:%u\n",
http_status,
- cmd->label);
+ cmd->label,
+ __FILE__,
+ __LINE__);
json_dumpf (json, stderr, 0);
TALER_TESTING_interpreter_fail (is);
return;
diff --git a/src/exchange-lib/testing_api_cmd_withdraw.c b/src/exchange-lib/testing_api_cmd_withdraw.c
index 1ee0e3b5e..c36d116e9 100644
--- a/src/exchange-lib/testing_api_cmd_withdraw.c
+++ b/src/exchange-lib/testing_api_cmd_withdraw.c
@@ -120,9 +120,11 @@ reserve_withdraw_cb (void *cls,
if (ws->expected_response_code != http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected response code %u to command %s\n",
+ "Unexpected response code %u to command %s in %s:%u\n",
http_status,
- TALER_TESTING_interpreter_get_current_label (is));
+ TALER_TESTING_interpreter_get_current_label (is),
+ __FILE__,
+ __LINE__);
json_dumpf (full_response,
stderr,
0);
@@ -269,7 +271,7 @@ withdraw_traits (void *cls,
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (ws->is);
- return GNUNET_SYSERR;
+ return GNUNET_SYSERR;
}
if (GNUNET_OK != TALER_TESTING_get_trait_reserve_priv
@@ -277,7 +279,7 @@ withdraw_traits (void *cls,
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (ws->is);
- return GNUNET_SYSERR;
+ return GNUNET_SYSERR;
}
struct TALER_TESTING_Trait traits[] = {