[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] 273/277: use improved rewind API
From: |
gnunet |
Subject: |
[taler-merchant] 273/277: use improved rewind API |
Date: |
Sun, 05 Jul 2020 20:53:06 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
commit c4dc3bf39183559ddcfeafba65ef3d8635bc13fe
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Jul 3 20:59:37 2020 +0200
use improved rewind API
---
src/include/taler_merchant_testing_lib.h | 23 -----
src/merchant-tools/taler-merchant-benchmark.c | 23 ++---
src/testing/Makefile.am | 1 -
src/testing/testing_api_cmd_rewind.c | 120 --------------------------
4 files changed, 8 insertions(+), 159 deletions(-)
diff --git a/src/include/taler_merchant_testing_lib.h
b/src/include/taler_merchant_testing_lib.h
index cad54e7..7b97815 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -1515,27 +1515,4 @@ TALER_TESTING_get_trait_refund_entry ( // FIXME: rename:
entry->detail
const struct TALER_MERCHANT_RefundDetail **refund_entry);
-/**
- * Make the instruction pointer point to @a new_ip
- * only if @a counter is greater than zero.
- *
- * FIXME: this seems to be a BAD API! Proposal: replace "new_ip"
- * with a 'const char *' that is the _label_ of the target
- * command (not an offset, and not -1!). Also, this command
- * should probably be moved to the *exchange* codebase.
- *
- * @param label command label
- * @param new_ip new instruction pointer's value. Note that,
- * when the next instruction will be called, the interpreter
- * will increment the ip _anyway_ so this value must be
- * set to the index of the instruction we want to execute next
- * MINUS one.
- * @param counter counts how many times the rewinding has
- * to happen.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_rewind_ip (const char *label,
- int new_ip,
- unsigned int *counter);
-
#endif
diff --git a/src/merchant-tools/taler-merchant-benchmark.c
b/src/merchant-tools/taler-merchant-benchmark.c
index ac34899..e410927 100644
--- a/src/merchant-tools/taler-merchant-benchmark.c
+++ b/src/merchant-tools/taler-merchant-benchmark.c
@@ -65,13 +65,6 @@ enum PaymentGeneratorError
};
-/* Arguments for #TALER_TESTING_cmd_rewind_ip(). FIXME: should probably be
- replaced with labels? Bad style! */
-#define FIRST_INSTRUCTION -1
-#define TRACKS_INSTRUCTION 9
-#define TWOCOINS_INSTRUCTION 5
-
-
/**
* What API key should we send in the HTTP 'Authorization' header?
*/
@@ -280,8 +273,8 @@ run (void *cls,
CURRENCY_5,
CURRENCY_4_99),
TALER_TESTING_cmd_rewind_ip ("rewind-payments",
- FIRST_INSTRUCTION,
- &payments_number),
+ "create-reserve",
+ payments_number),
/* Next proposal-pay cycle will be used by /track CMDs
* and so it will not have to be looped over, only /track
* CMDs will have to. */
@@ -316,8 +309,8 @@ run (void *cls,
"post-transaction-1",
NULL),
TALER_TESTING_cmd_rewind_ip ("rewind-tracks",
- TRACKS_INSTRUCTION,
- &tracks_number),
+ "track-transfer-1",
+ tracks_number),
TALER_TESTING_cmd_end ()
};
@@ -351,8 +344,8 @@ run (void *cls,
CURRENCY_5,
CURRENCY_4_99),
TALER_TESTING_cmd_rewind_ip ("rewind-unaggregated",
- FIRST_INSTRUCTION,
- &unaggregated_number),
+ "create-reserve-1",
+ unaggregated_number),
TALER_TESTING_cmd_admin_add_incoming ("create-reserve-2",
CURRENCY_10_02,
&bc.exchange_auth,
@@ -381,8 +374,8 @@ run (void *cls,
TALER_TESTING_cmd_exec_aggregator ("aggregate-twocoins",
cfg_filename),
TALER_TESTING_cmd_rewind_ip ("rewind-twocoins",
- TWOCOINS_INSTRUCTION,
- &twocoins_number),
+ "create-reserve-2",
+ twocoins_number),
TALER_TESTING_cmd_end ()
};
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index 6852e4a..8ba034b 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -43,7 +43,6 @@ libtalermerchanttesting_la_SOURCES = \
testing_api_cmd_patch_product.c \
testing_api_cmd_refund_order.c \
\
- testing_api_cmd_rewind.c \
testing_api_cmd_tip_authorize.c \
testing_api_cmd_tip_pickup.c \
testing_api_cmd_wallet_get_order.c \
diff --git a/src/testing/testing_api_cmd_rewind.c
b/src/testing/testing_api_cmd_rewind.c
deleted file mode 100644
index 2e43b75..0000000
--- a/src/testing/testing_api_cmd_rewind.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2014-2018 Taler Systems SA
-
- TALER 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 Foundation; either version 3, or
- (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with TALER; see the file COPYING. If not, see
- <http://www.gnu.org/licenses/>
-*/
-
-/**
- * @file lib/testing_api_cmd_rewind.c
- * @brief command to rewind the instruction pointer.
- * @author Marcello Stanisci
- */
-
-#include "platform.h"
-#include <taler/taler_exchange_service.h>
-#include <taler/taler_testing_lib.h>
-#include "taler_merchant_service.h"
-#include "taler_merchant_testing_lib.h"
-
-
-/**
- * State for a "rewind" CMD.
- */
-struct RewindIpState
-{
- /**
- * Instruction pointer to set into the interpreter.
- */
- unsigned int new_ip;
-
- /**
- * How many times this set should take place.
- * However, this value lives at the calling process,
- * and this CMD is only in charge of checking and
- * decremeting it.
- */
- unsigned int *counter;
-};
-
-
-/**
- * Only defined to respect the API.
- */
-static void
-rewind_ip_cleanup (void *cls,
- const struct TALER_TESTING_Command *cmd)
-{
-}
-
-
-/**
- * Run the "rewind" CMD.
- *
- * @param cls closure.
- * @param cmd command being executed now.
- * @param is the interpreter state.
- */
-static void
-rewind_ip_run (void *cls,
- const struct TALER_TESTING_Command *cmd,
- struct TALER_TESTING_Interpreter *is)
-{
- struct RewindIpState *ris = cls;
-
- if (1 < *ris->counter)
- {
- is->ip = ris->new_ip;
- *ris->counter -= 1;
- }
-
- TALER_TESTING_interpreter_next (is);
-}
-
-
-/**
- * Make the instruction pointer point to @a new_ip
- * only if @a counter is greater than zero.
- *
- * @param label command label
- * @param new_ip new instruction pointer's value. Note that,
- * when the next instruction will be called, the interpreter
- * will increment the ip _anyway_ so this value must be
- * set to the index of the instruction we want to execute next
- * MINUS one.
- * @param counter counts how many times the rewinding has
- * to happen.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_rewind_ip
- (const char *label,
- int new_ip,
- unsigned int *counter)
-{
- struct RewindIpState *ris;
-
- ris = GNUNET_new (struct RewindIpState);
- ris->new_ip = new_ip;
- ris->counter = counter;
-
- struct TALER_TESTING_Command cmd = {
- .cls = ris,
- .label = label,
- .run = &rewind_ip_run,
- .cleanup = &rewind_ip_cleanup
- };
-
- return cmd;
-}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-merchant] 262/277: deduplicate logic, (continued)
- [taler-merchant] 262/277: deduplicate logic, gnunet, 2020/07/05
- [taler-merchant] 264/277: filler max_upload values for all POST/PATCH handlers, gnunet, 2020/07/05
- [taler-merchant] 265/277: got tips test working again, gnunet, 2020/07/05
- [taler-merchant] 261/277: removed hardcoded row numbers from backenddb tests, gnunet, 2020/07/05
- [taler-merchant] 263/277: long polling test for GET /private/orders, gnunet, 2020/07/05
- [taler-merchant] 270/277: twister, get tips, instance, and post transfer tests, gnunet, 2020/07/05
- [taler-merchant] 259/277: more docs/thorough checks for backend db & long polling for merchant get order, gnunet, 2020/07/05
- [taler-merchant] 266/277: get reserve and tip testing commands use variadic args, gnunet, 2020/07/05
- [taler-merchant] 267/277: get pay-again and pay-abort working again, gnunet, 2020/07/05
- [taler-merchant] 272/277: more merchant benchmark cleanup, gnunet, 2020/07/05
- [taler-merchant] 273/277: use improved rewind API,
gnunet <=
- [taler-merchant] 274/277: test GET /private/transfers, gnunet, 2020/07/05
- [taler-merchant] 275/277: fix compiler warnings for test_merchantdb.c, gnunet, 2020/07/05
- [taler-merchant] 268/277: improved db tests for transfers, gnunet, 2020/07/05
- [taler-merchant] 269/277: removed outdated test code, gnunet, 2020/07/05
- [taler-merchant] 271/277: some clean up of merchant benchmark code, gnunet, 2020/07/05
- [taler-merchant] 276/277: avoid allocation, gnunet, 2020/07/05
- [taler-merchant] 277/277: GNUNET_free_non_null -> GNUNET_free rename, gnunet, 2020/07/05