From 08ef15ec944b3bd28efdbbb3d0289eb189d426f0 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 2 May 2016 08:54:05 +0200 Subject: adding bank-lib test against fakebank (currently fails) -- towards addressing #4437 --- src/bank-lib/test_bank_interpreter.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/bank-lib/test_bank_interpreter.c') diff --git a/src/bank-lib/test_bank_interpreter.c b/src/bank-lib/test_bank_interpreter.c index 8a57c4b62..3247777b3 100644 --- a/src/bank-lib/test_bank_interpreter.c +++ b/src/bank-lib/test_bank_interpreter.c @@ -26,7 +26,7 @@ #include #include #include "test_bank_interpreter.h" - +#include "fakebank.h" /** @@ -69,6 +69,11 @@ struct InterpreterState */ int *resultp; + /** + * Fakebank, or NULL if we are not using the fakebank. + */ + struct FAKEBANK_Handle *fakebank; + /** * Instruction pointer. Tells #interpreter_run() which * instruction to run next. @@ -154,11 +159,11 @@ add_incoming_cb (void *cls, if (cmd->expected_response_code != http_status) { GNUNET_break (0); + fprintf (stderr, + "Unexpected response code %u:\n", + http_status); if (NULL != json) { - fprintf (stderr, - "Unexpected response code %u:\n", - http_status); json_dumpf (json, stderr, 0); fprintf (stderr, "\n"); } @@ -309,6 +314,11 @@ do_shutdown (void *cls) GNUNET_SCHEDULER_cancel (is->task); is->task = NULL; } + if (NULL != is->fakebank) + { + FAKEBANK_stop (is->fakebank); + is->fakebank = NULL; + } GNUNET_CURL_fini (is->ctx); is->ctx = NULL; GNUNET_CURL_gnunet_rc_destroy (is->rc); @@ -331,6 +341,8 @@ TBI_run_interpreter (int *resultp, struct InterpreterState *is; is = GNUNET_new (struct InterpreterState); + if (0 != bank_port) + is->fakebank = FAKEBANK_start (bank_port); is->resultp = resultp; is->commands = commands; is->ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule, -- cgit v1.2.3