From a2dde02b64a8ee75c9243632eb45a6ceb9b62dd5 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 7 Jun 2023 23:11:05 +0200 Subject: major libtalertesting API refactoring, including no longer having taler-specific logic in the test engine core --- src/testing/testing_api_cmd_batch.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'src/testing/testing_api_cmd_batch.c') diff --git a/src/testing/testing_api_cmd_batch.c b/src/testing/testing_api_cmd_batch.c index d81a7767..bd6454a5 100644 --- a/src/testing/testing_api_cmd_batch.c +++ b/src/testing/testing_api_cmd_batch.c @@ -37,6 +37,11 @@ struct BatchState */ struct TALER_TESTING_Command *batch; + /** + * My command (the batch command). + */ + const struct TALER_TESTING_Command *cmd; + /** * Internal command pointer. */ @@ -58,6 +63,7 @@ batch_run (void *cls, { struct BatchState *bs = cls; + bs->cmd = cmd; if (NULL != bs->batch[bs->batch_ip].label) TALER_LOG_INFO ("Running batched command: %s\n", bs->batch[bs->batch_ip].label); @@ -167,19 +173,33 @@ TALER_TESTING_cmd_batch (const char *label, } -void -TALER_TESTING_cmd_batch_next (struct TALER_TESTING_Interpreter *is) +bool +TALER_TESTING_cmd_batch_next (struct TALER_TESTING_Interpreter *is, + void *cls) { - struct BatchState *bs = is->commands[is->ip].cls; + struct BatchState *bs = cls; + struct TALER_TESTING_Command *bcmd = &bs->batch[bs->batch_ip]; - if (NULL == bs->batch[bs->batch_ip].label) + if (NULL == bcmd->label) { - is->commands[is->ip].finish_time = GNUNET_TIME_absolute_get (); - is->ip++; - return; + /* This batch is done */ + return true; + } + if (TALER_TESTING_cmd_is_batch (bcmd)) + { + if (TALER_TESTING_cmd_batch_next (is, + bcmd->cls)) + { + /* sub-batch is done */ + bcmd->finish_time = GNUNET_TIME_absolute_get (); + bs->batch_ip++; + return false; + } } - bs->batch[bs->batch_ip].finish_time = GNUNET_TIME_absolute_get (); + /* Simple command is done */ + bcmd->finish_time = GNUNET_TIME_absolute_get (); bs->batch_ip++; + return false; } -- cgit v1.2.3