Implement batch-execution of CMDs. More...
Go to the source code of this file.
Data Structures | |
struct | BatchState |
State for a "batch" CMD. More... | |
Macros | |
#define | CURRENT_CMD_INDEX 0 |
#define | BATCH_INDEX 1 |
Functions | |
static void | batch_run (void *cls, struct GNUNET_TESTING_Interpreter *is) |
Run the command. More... | |
static void | batch_cleanup (void *cls) |
Cleanup the state from a "reserve status" CMD, and possibly cancel a pending operation thereof. More... | |
static enum GNUNET_GenericReturnValue | batch_traits (void *cls, const void **ret, const char *trait, unsigned int index) |
Offer internal data from a "batch" CMD, to other commands. More... | |
struct GNUNET_TESTING_Command | GNUNET_TESTING_cmd_batch (const char *label, struct GNUNET_TESTING_Command *batch) |
Create a "batch" command. More... | |
bool | GNUNET_TESTING_cmd_batch_next_ (void *cls) |
Advance internal pointer to next command. More... | |
bool | GNUNET_TESTING_cmd_is_batch_ (const struct GNUNET_TESTING_Command *cmd) |
Test if this command is a batch command. More... | |
struct GNUNET_TESTING_Command * | GNUNET_TESTING_cmd_batch_get_current_ (const struct GNUNET_TESTING_Command *cmd) |
Obtain what command the batch is at. More... | |
void | GNUNET_TESTING_cmd_batch_set_current_ (const struct GNUNET_TESTING_Command *cmd, unsigned int new_ip) |
Set what command the batch should be at. More... | |
Implement batch-execution of CMDs.
Definition in file testing_api_cmd_batch.c.
#define CURRENT_CMD_INDEX 0 |
#define BATCH_INDEX 1 |
|
static |
Run the command.
cls | closure. |
is | the interpreter state. |
Definition at line 60 of file testing_api_cmd_batch.c.
References BatchState::batch, BatchState::batch_ip, GNUNET_TESTING_Command::cls, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_TIME_absolute_get(), is, GNUNET_TESTING_Command::label, BatchState::label, GNUNET_TESTING_Command::last_req_time, GNUNET_TESTING_Command::num_tries, GNUNET_TESTING_Command::run, GNUNET_TESTING_Command::start_time, and GNUNET_TESTING_CommandLabel::value.
Referenced by GNUNET_TESTING_cmd_batch(), and GNUNET_TESTING_cmd_is_batch_().
|
static |
Cleanup the state from a "reserve status" CMD, and possibly cancel a pending operation thereof.
cls | closure. |
Definition at line 94 of file testing_api_cmd_batch.c.
References BatchState::batch, GNUNET_TESTING_Command::cleanup, GNUNET_TESTING_Command::cls, GNUNET_free, and GNUNET_TESTING_Command::run.
Referenced by GNUNET_TESTING_cmd_batch().
|
static |
Offer internal data from a "batch" CMD, to other commands.
cls | closure. | |
[out] | ret | result. |
trait | name of the trait. | |
index | index number of the object to offer. |
Definition at line 117 of file testing_api_cmd_batch.c.
References BatchState::batch, BATCH_INDEX, BatchState::batch_ip, CURRENT_CMD_INDEX, GNUNET_TESTING_get_trait(), GNUNET_TESTING_make_trait_cmd(), GNUNET_TESTING_trait_end(), GNUNET_TESTING_Trait::index, and ret.
Referenced by GNUNET_TESTING_cmd_batch().
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_batch | ( | const char * | label, |
struct GNUNET_TESTING_Command * | batch | ||
) |
Create a "batch" command.
Such command takes a end_CMD-terminated array of CMDs and executed them. Once it hits the end CMD, it passes the control to the next top-level CMD, regardless of it being another batch or ordinary CMD.
label | the command label. |
batch | array of CMDs to execute. |
Definition at line 155 of file testing_api_cmd_batch.c.
References BatchState::batch, batch_cleanup(), batch_run(), batch_traits(), GNUNET_new, GNUNET_new_array, GNUNET_TESTING_command_new(), GNUNET_TESTING_set_label(), BatchState::label, and GNUNET_TESTING_Command::run.
bool GNUNET_TESTING_cmd_batch_next_ | ( | void * | cls | ) |
Advance internal pointer to next command.
cls | batch internal state |
Definition at line 183 of file testing_api_cmd_batch.c.
References BatchState::batch, BatchState::batch_ip, GNUNET_TESTING_Command::finish_time, GNUNET_TIME_absolute_get(), and GNUNET_TESTING_Command::run.
Referenced by interpreter_next().
bool GNUNET_TESTING_cmd_is_batch_ | ( | const struct GNUNET_TESTING_Command * | cmd | ) |
Test if this command is a batch command.
Definition at line 197 of file testing_api_cmd_batch.c.
References batch_run(), and GNUNET_TESTING_Command::run.
Referenced by get_command(), GNUNET_TESTING_cmd_batch_get_current_(), GNUNET_TESTING_cmd_batch_set_current_(), GNUNET_TESTING_interpreter_fail(), and interpreter_next().
struct GNUNET_TESTING_Command * GNUNET_TESTING_cmd_batch_get_current_ | ( | const struct GNUNET_TESTING_Command * | cmd | ) |
Obtain what command the batch is at.
Definition at line 204 of file testing_api_cmd_batch.c.
References BatchState::batch, BatchState::batch_ip, GNUNET_TESTING_Command::cls, GNUNET_assert, and GNUNET_TESTING_cmd_is_batch_().
Referenced by get_command(), and GNUNET_TESTING_interpreter_fail().
void GNUNET_TESTING_cmd_batch_set_current_ | ( | const struct GNUNET_TESTING_Command * | cmd, |
unsigned int | new_ip | ||
) |
Set what command the batch should be at.
Needed for loops. We may want to change this to take a label and/or expose it in the public API in the future. Not used for now.
cmd | current batch command |
new_ip | where to move the IP |
Definition at line 214 of file testing_api_cmd_batch.c.
References BatchState::batch_ip, GNUNET_TESTING_Command::cls, GNUNET_assert, and GNUNET_TESTING_cmd_is_batch_().