[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: fix ftbfs of testing/
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: fix ftbfs of testing/ |
Date: |
Wed, 10 Feb 2021 11:18:32 +0100 |
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 92cb569 fix ftbfs of testing/
92cb569 is described below
commit 92cb56962130e6def14b61ffed19ebe61de2d78c
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Feb 10 11:18:30 2021 +0100
fix ftbfs of testing/
---
src/include/anastasis_testing_lib.h | 4 +-
src/testing/Makefile.am | 2 +-
..._truth_pub.c => testing_api_trait_truth_uuid.c} | 12 +--
src/testing/testing_cmd_challenge_start.c | 92 +++++++++++-----------
src/testing/testing_cmd_secret_share.c | 41 ++++------
src/testing/testing_cmd_truth_upload.c | 70 ++++++++++++----
6 files changed, 124 insertions(+), 97 deletions(-)
diff --git a/src/include/anastasis_testing_lib.h
b/src/include/anastasis_testing_lib.h
index 6263f03..2a6d9d8 100644
--- a/src/include/anastasis_testing_lib.h
+++ b/src/include/anastasis_testing_lib.h
@@ -239,7 +239,6 @@ ANASTASIS_TESTING_make_trait_eks (
const struct ANASTASIS_CRYPTO_EncryptedKeyShareP *eks);
-#if 0
/**
* Obtain a code from @a cmd.
*
@@ -254,6 +253,7 @@ ANASTASIS_TESTING_get_trait_code (
unsigned int index,
const char **code);
+
/**
* Offer a filename.
*
@@ -265,8 +265,6 @@ struct TALER_TESTING_Trait
ANASTASIS_TESTING_make_trait_code (unsigned int index,
const char *code);
-#endif
-
/**
* Prepare the merchant execution. Create tables and check if
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index 947f87a..c45a31f 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -22,7 +22,7 @@ libanastasistesting_la_SOURCES = \
testing_api_trait_account_pub.c \
testing_api_trait_account_priv.c \
testing_api_trait_payment_identifier.c \
- testing_api_trait_truth_pub.c \
+ testing_api_trait_truth_uuid.c \
testing_api_trait_hash.c \
testing_api_trait_salt.c \
testing_api_trait_code.c \
diff --git a/src/testing/testing_api_trait_truth_pub.c
b/src/testing/testing_api_trait_truth_uuid.c
similarity index 85%
rename from src/testing/testing_api_trait_truth_pub.c
rename to src/testing/testing_api_trait_truth_uuid.c
index 2b32949..38a7336 100644
--- a/src/testing/testing_api_trait_truth_pub.c
+++ b/src/testing/testing_api_trait_truth_uuid.c
@@ -18,7 +18,7 @@
*/
/**
* @file lib/testing_api_trait_truth_pub.c
- * @brief traits to offer a hash
+ * @brief traits to offer a UUID for some truth
* @author Christian Grothoff
* @author Dominik Meister
* @author Dennis Neufeld
@@ -26,7 +26,7 @@
#include "platform.h"
#include "anastasis_testing_lib.h"
-#define ANASTASIS_TESTING_TRAIT_TRUTH_PUB "anastasis-truth-pub"
+#define ANASTASIS_TESTING_TRAIT_TRUTH_UUID "anastasis-truth-uuid"
/**
@@ -38,14 +38,14 @@
* @return #GNUNET_OK on success.
*/
int
-ANASTASIS_TESTING_get_trait_truth_public_key
+ANASTASIS_TESTING_get_trait_truth_uuid
(const struct TALER_TESTING_Command *cmd,
unsigned int index,
const struct ANASTASIS_CRYPTO_TruthUUIDP **tpk)
{
return cmd->traits (cmd->cls,
(const void **) tpk,
- ANASTASIS_TESTING_TRAIT_TRUTH_PUB,
+ ANASTASIS_TESTING_TRAIT_TRUTH_UUID,
index);
}
@@ -58,13 +58,13 @@ ANASTASIS_TESTING_get_trait_truth_public_key
* @return #GNUNET_OK on success.
*/
struct TALER_TESTING_Trait
-ANASTASIS_TESTING_make_trait_truth_public_key
+ANASTASIS_TESTING_make_trait_truth_uuid
(unsigned int index,
const struct ANASTASIS_CRYPTO_TruthUUIDP *tpk)
{
struct TALER_TESTING_Trait ret = {
.index = index,
- .trait_name = ANASTASIS_TESTING_TRAIT_TRUTH_PUB,
+ .trait_name = ANASTASIS_TESTING_TRAIT_TRUTH_UUID,
.ptr = (const void *) tpk
};
return ret;
diff --git a/src/testing/testing_cmd_challenge_start.c
b/src/testing/testing_cmd_challenge_start.c
index 7d6f2fa..a0b4517 100644
--- a/src/testing/testing_cmd_challenge_start.c
+++ b/src/testing/testing_cmd_challenge_start.c
@@ -14,7 +14,7 @@
Anastasis; see the file COPYING.GPL. If not, see
<http://www.gnu.org/licenses/>
*/
/**
- * @file lib/testing_cmd_challenge_answer.c
+ * @file lib/testing_cmd_challenge_start.c
* @brief command to execute the anastasis recovery service
* @author Christian Grothoff
* @author Dennis Neufeld
@@ -32,25 +32,12 @@
*/
struct ChallengeState
{
- /**
- * Claim token we got back, if any. Otherwise all zeros.
- */
- struct TALER_ClaimTokenP token;
+
/**
* The interpreter state.
*/
struct TALER_TESTING_Interpreter *is;
- /**
- * Reference to the challenge we are solving
- */
- struct ANASTASIS_Challenge *c;
-
- /**
- * Expected status code.
- */
- unsigned int http_status;
-
/**
* Answer to the challenge we are solving
*/
@@ -82,9 +69,9 @@ struct ChallengeState
struct ANASTASIS_PaymentSecretP payment_order_req;
/**
- * True if @e payment_order_req is initialized.
+ * Expected status code.
*/
- bool payment_order_set;
+ unsigned int http_status;
/**
* code we read in the file generated by the plugin
@@ -177,12 +164,10 @@ challenge_start_create_traits (void *cls,
struct TALER_TESTING_Trait traits[] = {
ANASTASIS_TESTING_make_trait_code (0,
cs->code),
- // FIXME: missmatch, need to fix traits!
- TALER_TESTING_make_trait_order_id (0,
- cs->payment_url),
- TALER_TESTING_make_trait_claim_token (0,
- &cs->token),
-
+ ANASTASIS_TESTING_make_trait_payment_secret (0,
+ &cs->payment_order_req),
+ TALER_TESTING_make_trait_url (TALER_TESTING_UT_TALER_URL,
+ cs->payment_uri),
TALER_TESTING_trait_end ()
};
@@ -206,34 +191,58 @@ challenge_start_run (void *cls,
struct TALER_TESTING_Interpreter *is)
{
struct ChallengeState *cs = cls;
- const struct TALER_TESTING_Command *ref;
const struct ANASTASIS_Challenge *c;
+ const struct TALER_TESTING_Command *ref;
+ const struct ANASTASIS_PaymentSecretP *ps;
cs->is = is;
- if (NULL != cs->challenge_ref)
+ ref = TALER_TESTING_interpreter_lookup_command (
+ is,
+ cs->challenge_ref);
+ if (NULL == ref)
+ {
+ GNUNET_break (0);
+ TALER_TESTING_interpreter_fail (cs->is);
+ return;
+ }
+ if (GNUNET_OK !=
+ ANASTASIS_TESTING_get_trait_challenge (ref,
+ cs->challenge_index,
+ &c))
+ {
+ GNUNET_break (0);
+ TALER_TESTING_interpreter_fail (cs->is);
+ return;
+ }
+ if (NULL != tus->paid_order_ref)
{
- ref = TALER_TESTING_interpreter_lookup_command (
- is,
- cs->challenge_ref);
+ const struct TALER_TESTING_Command *ref;
+
+ ref = TALER_TESTING_interpreter_lookup_command (is,
+ cs->payment_ref);
if (NULL == ref)
{
GNUNET_break (0);
- TALER_TESTING_interpreter_fail (cs->is);
+ TALER_TESTING_interpreter_fail (tus->is);
return;
}
if (GNUNET_OK !=
- ANASTASIS_TESTING_get_trait_challenge (ref,
- cs->challenge_index,
- &c))
+ ANASTASIS_TESTING_get_trait_payment_secret (ref,
+ 0,
+ &ps))
{
GNUNET_break (0);
- TALER_TESTING_interpreter_fail (cs->is);
+ TALER_TESTING_interpreter_fail (tus->is);
return;
}
}
+ else
+ {
+ ps = NULL;
+ }
if (GNUNET_OK !=
ANASTASIS_challenge_start ((struct ANASTASIS_Challenge *) c,
- NULL, /* FIXME: pass payment secret! */
+ ps,
&challenge_start_cb,
cs))
{
@@ -256,25 +265,17 @@ challenge_start_cleanup (void *cls,
const struct TALER_TESTING_Command *cmd)
{
struct ChallengeState *cs = cls;
+
+ GNUNET_free (cs->payment_url);
GNUNET_free (cs);
}
-/**
- * Make the "challenge answer" command.
- *
- * @param label command label
- * @param http_status expected HTTP status.
- * @param challenge_ref reference to the recovery process
- * @param challenge_index defines the index of the trait to solve
- * @param answer to the challenge
- * @param answer_size size of the answer
- * @return the command
- */
struct TALER_TESTING_Command
ANASTASIS_TESTING_cmd_challenge_start (const char *label,
unsigned int http_status,
const char *challenge_ref,
+ const char *payment_ref,
unsigned int challenge_index)
{
struct ChallengeState *cs;
@@ -282,6 +283,7 @@ ANASTASIS_TESTING_cmd_challenge_start (const char *label,
cs = GNUNET_new (struct ChallengeState);
cs->http_status = http_status;
cs->challenge_ref = challenge_ref;
+ cs->payment_ref = payment_ref;
cs->challenge_index = challenge_index;
{
struct TALER_TESTING_Command cmd = {
diff --git a/src/testing/testing_cmd_secret_share.c
b/src/testing/testing_cmd_secret_share.c
index 5a9b5dc..a6bb54a 100644
--- a/src/testing/testing_cmd_secret_share.c
+++ b/src/testing/testing_cmd_secret_share.c
@@ -128,9 +128,6 @@ secret_share_result_cb (void *cls,
struct SecretShareState *sss = cls;
sss->sso = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "At %s:%d we are in SRC\n",
- __FILE__, __LINE__);
if (sr->ss != sss->want_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -205,13 +202,9 @@ secret_share_run (void *cls,
const struct TALER_TESTING_Command *ref;
const struct ANASTASIS_Policy *policy;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "At %s:%d policy create cmd is %s\n", __FILE__, __LINE__,
- sss->cmd_label_array[i]);
-
- ref = TALER_TESTING_interpreter_lookup_command
- (is,
- sss->cmd_label_array[i]);
+ ref = TALER_TESTING_interpreter_lookup_command (
+ is,
+ sss->cmd_label_array[i]);
if (NULL == ref)
{
GNUNET_break (0);
@@ -417,28 +410,22 @@ ANASTASIS_TESTING_cmd_secret_share (
const char *policy_create_cmd;
while (NULL != (policy_create_cmd = va_arg (ap, const char *)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "At %s:%d policy create cmd is %s\n", __FILE__, __LINE__,
- policy_create_cmd);
GNUNET_array_append (sss->cmd_label_array,
sss->cmd_label_array_length,
policy_create_cmd);
}
va_end (ap);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "At %s:%d cmd label array length is %i\n", __FILE__, __LINE__,
- sss->cmd_label_array_length);
-
- struct TALER_TESTING_Command cmd = {
- .cls = sss,
- .label = label,
- .run = &secret_share_run,
- .cleanup = &secret_share_cleanup,
- .traits = &secret_share_traits
- };
-
- return cmd;
+ {
+ struct TALER_TESTING_Command cmd = {
+ .cls = sss,
+ .label = label,
+ .run = &secret_share_run,
+ .cleanup = &secret_share_cleanup,
+ .traits = &secret_share_traits
+ };
+
+ return cmd;
+ }
}
diff --git a/src/testing/testing_cmd_truth_upload.c
b/src/testing/testing_cmd_truth_upload.c
index 1d858af..91b8647 100644
--- a/src/testing/testing_cmd_truth_upload.c
+++ b/src/testing/testing_cmd_truth_upload.c
@@ -74,9 +74,15 @@ struct TruthUploadState
const void *truth_data;
/**
- * Already paid order ID for this upload, or NULL
+ * Command to a previous truth upload from which to take the
+ * @a payment_secret_request.
*/
- const char *paid_order_id;
+ const char *paid_order_ref;
+
+ /**
+ * Requested order ID for this upload (if unpaid).
+ */
+ struct ANASTASIS_PaymentSecretP payment_secret_response;
/**
* Size of truth_data
@@ -135,6 +141,8 @@ truth_upload_cb (void *cls,
if (NULL == t)
{
// FIXME: handle payment!
+ // tus->payment_secret_response = XXX;
+
GNUNET_break (0);
TALER_TESTING_interpreter_fail (tus->is);
return;
@@ -160,6 +168,7 @@ truth_upload_run (void *cls,
const struct TALER_TESTING_Command *ref;
const struct ANASTASIS_CRYPTO_PowSalt *salt;
struct ANASTASIS_CRYPTO_UserIdentifierP user_id;
+ const struct ANASTASIS_PaymentSecretP *ps;
tus->is = is;
if (NULL != tus->upload_reference)
@@ -184,6 +193,33 @@ truth_upload_run (void *cls,
}
}
+ if (NULL != tus->paid_order_ref)
+ {
+ const struct TALER_TESTING_Command *ref;
+
+ ref = TALER_TESTING_interpreter_lookup_command (is,
+ tus->paid_order_ref);
+ if (NULL == ref)
+ {
+ GNUNET_break (0);
+ TALER_TESTING_interpreter_fail (tus->is);
+ return;
+ }
+ if (GNUNET_OK !=
+ ANASTASIS_TESTING_get_trait_payment_secret (ref,
+ 0,
+ &ps))
+ {
+ GNUNET_break (0);
+ TALER_TESTING_interpreter_fail (tus->is);
+ return;
+ }
+ }
+ else
+ {
+ ps = NULL;
+ }
+
ANASTASIS_CRYPTO_user_identifier_derive (tus->id_data,
salt,
&user_id);
@@ -198,7 +234,7 @@ truth_upload_run (void *cls,
tus->truth_data,
tus->truth_data_size,
false, /* force payment */
- tus->paid_order_id,
+ ps,
&truth_upload_cb,
tus);
if (NULL == tus->tuo)
@@ -236,6 +272,7 @@ truth_upload_cleanup (void *cls,
if (NULL != tus->truth)
{
ANASTASIS_truth_free (tus->truth);
+ tus->truth = NULL;
}
GNUNET_free (tus);
}
@@ -260,6 +297,8 @@ truth_upload_traits (void *cls,
struct TALER_TESTING_Trait traits[] = {
ANASTASIS_TESTING_make_trait_truth (0,
tus->truth),
+ ANASTASIS_TESTING_make_trait_payment_secret (0,
+
&tus->payment_secret_response),
TALER_TESTING_trait_end ()
};
@@ -293,7 +332,7 @@ ANASTASIS_TESTING_cmd_truth_upload (
const char *mime_type,
const void *truth_data,
size_t truth_data_size,
- const char *paid_order_id,
+ const char *paid_order_ref,
unsigned int http_status,
enum ANASTASIS_TESTING_TruthStoreOption tso,
const char *upload_ref)
@@ -310,19 +349,20 @@ ANASTASIS_TESTING_cmd_truth_upload (
tus->method = method;
tus->instructions = instructions;
tus->mime_type = mime_type;
- tus->paid_order_id = paid_order_id;
+ tus->paid_order_ref = paid_order_ref;
tus->truth_data_size = truth_data_size;
tus->truth_data = truth_data;
-
- struct TALER_TESTING_Command cmd = {
- .cls = tus,
- .label = label,
- .run = &truth_upload_run,
- .cleanup = &truth_upload_cleanup,
- .traits = &truth_upload_traits
- };
-
- return cmd;
+ {
+ struct TALER_TESTING_Command cmd = {
+ .cls = tus,
+ .label = label,
+ .run = &truth_upload_run,
+ .cleanup = &truth_upload_cleanup,
+ .traits = &truth_upload_traits
+ };
+
+ return cmd;
+ }
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-anastasis] branch master updated: fix ftbfs of testing/,
gnunet <=