Implement batch-execution of CMDs. More...
#include "platform.h"
#include "gnunet_testing_lib.h"
#include "testing_api_cmd_batch.h"
#include "testing_api_loop.h"
Go to the source code of this file.
Data Structures | |
struct | BatchState |
State for a "batch" CMD. More... | |
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.
|
static |
Run the command.
cls | closure. |
is | the interpreter state. |
Definition at line 61 of file testing_api_cmd_batch.c.
References BatchState::batch, BatchState::batch_ip, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_TESTING_interpreter_next_(), GNUNET_TESTING_interpreter_run_cmd_(), is, GNUNET_TESTING_Command::label, BatchState::label, GNUNET_TESTING_Command::run, and GNUNET_TESTING_CommandLabel::value.
Referenced by GNUNET_TESTING_cmd_batch(), GNUNET_TESTING_cmd_batch_set_current_(), 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, BatchState::batch_ip, GNUNET_TESTING_get_trait(), GNUNET_TESTING_make_trait_batch_cmds(), GNUNET_TESTING_make_trait_cmd(), GNUNET_TESTING_trait_end(), GNUNET_TESTING_Trait::index, ret, and traits().
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 150 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 178 of file testing_api_cmd_batch.c.
References BatchState::batch, BatchState::batch_ip, GNUNET_TESTING_Command::cls, GNUNET_TESTING_Command::finish_time, GNUNET_TESTING_cmd_batch_next_(), GNUNET_TESTING_cmd_is_batch_(), GNUNET_TIME_absolute_get(), and GNUNET_TESTING_Command::run.
Referenced by GNUNET_TESTING_cmd_batch_next_(), and GNUNET_TESTING_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 203 of file testing_api_cmd_batch.c.
References batch_run(), and GNUNET_TESTING_Command::run.
Referenced by do_stat(), GNUNET_TESTING_cmd_batch_get_current_(), GNUNET_TESTING_cmd_batch_next_(), GNUNET_TESTING_interpreter_fail(), GNUNET_TESTING_interpreter_lookup_command(), GNUNET_TESTING_interpreter_next_(), GNUNET_TESTING_interpreter_run_cmd_(), rewind_ip_run(), and seek_batch().
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 210 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_().
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.
cmd | current batch command |
new_ip | where to move the IP |
Definition at line 220 of file testing_api_cmd_batch.c.
References BatchState::batch, BatchState::batch_ip, batch_run(), GNUNET_TESTING_Command::cls, GNUNET_assert, and GNUNET_TESTING_Command::run.
Referenced by seek_batch().