gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-anastasis] branch master updated: major libtalertesting API refac


From: gnunet
Subject: [taler-anastasis] branch master updated: major libtalertesting API refactoring, including no longer having taler-specific logic in the test engine core
Date: Wed, 07 Jun 2023 23:11:38 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new 1701d4f  major libtalertesting API refactoring, including no longer 
having taler-specific logic in the test engine core
1701d4f is described below

commit 1701d4f86a39edc390f172da6f8e72c94b6a8e97
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Jun 7 23:11:35 2023 +0200

    major libtalertesting API refactoring, including no longer having 
taler-specific logic in the test engine core
---
 src/include/anastasis_testing_lib.h           |   6 +-
 src/testing/test_anastasis.c                  | 129 +++++++-------------------
 src/testing/test_anastasis_api.c              | 123 +++++++-----------------
 src/testing/testing_api_cmd_config.c          |  24 ++---
 src/testing/testing_api_cmd_policy_lookup.c   |  21 ++---
 src/testing/testing_api_cmd_policy_store.c    |  15 +--
 src/testing/testing_api_cmd_truth_challenge.c |  34 +++----
 src/testing/testing_api_cmd_truth_solve.c     |  58 +++++-------
 src/testing/testing_api_cmd_truth_store.c     |  21 ++---
 src/testing/testing_cmd_challenge_answer.c    |  13 +--
 src/testing/testing_cmd_recover_secret.c      |  25 ++---
 src/testing/testing_cmd_secret_share.c        |  42 ++++-----
 src/testing/testing_cmd_truth_upload.c        |  27 +++---
 13 files changed, 180 insertions(+), 358 deletions(-)

diff --git a/src/include/anastasis_testing_lib.h 
b/src/include/anastasis_testing_lib.h
index b5036ff..4c6e087 100644
--- a/src/include/anastasis_testing_lib.h
+++ b/src/include/anastasis_testing_lib.h
@@ -130,15 +130,15 @@
   op (truth, const struct ANASTASIS_Truth *)  \
   op (policy, const struct ANASTASIS_Policy *)  \
   op (provider_salt, const struct ANASTASIS_CRYPTO_ProviderSaltP)  \
-  op (core_secret, const void *)  \
+  op (core_secret, const void)  \
   op (truth_key, const struct ANASTASIS_CRYPTO_TruthKeyP)  \
   op (account_pub, const struct ANASTASIS_CRYPTO_AccountPublicKeyP)  \
   op (account_priv, const struct ANASTASIS_CRYPTO_AccountPrivateKeyP)  \
   op (payment_secret, const struct ANASTASIS_PaymentSecretP)  \
   op (truth_uuid, const struct ANASTASIS_CRYPTO_TruthUUIDP)  \
   op (eks, const struct ANASTASIS_CRYPTO_EncryptedKeyShareP)  \
-  op (code, const char *) \
-  op (filename, const char *)
+  op (code, const char) \
+  op (filename, const char)
 
 
 /**
diff --git a/src/testing/test_anastasis.c b/src/testing/test_anastasis.c
index 7b127ac..bf3662d 100644
--- a/src/testing/test_anastasis.c
+++ b/src/testing/test_anastasis.c
@@ -1,6 +1,6 @@
 /*
   This file is part of Anastasis
-  Copyright (C) 2020, 2021 Anastasis SARL
+  Copyright (C) 2020-2023 Anastasis SARL
 
   Anastasis is free software; you can redistribute it and/or modify it under 
the
   terms of the GNU General Public License as published by the Free Software
@@ -52,34 +52,29 @@
 #define MERCHANT_ACCOUNT_NAME "3"
 
 /**
- * Configuration of the bank.
+ * Credentials for the test.
  */
-static struct TALER_TESTING_BankConfiguration bc;
-
-/**
- * Configuration of the exchange.
- */
-static struct TALER_TESTING_ExchangeConfiguration ec;
+static struct TALER_TESTING_Credentials cred;
 
 /**
  * Payto URI of the customer (payer).
  */
-static char *payer_payto;
+static const char *payer_payto;
 
 /**
  * Payto URI of the exchange (escrow account).
  */
-static char *exchange_payto;
+static const char *exchange_payto;
 
 /**
  * Payto URI of the merchant (receiver).
  */
-static char *merchant_payto;
+static const char *merchant_payto;
 
 /**
  * Merchant base URL.
  */
-static char *merchant_url;
+static const char *merchant_url;
 
 /**
  * Anastasis base URL.
@@ -91,11 +86,6 @@ static char *anastasis_url;
  */
 static char *file_secret;
 
-/**
- * Merchant process.
- */
-static struct GNUNET_OS_Process *merchantd;
-
 /**
  * Anastasis process.
  */
@@ -135,7 +125,7 @@ cmd_transfer_to_exchange (const char *label,
 {
   return TALER_TESTING_cmd_admin_add_incoming (label,
                                                amount,
-                                               &bc.exchange_auth,
+                                               &cred.ba,
                                                payer_payto);
 }
 
@@ -341,8 +331,7 @@ run (void *cls,
                                               CONFIG_FILE,
                                               "EUR:0.01",
                                               "EUR:0.01"),
-    TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys",
-                                                1),
+    TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
     TALER_TESTING_cmd_merchant_post_instances ("instance-create-default",
                                                merchant_url,
                                                "default",
@@ -356,9 +345,8 @@ run (void *cls,
     TALER_TESTING_cmd_end ()
   };
 
-  TALER_TESTING_run_with_fakebank (is,
-                                   commands,
-                                   bc.exchange_auth.wire_gateway_url);
+  TALER_TESTING_run (is,
+                     commands);
 }
 
 
@@ -366,19 +354,7 @@ int
 main (int argc,
       char *const *argv)
 {
-  unsigned int ret;
-  /* These environment variables get in the way... */
-  unsetenv ("XDG_DATA_HOME");
-  unsetenv ("XDG_CONFIG_HOME");
-
-  GNUNET_log_setup ("test-anastasis",
-                    "DEBUG",
-                    NULL);
-  if (GNUNET_OK !=
-      TALER_TESTING_prepare_fakebank (CONFIG_FILE,
-                                      "exchange-account-exchange",
-                                      &bc))
-    return 77;
+  int ret;
   {
     char dir[] = "/tmp/test-anastasis-file-XXXXXX";
 
@@ -393,73 +369,36 @@ main (int argc,
                      "%s/.secret",
                      dir);
   }
-  id_data = ANASTASIS_TESTING_make_id_data_example (
-    "MaxMuster123456789");
-  payer_payto = ("payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME);
-  exchange_payto = ("payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME);
-  merchant_payto = ("payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME);
-  if (NULL ==
-      (merchant_url = TALER_TESTING_prepare_merchant (CONFIG_FILE)))
-    return 77;
-  TALER_TESTING_cleanup_files (CONFIG_FILE);
+  id_data = ANASTASIS_TESTING_make_id_data_example ("MaxMuster123456789");
+  payer_payto = "payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME;
+  exchange_payto = "payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME;
+  merchant_payto = "payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME;
+  merchant_url = "http://localhost:8080/";;
 
   if (NULL ==
       (anastasis_url = ANASTASIS_TESTING_prepare_anastasis (CONFIG_FILE)))
     return 77;
-  TALER_TESTING_cleanup_files (CONFIG_FILE);
-
-  switch (TALER_TESTING_prepare_exchange (CONFIG_FILE,
-                                          GNUNET_YES,
-                                          &ec))
+  if (NULL == (anastasisd =
+                 ANASTASIS_TESTING_run_anastasis (CONFIG_FILE,
+                                                  anastasis_url)))
   {
-  case GNUNET_SYSERR:
-    GNUNET_break (0);
-    return 1;
-  case GNUNET_NO:
-    return 77;
-  case GNUNET_OK:
-    if (NULL == (merchantd =
-                   TALER_TESTING_run_merchant (CONFIG_FILE,
-                                               merchant_url)))
-    {
-      GNUNET_break (0);
-      return 1;
-    }
-    if (NULL == (anastasisd =
-                   ANASTASIS_TESTING_run_anastasis (CONFIG_FILE,
-                                                    anastasis_url)))
-    {
-      GNUNET_break (0);
-      GNUNET_OS_process_kill (merchantd,
-                              SIGTERM);
-      GNUNET_OS_process_wait (merchantd);
-      GNUNET_OS_process_destroy (merchantd);
-
-      return 1;
-    }
-    ret = TALER_TESTING_setup_with_exchange (&run,
-                                             NULL,
-                                             CONFIG_FILE);
-
-    GNUNET_OS_process_kill (merchantd,
-                            SIGTERM);
-    GNUNET_OS_process_kill (anastasisd,
-                            SIGTERM);
-    GNUNET_OS_process_wait (merchantd);
-    GNUNET_OS_process_wait (anastasisd);
-    GNUNET_OS_process_destroy (merchantd);
-    GNUNET_OS_process_destroy (anastasisd);
-    GNUNET_free (merchant_url);
-    GNUNET_free (anastasis_url);
-
-    if (GNUNET_OK != ret)
-      return 1;
-    break;
-  default:
     GNUNET_break (0);
     return 1;
   }
-  return 0;
+  ret = TALER_TESTING_main (argv,
+                            "INFO",
+                            CONFIG_FILE,
+                            "exchange-account-2",
+                            TALER_TESTING_BS_FAKEBANK,
+                            &cred,
+                            &run,
+                            NULL);
+  GNUNET_OS_process_kill (anastasisd,
+                          SIGTERM);
+  GNUNET_OS_process_wait (anastasisd);
+  GNUNET_OS_process_destroy (anastasisd);
+  GNUNET_free (anastasis_url);
+  return ret;
 }
 
 
diff --git a/src/testing/test_anastasis_api.c b/src/testing/test_anastasis_api.c
index caa59c8..d365dd9 100644
--- a/src/testing/test_anastasis_api.c
+++ b/src/testing/test_anastasis_api.c
@@ -52,45 +52,35 @@
 #define MERCHANT_ACCOUNT_NAME "3"
 
 /**
- * Configuration of the bank.
+ * Test credentials.
  */
-static struct TALER_TESTING_BankConfiguration bc;
-
-/**
- * Configuration of the exchange.
- */
-static struct TALER_TESTING_ExchangeConfiguration ec;
+static struct TALER_TESTING_Credentials cred;
 
 /**
  * Payto URI of the customer (payer).
  */
-static char *payer_payto;
+static const char *payer_payto;
 
 /**
  * Payto URI of the exchange (escrow account).
  */
-static char *exchange_payto;
+static const char *exchange_payto;
 
 /**
  * Payto URI of the merchant (receiver).
  */
-static char *merchant_payto;
+static const char *merchant_payto;
 
 /**
  * Merchant base URL.
  */
-static char *merchant_url;
+static const char *merchant_url;
 
 /**
  * Anastasis base URL.
  */
 static char *anastasis_url;
 
-/**
- * Merchant process.
- */
-static struct GNUNET_OS_Process *merchantd;
-
 /**
  * Anastasis process.
  */
@@ -129,7 +119,7 @@ cmd_transfer_to_exchange (const char *label,
 {
   return TALER_TESTING_cmd_admin_add_incoming (label,
                                                amount,
-                                               &bc.exchange_auth,
+                                               &cred.ba,
                                                payer_payto);
 }
 
@@ -289,8 +279,7 @@ run (void *cls,
                                               CONFIG_FILE,
                                               "EUR:0.01",
                                               "EUR:0.01"),
-    TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys",
-                                                1),
+    TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
     TALER_TESTING_cmd_merchant_post_instances ("instance-create-default",
                                                merchant_url,
                                                "default",
@@ -309,9 +298,8 @@ run (void *cls,
     TALER_TESTING_cmd_end ()
   };
 
-  TALER_TESTING_run_with_fakebank (is,
-                                   commands,
-                                   bc.exchange_auth.wire_gateway_url);
+  TALER_TESTING_run (is,
+                     commands);
 }
 
 
@@ -321,17 +309,6 @@ main (int argc,
 {
   int ret;
 
-  /* These environment variables get in the way... */
-  unsetenv ("XDG_DATA_HOME");
-  unsetenv ("XDG_CONFIG_HOME");
-  GNUNET_log_setup ("test-anastasis-api",
-                    "DEBUG",
-                    NULL);
-  if (GNUNET_OK !=
-      TALER_TESTING_prepare_fakebank (CONFIG_FILE,
-                                      "exchange-account-exchange",
-                                      &bc))
-    return 77;
   {
     char dir[] = "/tmp/test-anastasis-file-XXXXXX";
 
@@ -346,73 +323,35 @@ main (int argc,
                      "%s/.secret",
                      dir);
   }
-  payer_payto = ("payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME);
-  exchange_payto = ("payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME);
-  merchant_payto = ("payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME);
-  if (NULL ==
-      (merchant_url = TALER_TESTING_prepare_merchant (CONFIG_FILE)))
-    return 77;
-  TALER_TESTING_cleanup_files (CONFIG_FILE);
+  payer_payto = "payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME;
+  exchange_payto = "payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME;
+  merchant_payto = "payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME;
+  merchant_url = "http://localhost:8080/";;
 
   if (NULL ==
       (anastasis_url = ANASTASIS_TESTING_prepare_anastasis (CONFIG_FILE)))
     return 77;
-  TALER_TESTING_cleanup_files (CONFIG_FILE);
-
-  switch (TALER_TESTING_prepare_exchange (CONFIG_FILE,
-                                          GNUNET_YES,
-                                          &ec))
+  if (NULL == (anastasisd =
+                 ANASTASIS_TESTING_run_anastasis (CONFIG_FILE,
+                                                  anastasis_url)))
   {
-  case GNUNET_SYSERR:
-    GNUNET_break (0);
-    return 1;
-  case GNUNET_NO:
-    return 77;
-  case GNUNET_OK:
-    if (NULL == (merchantd =
-                   TALER_TESTING_run_merchant (CONFIG_FILE,
-                                               merchant_url)))
-    {
-      GNUNET_break (0);
-      return 1;
-    }
-    if (NULL == (anastasisd =
-                   ANASTASIS_TESTING_run_anastasis (CONFIG_FILE,
-                                                    anastasis_url)))
-    {
-      GNUNET_break (0);
-      GNUNET_OS_process_kill (merchantd,
-                              SIGTERM);
-      GNUNET_OS_process_wait (merchantd);
-      GNUNET_OS_process_destroy (merchantd);
-      return 1;
-    }
-    ret = TALER_TESTING_setup_with_exchange (&run,
-                                             NULL,
-                                             CONFIG_FILE);
-    GNUNET_OS_process_kill (merchantd,
-                            SIGTERM);
-    GNUNET_OS_process_kill (anastasisd,
-                            SIGTERM);
-    GNUNET_OS_process_wait (merchantd);
-    GNUNET_OS_process_wait (anastasisd);
-    GNUNET_OS_process_destroy (merchantd);
-    GNUNET_OS_process_destroy (anastasisd);
-    GNUNET_free (merchant_url);
-    GNUNET_free (anastasis_url);
-
-    if (GNUNET_OK != ret)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Test failed in interpreter\n");
-      return 1;
-    }
-    break;
-  default:
     GNUNET_break (0);
     return 1;
   }
-  return 0;
+  ret = TALER_TESTING_main (argv,
+                            "INFO",
+                            CONFIG_FILE,
+                            "exchange-account-2",
+                            TALER_TESTING_BS_FAKEBANK,
+                            &cred,
+                            &run,
+                            NULL);
+  GNUNET_OS_process_kill (anastasisd,
+                          SIGTERM);
+  GNUNET_OS_process_wait (anastasisd);
+  GNUNET_OS_process_destroy (anastasisd);
+  GNUNET_free (anastasis_url);
+  return ret;
 }
 
 
diff --git a/src/testing/testing_api_cmd_config.c 
b/src/testing/testing_api_cmd_config.c
index 92a8ae1..bd245cc 100644
--- a/src/testing/testing_api_cmd_config.c
+++ b/src/testing/testing_api_cmd_config.c
@@ -74,22 +74,11 @@ config_cb (void *cls,
   ss->so = NULL;
   if (http_status != ss->http_status)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unexpected response code %u to command %s in %s:%u\n",
-                http_status,
-                ss->is->commands[ss->is->ip].label,
-                __FILE__,
-                __LINE__);
-    TALER_TESTING_interpreter_fail (ss->is);
-    return;
+    TALER_TESTING_unexpected_status (ss->is,
+                                     http_status);
   }
   if (NULL == config)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Config is NULL, command %s in %s:%u\n",
-                ss->is->commands[ss->is->ip].label,
-                __FILE__,
-                __LINE__);
     TALER_TESTING_interpreter_fail (ss->is);
     return;
   }
@@ -113,10 +102,11 @@ config_run (void *cls,
   struct ConfigState *ss = cls;
 
   ss->is = is;
-  ss->so = ANASTASIS_get_config (is->ctx,
-                                 ss->anastasis_url,
-                                 &config_cb,
-                                 ss);
+  ss->so = ANASTASIS_get_config (
+    TALER_TESTING_interpreter_get_context (is),
+    ss->anastasis_url,
+    &config_cb,
+    ss);
   if (NULL == ss->so)
   {
     GNUNET_break (0);
diff --git a/src/testing/testing_api_cmd_policy_lookup.c 
b/src/testing/testing_api_cmd_policy_lookup.c
index 1f59b12..9eb57c6 100644
--- a/src/testing/testing_api_cmd_policy_lookup.c
+++ b/src/testing/testing_api_cmd_policy_lookup.c
@@ -85,14 +85,8 @@ policy_lookup_cb (void *cls,
   pls->plo = NULL;
   if (http_status != pls->http_status)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unexpected response code %u to command %s in %s:%u\n",
-                http_status,
-                pls->is->commands[pls->is->ip].label,
-                __FILE__,
-                __LINE__);
-    TALER_TESTING_interpreter_fail (pls->is);
-    return;
+    TALER_TESTING_unexpected_status (pls->is,
+                                     http_status);
   }
   if (NULL != pls->upload_reference)
   {
@@ -156,11 +150,12 @@ policy_lookup_run (void *cls,
     }
     pls->anastasis_pub = *anastasis_pub;
   }
-  pls->plo = ANASTASIS_policy_lookup (is->ctx,
-                                      pls->anastasis_url,
-                                      &pls->anastasis_pub,
-                                      &policy_lookup_cb,
-                                      pls);
+  pls->plo = ANASTASIS_policy_lookup (
+    TALER_TESTING_interpreter_get_context (is),
+    pls->anastasis_url,
+    &pls->anastasis_pub,
+    &policy_lookup_cb,
+    pls);
   if (NULL == pls->plo)
   {
     GNUNET_break (0);
diff --git a/src/testing/testing_api_cmd_policy_store.c 
b/src/testing/testing_api_cmd_policy_store.c
index f23489d..9bb2118 100644
--- a/src/testing/testing_api_cmd_policy_store.c
+++ b/src/testing/testing_api_cmd_policy_store.c
@@ -139,14 +139,8 @@ policy_store_cb (void *cls,
   pss->pso = NULL;
   if (ud->http_status != pss->http_status)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unexpected response code %u to command %s in %s:%u\n",
-                ud->http_status,
-                pss->is->commands[pss->is->ip].label,
-                __FILE__,
-                __LINE__);
-    TALER_TESTING_interpreter_fail (pss->is);
-    return;
+    TALER_TESTING_unexpected_status (pss->is,
+                                     ud->http_status);
   }
   switch (ud->us)
   {
@@ -276,7 +270,7 @@ policy_store_run (void *cls,
                       pss->recovery_data_size,
                       &pss->curr_hash);
   pss->pso = ANASTASIS_policy_store (
-    is->ctx,
+    TALER_TESTING_interpreter_get_context (is),
     pss->anastasis_url,
     &pss->anastasis_priv,
     pss->recovery_data,
@@ -340,8 +334,7 @@ policy_store_traits (void *cls,
   struct PolicyStoreState *pss = cls;
   struct TALER_TESTING_Trait traits[] = {
     TALER_TESTING_make_trait_claim_token (&pss->claim_token),
-    TALER_TESTING_make_trait_order_id (
-      (const char **) &pss->order_id),
+    TALER_TESTING_make_trait_order_id (pss->order_id),
     ANASTASIS_TESTING_make_trait_hash (&pss->curr_hash),
     ANASTASIS_TESTING_make_trait_account_pub (&pss->anastasis_pub),
     ANASTASIS_TESTING_make_trait_account_priv (&pss->anastasis_priv),
diff --git a/src/testing/testing_api_cmd_truth_challenge.c 
b/src/testing/testing_api_cmd_truth_challenge.c
index f1384c4..7132fcd 100644
--- a/src/testing/testing_api_cmd_truth_challenge.c
+++ b/src/testing/testing_api_cmd_truth_challenge.c
@@ -100,14 +100,8 @@ truth_challenge_cb (void *cls,
   ksls->tco = NULL;
   if (tcd->http_status != ksls->expected_http_status)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unexpected response code %u to command %s in %s:%u\n",
-                tcd->http_status,
-                ksls->is->commands[ksls->is->ip].label,
-                __FILE__,
-                __LINE__);
-    TALER_TESTING_interpreter_fail (ksls->is);
-    return;
+    TALER_TESTING_unexpected_status (ksls->is,
+                                     tcd->http_status);
   }
   switch (tcd->http_status)
   {
@@ -268,13 +262,14 @@ truth_challenge_run (void *cls,
     payment_secret = NULL;
   }
 
-  ksls->tco = ANASTASIS_truth_challenge (is->ctx,
-                                         ksls->anastasis_url,
-                                         truth_uuid,
-                                         truth_key,
-                                         payment_secret,
-                                         &truth_challenge_cb,
-                                         ksls);
+  ksls->tco = ANASTASIS_truth_challenge (
+    TALER_TESTING_interpreter_get_context (is),
+    ksls->anastasis_url,
+    truth_uuid,
+    truth_key,
+    payment_secret,
+    &truth_challenge_cb,
+    ksls);
   if (NULL == ksls->tco)
   {
     GNUNET_break (0);
@@ -325,12 +320,9 @@ truth_challenge_traits (void *cls,
   struct TALER_TESTING_Trait traits[] = {
     ANASTASIS_TESTING_make_trait_payment_secret (
       &ksls->payment_secret_response),
-    TALER_TESTING_make_trait_payto_uri (
-      (const char **) ksls->pay_uri),
-    TALER_TESTING_make_trait_order_id (
-      (const char **) &ksls->order_id),
-    ANASTASIS_TESTING_make_trait_code (
-      (const char **) &ksls->code),
+    TALER_TESTING_make_trait_payto_uri (ksls->pay_uri),
+    TALER_TESTING_make_trait_order_id (ksls->order_id),
+    ANASTASIS_TESTING_make_trait_code (ksls->code),
     TALER_TESTING_trait_end ()
   };
 
diff --git a/src/testing/testing_api_cmd_truth_solve.c 
b/src/testing/testing_api_cmd_truth_solve.c
index 5c12b3f..1a935eb 100644
--- a/src/testing/testing_api_cmd_truth_solve.c
+++ b/src/testing/testing_api_cmd_truth_solve.c
@@ -127,14 +127,8 @@ truth_solve_cb (void *cls,
   ksls->tso = NULL;
   if (tsr->http_status != ksls->expected_http_status)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unexpected response code %u to command %s in %s:%u\n",
-                tsr->http_status,
-                ksls->is->commands[ksls->is->ip].label,
-                __FILE__,
-                __LINE__);
-    TALER_TESTING_interpreter_fail (ksls->is);
-    return;
+    TALER_TESTING_unexpected_status (ksls->is,
+                                     tsr->http_status);
   }
   switch (tsr->http_status)
   {
@@ -163,7 +157,7 @@ truth_solve_run (void *cls,
   const struct ANASTASIS_CRYPTO_TruthKeyP *truth_key;
   const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid;
   const struct ANASTASIS_PaymentSecretP *payment_secret;
-  const char **answerp;
+  const char *answer;
 
   ksls->is = is;
   if (NULL == ksls->upload_reference)
@@ -185,7 +179,7 @@ truth_solve_run (void *cls,
       return;
     }
     {
-      const char **fn;
+      const char *fn;
 
       if (GNUNET_OK !=
           ANASTASIS_TESTING_get_trait_filename (upload_cmd,
@@ -195,8 +189,8 @@ truth_solve_run (void *cls,
         TALER_TESTING_interpreter_fail (ksls->is);
         return;
       }
-      if (NULL != *fn)
-        ksls->filename = GNUNET_strdup (*fn);
+      if (NULL != fn)
+        ksls->filename = GNUNET_strdup (fn);
     }
     if (GNUNET_OK !=
         ANASTASIS_TESTING_get_trait_truth_uuid (upload_cmd,
@@ -242,13 +236,13 @@ truth_solve_run (void *cls,
     }
     if (GNUNET_OK !=
         ANASTASIS_TESTING_get_trait_code (download_cmd,
-                                          &answerp))
+                                          &answer))
     {
       GNUNET_break (0);
       TALER_TESTING_interpreter_fail (ksls->is);
       return;
     }
-    if (NULL == *answerp)
+    if (NULL == answer)
     {
       GNUNET_break (0);
       TALER_TESTING_interpreter_fail (ksls->is);
@@ -258,9 +252,9 @@ truth_solve_run (void *cls,
   else
   {
     /* answer is the answer */
-    answerp = &ksls->answer;
+    answer = ksls->answer;
   }
-  if (NULL == answerp)
+  if (NULL == answer)
   {
     GNUNET_break (0);
     TALER_TESTING_interpreter_fail (ksls->is);
@@ -291,18 +285,19 @@ truth_solve_run (void *cls,
   {
     struct GNUNET_HashCode h_answer;
 
-    GNUNET_CRYPTO_hash (*answerp,
-                        strlen (*answerp),
+    GNUNET_CRYPTO_hash (answer,
+                        strlen (answer),
                         &h_answer);
-    ksls->tso = ANASTASIS_truth_solve (is->ctx,
-                                       ksls->anastasis_url,
-                                       truth_uuid,
-                                       truth_key,
-                                       payment_secret,
-                                       GNUNET_TIME_UNIT_ZERO,
-                                       &h_answer,
-                                       &truth_solve_cb,
-                                       ksls);
+    ksls->tso = ANASTASIS_truth_solve (
+      TALER_TESTING_interpreter_get_context (is),
+      ksls->anastasis_url,
+      truth_uuid,
+      truth_key,
+      payment_secret,
+      GNUNET_TIME_UNIT_ZERO,
+      &h_answer,
+      &truth_solve_cb,
+      ksls);
   }
   if (NULL == ksls->tso)
   {
@@ -356,12 +351,9 @@ truth_solve_traits (void *cls,
   struct TALER_TESTING_Trait traits[] = {
     ANASTASIS_TESTING_make_trait_payment_secret (
       &ksls->payment_secret_response),
-    TALER_TESTING_make_trait_payto_uri (
-      (const char **) ksls->pay_uri),
-    TALER_TESTING_make_trait_order_id (
-      (const char **) &ksls->order_id),
-    ANASTASIS_TESTING_make_trait_code (
-      (const char **) &ksls->code),
+    TALER_TESTING_make_trait_payto_uri (ksls->pay_uri),
+    TALER_TESTING_make_trait_order_id (ksls->order_id),
+    ANASTASIS_TESTING_make_trait_code (ksls->code),
     TALER_TESTING_trait_end ()
   };
 
diff --git a/src/testing/testing_api_cmd_truth_store.c 
b/src/testing/testing_api_cmd_truth_store.c
index 0972210..2637702 100644
--- a/src/testing/testing_api_cmd_truth_store.c
+++ b/src/testing/testing_api_cmd_truth_store.c
@@ -125,17 +125,10 @@ truth_store_cb (void *cls,
   struct TruthStoreState *tss = cls;
 
   tss->tso = NULL;
-  if ( (NULL == ud) ||
-       (ud->http_status != tss->http_status) )
+  if (ud->http_status != tss->http_status)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unexpected response code %u to command %s in %s:%u\n",
-                (NULL != ud) ? ud->http_status : 0,
-                tss->is->commands[tss->is->ip].label,
-                __FILE__,
-                __LINE__);
-    TALER_TESTING_interpreter_fail (tss->is);
-    return;
+    TALER_TESTING_unexpected_status (tss->is,
+                                     ud->http_status);
   }
   switch (ud->us)
   {
@@ -273,7 +266,7 @@ truth_store_run (void *cls,
       GNUNET_free (t);
     }
     tss->tso = ANASTASIS_truth_store (
-      is->ctx,
+      TALER_TESTING_interpreter_get_context (is),
       tss->anastasis_url,
       &tss->uuid,
       tss->method,
@@ -345,10 +338,8 @@ truth_store_traits (void *cls,
     ANASTASIS_TESTING_make_trait_truth_key (&tss->key),
     ANASTASIS_TESTING_make_trait_eks (&tss->encrypted_keyshare),
     ANASTASIS_TESTING_make_trait_payment_secret 
(&tss->payment_secret_response),
-    TALER_TESTING_make_trait_payto_uri (
-      (const char **) &tss->pay_uri),
-    ANASTASIS_TESTING_make_trait_filename (
-      (const char **) &tss->filename),
+    TALER_TESTING_make_trait_payto_uri (tss->pay_uri),
+    ANASTASIS_TESTING_make_trait_filename (tss->filename),
     TALER_TESTING_trait_end ()
   };
 
diff --git a/src/testing/testing_cmd_challenge_answer.c 
b/src/testing/testing_cmd_challenge_answer.c
index 8e5e2d8..ad24861 100644
--- a/src/testing/testing_cmd_challenge_answer.c
+++ b/src/testing/testing_cmd_challenge_answer.c
@@ -249,7 +249,7 @@ challenge_answer_run (void *cls,
   if (1 == cs->mode)
   {
     const struct TALER_TESTING_Command *ref;
-    const char **answer;
+    const char *answer;
     unsigned long long code;
     char dummy;
 
@@ -270,7 +270,7 @@ challenge_answer_run (void *cls,
       return;
     }
     if (1 !=
-        sscanf (*answer,
+        sscanf (answer,
                 "%llu%c",
                 &code,
                 &dummy))
@@ -544,14 +544,11 @@ challenge_create_traits (void *cls,
 {
   struct ChallengeState *cs = cls;
   struct TALER_TESTING_Trait traits[] = {
-    ANASTASIS_TESTING_make_trait_code (
-      (const char **) &cs->code),
+    ANASTASIS_TESTING_make_trait_code (cs->code),
     ANASTASIS_TESTING_make_trait_payment_secret (
       &cs->payment_order_req),
-    TALER_TESTING_make_trait_payto_uri (
-      (const char **) cs->payment_uri),
-    TALER_TESTING_make_trait_order_id (
-      (const char **) &cs->order_id),
+    TALER_TESTING_make_trait_payto_uri (cs->payment_uri),
+    TALER_TESTING_make_trait_order_id (cs->order_id),
     TALER_TESTING_trait_end ()
   };
 
diff --git a/src/testing/testing_cmd_recover_secret.c 
b/src/testing/testing_cmd_recover_secret.c
index 3b12012..81f2d64 100644
--- a/src/testing/testing_cmd_recover_secret.c
+++ b/src/testing/testing_cmd_recover_secret.c
@@ -74,7 +74,7 @@ struct RecoverSecretState
   /**
    * Coresecret to check if decryption worked
    */
-  const void **core_secret;
+  const void *core_secret;
 
   /**
    * Task scheduled to wait for recovery to complete.
@@ -146,7 +146,7 @@ core_secret_cb (void *cls,
     return;
   }
   if (0 != memcmp (secret,
-                   *rss->core_secret,
+                   rss->core_secret,
                    secret_size))
   {
     GNUNET_break (0);
@@ -220,22 +220,23 @@ recover_secret_run (void *cls,
     if (GNUNET_OK !=
         ANASTASIS_TESTING_get_trait_core_secret (
           ref,
-          (const void ***) &rss->core_secret))
+          &rss->core_secret))
     {
       GNUNET_break (0);
       TALER_TESTING_interpreter_fail (rss->is);
       return;
     }
   }
-  rss->recovery = ANASTASIS_recovery_begin (is->ctx,
-                                            rss->id_data,
-                                            rss->version,
-                                            rss->anastasis_url,
-                                            provider_salt,
-                                            &policy_lookup_cb,
-                                            rss,
-                                            &core_secret_cb,
-                                            rss);
+  rss->recovery = ANASTASIS_recovery_begin (
+    TALER_TESTING_interpreter_get_context (is),
+    rss->id_data,
+    rss->version,
+    rss->anastasis_url,
+    provider_salt,
+    &policy_lookup_cb,
+    rss,
+    &core_secret_cb,
+    rss);
   if (NULL == rss->recovery)
   {
     GNUNET_break (0);
diff --git a/src/testing/testing_cmd_secret_share.c 
b/src/testing/testing_cmd_secret_share.c
index 26a237d..70c97cf 100644
--- a/src/testing/testing_cmd_secret_share.c
+++ b/src/testing/testing_cmd_secret_share.c
@@ -135,14 +135,7 @@ secret_share_result_cb (void *cls,
   sss->sso = NULL;
   if (sr->ss != sss->want_status)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unexpected response code %u to command %s in %s:%u\n",
-                sr->ss,
-                sss->is->commands[sss->is->ip].label,
-                __FILE__,
-                __LINE__);
     TALER_TESTING_interpreter_fail (sss->is);
-    return;
   }
   switch (sr->ss)
   {
@@ -225,7 +218,7 @@ secret_share_run (void *cls,
   if (NULL != sss->prev_secret_share)
   {
     const struct TALER_TESTING_Command *ref;
-    const char **order_id;
+    const char *order_id;
 
     ref = TALER_TESTING_interpreter_lookup_command (is,
                                                     sss->prev_secret_share);
@@ -243,8 +236,7 @@ secret_share_run (void *cls,
       TALER_TESTING_interpreter_fail (sss->is);
       return;
     }
-    sss->payment_order_id = (char *) *order_id;
-
+    sss->payment_order_id = GNUNET_strdup (order_id);
     if (NULL == sss->payment_order_id)
     {
       GNUNET_break (0);
@@ -296,19 +288,20 @@ secret_share_run (void *cls,
     pds.provider_salt = *provider_salt;
   }
 
-  sss->sso = ANASTASIS_secret_share (is->ctx,
-                                     sss->id_data,
-                                     &pds,
-                                     1,
-                                     policies,
-                                     sss->cmd_label_array_length,
-                                     false,
-                                     GNUNET_TIME_UNIT_ZERO,
-                                     &secret_share_result_cb,
-                                     sss,
-                                     "test-case",
-                                     sss->core_secret,
-                                     sss->core_secret_size);
+  sss->sso = ANASTASIS_secret_share (
+    TALER_TESTING_interpreter_get_context (is),
+    sss->id_data,
+    &pds,
+    1,
+    policies,
+    sss->cmd_label_array_length,
+    false,
+    GNUNET_TIME_UNIT_ZERO,
+    &secret_share_result_cb,
+    sss,
+    "test-case",
+    sss->core_secret,
+    sss->core_secret_size);
   if (NULL == sss->sso)
   {
     GNUNET_break (0);
@@ -367,8 +360,7 @@ secret_share_traits (void *cls,
   struct TALER_TESTING_Trait traits[] = {
     TALER_TESTING_make_trait_claim_token (&sss->token),
     ANASTASIS_TESTING_make_trait_core_secret (&sss->core_secret),
-    TALER_TESTING_make_trait_order_id (
-      (const char **) &sss->payment_order_id),
+    TALER_TESTING_make_trait_order_id (sss->payment_order_id),
     TALER_TESTING_trait_end ()
   };
 
diff --git a/src/testing/testing_cmd_truth_upload.c 
b/src/testing/testing_cmd_truth_upload.c
index 89ba790..2e3523b 100644
--- a/src/testing/testing_cmd_truth_upload.c
+++ b/src/testing/testing_cmd_truth_upload.c
@@ -208,19 +208,20 @@ truth_upload_run (void *cls,
   ANASTASIS_CRYPTO_user_identifier_derive (tus->id_data,
                                            provider_salt,
                                            &user_id);
-  tus->tuo = ANASTASIS_truth_upload (is->ctx,
-                                     &user_id,
-                                     tus->anastasis_url,
-                                     tus->method,
-                                     tus->instructions,
-                                     tus->mime_type,
-                                     provider_salt,
-                                     tus->truth_data,
-                                     tus->truth_data_size,
-                                     false, /* force payment */
-                                     GNUNET_TIME_UNIT_ZERO,
-                                     &truth_upload_cb,
-                                     tus);
+  tus->tuo = ANASTASIS_truth_upload (
+    TALER_TESTING_interpreter_get_context (is),
+    &user_id,
+    tus->anastasis_url,
+    tus->method,
+    tus->instructions,
+    tus->mime_type,
+    provider_salt,
+    tus->truth_data,
+    tus->truth_data_size,
+    false,                                  /* force payment */
+    GNUNET_TIME_UNIT_ZERO,
+    &truth_upload_cb,
+    tus);
   if (NULL == tus->tuo)
   {
     GNUNET_break (0);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]