summaryrefslogtreecommitdiff
path: root/src/bank-lib/test_bank_interpreter.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-05-02 08:54:05 +0200
committerChristian Grothoff <christian@grothoff.org>2016-05-02 08:54:05 +0200
commit08ef15ec944b3bd28efdbbb3d0289eb189d426f0 (patch)
tree125fb6c546a284a17300b874b2cc4c07e985d28b /src/bank-lib/test_bank_interpreter.c
parent31ad6aaf116d00cafa29efe659c3076da0d09692 (diff)
downloadexchange-08ef15ec944b3bd28efdbbb3d0289eb189d426f0.tar.gz
exchange-08ef15ec944b3bd28efdbbb3d0289eb189d426f0.tar.bz2
exchange-08ef15ec944b3bd28efdbbb3d0289eb189d426f0.zip
adding bank-lib test against fakebank (currently fails) -- towards addressing #4437
Diffstat (limited to 'src/bank-lib/test_bank_interpreter.c')
-rw-r--r--src/bank-lib/test_bank_interpreter.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/bank-lib/test_bank_interpreter.c b/src/bank-lib/test_bank_interpreter.c
index 8a57c4b6..3247777b 100644
--- a/src/bank-lib/test_bank_interpreter.c
+++ b/src/bank-lib/test_bank_interpreter.c
@@ -26,7 +26,7 @@
#include <gnunet/gnunet_curl_lib.h>
#include <microhttpd.h>
#include "test_bank_interpreter.h"
-
+#include "fakebank.h"
/**
@@ -70,6 +70,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,