fixing ftbfs of testcase

This commit is contained in:
Christian Grothoff 2015-01-30 14:17:42 +01:00
parent c750f53d5a
commit fae4fb8687
4 changed files with 17 additions and 17 deletions

View File

@ -109,8 +109,8 @@ cont (void *cls, const char *emsg)
if (NULL != emsg) if (NULL != emsg)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", emsg); GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", emsg);
enc_32 = TALER_data_to_string_alloc (rnd_32, sizeof (rnd_32)); enc_32 = GNUNET_STRINGS_data_to_string_alloc (rnd_32, sizeof (rnd_32));
enc_64 = TALER_data_to_string_alloc (rnd_64, sizeof (rnd_64)); enc_64 = GNUNET_STRINGS_data_to_string_alloc (rnd_64, sizeof (rnd_64));
dp = json_pack ("{s:s s:o s:s s:s s:s s:s s:s s:s s:s s:s}", dp = json_pack ("{s:s s:o s:s s:s s:s s:s s:s s:s s:s s:s}",
"type", "DIRECT_DEPOSIT", "type", "DIRECT_DEPOSIT",
"wire", json_pack ("{s:s}", "type", "SEPA"), "wire", json_pack ("{s:s}", "type", "SEPA"),

View File

@ -107,7 +107,9 @@ test_mint_deposits_SOURCES = \
test_mint_deposits_LDADD = \ test_mint_deposits_LDADD = \
libtalermint_common.la \ libtalermint_common.la \
$(top_srcdir)/src/util/libtalerutil.la \ $(top_srcdir)/src/util/libtalerutil.la \
$(top_srcdir)/src/pq/libtalerpq.la \
-lgnunetutil \ -lgnunetutil \
-ljansson \
-lpq -lpq
test_mint_common_SOURCES = \ test_mint_common_SOURCES = \
@ -115,4 +117,5 @@ test_mint_common_SOURCES = \
test_mint_common_LDADD = \ test_mint_common_LDADD = \
libtalermint_common.la \ libtalermint_common.la \
$(top_srcdir)/src/util/libtalerutil.la \ $(top_srcdir)/src/util/libtalerutil.la \
$(top_srcdir)/src/pq/libtalerpq.la \
-lgnunetutil -lgnunetutil

View File

@ -20,7 +20,8 @@
*/ */
#include "platform.h" #include "platform.h"
#include "gnunet/gnunet_util_lib.h" #include "gnunet/gnunet_util_lib.h"
#include "taler_signatures.h"
#include "key_io.h"
#define RSA_KEY_SIZE 1024 #define RSA_KEY_SIZE 1024

View File

@ -24,9 +24,16 @@
#include <libpq-fe.h> #include <libpq-fe.h>
#include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_util_lib.h>
#include "mint_db.h" #include "mint_db.h"
#include "db_pq.h"
#include "taler-mint-httpd.h"
#define DB_URI "postgres:///taler" #define DB_URI "postgres:///taler"
#define break_db_err(result) do { \
GNUNET_break(0); \
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Database failure: %s\n", PQresultErrorMessage (result)); \
} while (0)
/** /**
* Shorthand for exit jumps. * Shorthand for exit jumps.
*/ */
@ -118,11 +125,9 @@ run (void *cls, char *const *args, const char *cfgfile,
"\"BIC\":\"GENODEF1SRL\"" "\"BIC\":\"GENODEF1SRL\""
"}"; "}";
struct Deposit *deposit; struct Deposit *deposit;
struct Deposit *q_deposit;
uint64_t transaction_id; uint64_t transaction_id;
deposit = NULL; deposit = NULL;
q_deposit = NULL;
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&do_shutdown, NULL); &do_shutdown, NULL);
EXITIF (NULL == (conn = PQconnectdb(DB_URI))); EXITIF (NULL == (conn = PQconnectdb(DB_URI)));
@ -145,24 +150,15 @@ run (void *cls, char *const *args, const char *cfgfile,
GNUNET_assert (strlen (MINT_CURRENCY) < sizeof (deposit->amount.currency)); GNUNET_assert (strlen (MINT_CURRENCY) < sizeof (deposit->amount.currency));
strcpy (deposit->amount.currency, MINT_CURRENCY); strcpy (deposit->amount.currency, MINT_CURRENCY);
/* Copy wireformat */ /* Copy wireformat */
memcpy (deposit->wire, deposit->wire = json_loads (wire, 0, NULL);
wire,
sizeof (wire));
EXITIF (GNUNET_OK != TALER_MINT_DB_insert_deposit (conn, EXITIF (GNUNET_OK != TALER_MINT_DB_insert_deposit (conn,
deposit)); deposit));
EXITIF (GNUNET_OK != TALER_MINT_DB_get_deposit (conn, EXITIF (GNUNET_OK != TALER_MINT_DB_have_deposit (conn,
&deposit->coin_pub, deposit));
&q_deposit));
EXITIF (0 != memcmp (deposit,
q_deposit,
sizeof (struct Deposit) - offsetof(struct Deposit,
wire)));
EXITIF (transaction_id != GNUNET_ntohll (q_deposit->transaction_id));
result = GNUNET_OK; result = GNUNET_OK;
EXITIF_exit: EXITIF_exit:
GNUNET_free_non_null (deposit); GNUNET_free_non_null (deposit);
GNUNET_free_non_null (q_deposit);
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }