From fae4fb8687587377c01048de574b1d2a0556bf3e Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 30 Jan 2015 14:17:42 +0100 Subject: fixing ftbfs of testcase --- src/lib/test_mint_api.c | 4 ++-- src/mint/Makefile.am | 3 +++ src/mint/test_mint_common.c | 3 ++- src/mint/test_mint_deposits.c | 24 ++++++++++-------------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/lib/test_mint_api.c b/src/lib/test_mint_api.c index 8eb2761dc..7a3751b9d 100644 --- a/src/lib/test_mint_api.c +++ b/src/lib/test_mint_api.c @@ -109,8 +109,8 @@ cont (void *cls, const char *emsg) if (NULL != emsg) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", emsg); - enc_32 = TALER_data_to_string_alloc (rnd_32, sizeof (rnd_32)); - enc_64 = TALER_data_to_string_alloc (rnd_64, sizeof (rnd_64)); + enc_32 = GNUNET_STRINGS_data_to_string_alloc (rnd_32, sizeof (rnd_32)); + 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}", "type", "DIRECT_DEPOSIT", "wire", json_pack ("{s:s}", "type", "SEPA"), diff --git a/src/mint/Makefile.am b/src/mint/Makefile.am index 9bb554a48..55d627c41 100644 --- a/src/mint/Makefile.am +++ b/src/mint/Makefile.am @@ -107,7 +107,9 @@ test_mint_deposits_SOURCES = \ test_mint_deposits_LDADD = \ libtalermint_common.la \ $(top_srcdir)/src/util/libtalerutil.la \ + $(top_srcdir)/src/pq/libtalerpq.la \ -lgnunetutil \ + -ljansson \ -lpq test_mint_common_SOURCES = \ @@ -115,4 +117,5 @@ test_mint_common_SOURCES = \ test_mint_common_LDADD = \ libtalermint_common.la \ $(top_srcdir)/src/util/libtalerutil.la \ + $(top_srcdir)/src/pq/libtalerpq.la \ -lgnunetutil diff --git a/src/mint/test_mint_common.c b/src/mint/test_mint_common.c index ee1768d37..28c62cb80 100644 --- a/src/mint/test_mint_common.c +++ b/src/mint/test_mint_common.c @@ -20,7 +20,8 @@ */ #include "platform.h" #include "gnunet/gnunet_util_lib.h" - +#include "taler_signatures.h" +#include "key_io.h" #define RSA_KEY_SIZE 1024 diff --git a/src/mint/test_mint_deposits.c b/src/mint/test_mint_deposits.c index 045485b20..c9fd3a756 100644 --- a/src/mint/test_mint_deposits.c +++ b/src/mint/test_mint_deposits.c @@ -24,9 +24,16 @@ #include #include #include "mint_db.h" +#include "db_pq.h" +#include "taler-mint-httpd.h" #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. */ @@ -118,11 +125,9 @@ run (void *cls, char *const *args, const char *cfgfile, "\"BIC\":\"GENODEF1SRL\"" "}"; struct Deposit *deposit; - struct Deposit *q_deposit; uint64_t transaction_id; deposit = NULL; - q_deposit = NULL; GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_shutdown, NULL); 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)); strcpy (deposit->amount.currency, MINT_CURRENCY); /* Copy wireformat */ - memcpy (deposit->wire, - wire, - sizeof (wire)); + deposit->wire = json_loads (wire, 0, NULL); EXITIF (GNUNET_OK != TALER_MINT_DB_insert_deposit (conn, deposit)); - EXITIF (GNUNET_OK != TALER_MINT_DB_get_deposit (conn, - &deposit->coin_pub, - &q_deposit)); - EXITIF (0 != memcmp (deposit, - q_deposit, - sizeof (struct Deposit) - offsetof(struct Deposit, - wire))); - EXITIF (transaction_id != GNUNET_ntohll (q_deposit->transaction_id)); + EXITIF (GNUNET_OK != TALER_MINT_DB_have_deposit (conn, + deposit)); result = GNUNET_OK; EXITIF_exit: GNUNET_free_non_null (deposit); - GNUNET_free_non_null (q_deposit); GNUNET_SCHEDULER_shutdown (); return; } -- cgit v1.2.3