GNUnet 0.22.0
testing_api_cmd_batch.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool GNUNET_TESTING_cmd_is_batch_ (const struct GNUNET_TESTING_Command *cmd)
 Test if this command is a batch command. More...
 
bool GNUNET_TESTING_cmd_batch_next_ (void *cls)
 Advance internal pointer to next command. More...
 
struct GNUNET_TESTING_CommandGNUNET_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...
 

Detailed Description

Author
t3sserakt

Definition in file testing_api_cmd_batch.h.

Function Documentation

◆ GNUNET_TESTING_cmd_is_batch_()

bool GNUNET_TESTING_cmd_is_batch_ ( const struct GNUNET_TESTING_Command cmd)

Test if this command is a batch command.

Returns
false if not, true if it is a batch command

Definition at line 203 of file testing_api_cmd_batch.c.

204{
205 return cmd->run == &batch_run;
206}
GNUNET_TESTING_CommandRunRoutine run
Runs the command.
static void batch_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
Run the command.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTING_cmd_batch_next_()

bool GNUNET_TESTING_cmd_batch_next_ ( void *  cls)

Advance internal pointer to next command.

Parameters
clsbatch internal state
Returns
true if we could advance, false if the batch has completed and cannot advance anymore

Definition at line 178 of file testing_api_cmd_batch.c.

179{
180 struct BatchState *bs = cls;
181 struct GNUNET_TESTING_Command *bcmd = &bs->batch[bs->batch_ip];
182
183 if (NULL == bcmd->run)
184 return true; /* this batch is done */
186 {
188 {
189 /* sub-batch is done */
191 bs->batch_ip++;
192 return false;
193 }
194 }
195 /* Simple command is done */
197 bs->batch_ip++;
198 return false;
199}
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:111
State for a "batch" CMD.
unsigned int batch_ip
Internal command pointer.
struct GNUNET_TESTING_Command * batch
CMDs batch.
A command to be run by the interpreter.
struct GNUNET_TIME_Absolute finish_time
When did the execution of this command finish?
void * cls
Closure for all commands with command-specific context information.
bool GNUNET_TESTING_cmd_batch_next_(void *cls)
Advance internal pointer to next command.
bool GNUNET_TESTING_cmd_is_batch_(const struct GNUNET_TESTING_Command *cmd)
Test if this command is a batch command.

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_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTING_cmd_batch_get_current_()

struct GNUNET_TESTING_Command * GNUNET_TESTING_cmd_batch_get_current_ ( const struct GNUNET_TESTING_Command cmd)

Obtain what command the batch is at.

Returns
cmd current batch command

Definition at line 210 of file testing_api_cmd_batch.c.

211{
212 struct BatchState *bs = cmd->cls;
213
215 return &bs->batch[bs->batch_ip];
216}
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.

References BatchState::batch, BatchState::batch_ip, GNUNET_TESTING_Command::cls, GNUNET_assert, and GNUNET_TESTING_cmd_is_batch_().

Here is the call graph for this function:

◆ GNUNET_TESTING_cmd_batch_set_current_()

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.

Parameters
cmdcurrent batch command
new_ipwhere to move the IP

Definition at line 220 of file testing_api_cmd_batch.c.

223{
224 struct BatchState *bs = cmd->cls;
225
226 /* sanity checks */
227 GNUNET_assert (cmd->run == &batch_run);
228 for (unsigned int i = 0; i < new_ip; i++)
229 GNUNET_assert (NULL != bs->batch[i].run);
230 /* actual logic */
231 bs->batch_ip = new_ip;
232}

References BatchState::batch, BatchState::batch_ip, batch_run(), GNUNET_TESTING_Command::cls, GNUNET_assert, and GNUNET_TESTING_Command::run.

Referenced by seek_batch().

Here is the call graph for this function:
Here is the caller graph for this function: