GNUnet 0.22.2
GNUNET_TESTING_Command Struct Reference

A command to be run by the interpreter. More...

#include <gnunet_testing_lib.h>

Collaboration diagram for GNUNET_TESTING_Command:
[legend]

Data Fields

struct GNUNET_TESTING_CommandLabel label
 Label for the command. More...
 
void * cls
 Closure for all commands with command-specific context information. More...
 
const char * name
 Variable name for the command, NULL for none. More...
 
GNUNET_TESTING_CommandRunRoutine run
 Runs the command. More...
 
struct GNUNET_TESTING_AsyncContextac
 Pointer to the asynchronous context in the command's closure. More...
 
GNUNET_TESTING_CommandCleanupRoutine cleanup
 Clean up after the command. More...
 
GNUNET_TESTING_CommandGetTraits traits
 Extract information from a command that is useful for other commands. More...
 
struct GNUNET_TIME_Absolute start_time
 When did the execution of this command start? More...
 
struct GNUNET_TIME_Absolute finish_time
 When did the execution of this command finish? More...
 
struct GNUNET_TIME_Absolute last_req_time
 When did we start the last run of this command? Delta to finish_time gives the latency for the last successful run. More...
 
unsigned int num_tries
 How often did we try to execute this command? (In case it is a request that is repated.) Note that a command must have some built-in retry mechanism for this value to be useful. More...
 
bool asynchronous_finish
 If "true", the interpreter should not immediately run the next command, even if this command did not complete via GNUNET_TESTING_async_finish(). More...
 

Detailed Description

A command to be run by the interpreter.

Definition at line 238 of file gnunet_testing_lib.h.

Field Documentation

◆ label

◆ cls

◆ name

const char* GNUNET_TESTING_Command::name

Variable name for the command, NULL for none.

Definition at line 254 of file gnunet_testing_lib.h.

Referenced by GNUNET_TESTING_cmd_set_var(), and GNUNET_TESTING_interpreter_run_cmd_().

◆ run

GNUNET_TESTING_CommandRunRoutine GNUNET_TESTING_Command::run

Runs the command.

Note that upon return, the interpreter will not automatically run the next command, as the command may continue asynchronously in other scheduler tasks. Thus, the command must ensure to eventually call #GNUNET_TESTING_interpreter_next() or GNUNET_TESTING_interpreter_fail().

If this function creates some asynchronous activity, it should initialize finish to a function that can be used to wait for the asynchronous activity to terminate.

Parameters
clsclosure
isinterpreter state

Definition at line 271 of file gnunet_testing_lib.h.

Referenced by batch_cleanup(), batch_run(), finish_test(), GNUNET_TESTING_cmd_batch(), GNUNET_TESTING_cmd_batch_next_(), GNUNET_TESTING_cmd_batch_set_current_(), GNUNET_TESTING_cmd_end(), GNUNET_TESTING_cmd_is_batch_(), GNUNET_TESTING_interpreter_lookup_command(), GNUNET_TESTING_interpreter_run_cmd_(), interpreter_run(), and stat_cmd().

◆ ac

struct GNUNET_TESTING_AsyncContext* GNUNET_TESTING_Command::ac

Pointer to the asynchronous context in the command's closure.

Used by the GNUNET_TESTING_async_finish() and GNUNET_TESTING_async_fail() functions.

Must be NULL if a command is synchronous.

Definition at line 281 of file gnunet_testing_lib.h.

Referenced by GNUNET_TESTING_async_fail(), GNUNET_TESTING_async_finish(), GNUNET_TESTING_command_new_ac(), GNUNET_TESTING_interpreter_run_cmd_(), and run_finish().

◆ cleanup

GNUNET_TESTING_CommandCleanupRoutine GNUNET_TESTING_Command::cleanup

Clean up after the command.

Run during forced termination (CTRL-C) or test failure or test success.

Parameters
clsclosure

Definition at line 289 of file gnunet_testing_lib.h.

Referenced by batch_cleanup(), and finish_test().

◆ traits

GNUNET_TESTING_CommandGetTraits GNUNET_TESTING_Command::traits

Extract information from a command that is useful for other commands.

Can be NULL if a command has no traits.

Parameters
clsclosure
[out]retresult (could be anything)
traitname of the trait
indexindex number of the object to extract.
Returns
GNUNET_OK on success, GNUNET_NO if no trait was found

Definition at line 302 of file gnunet_testing_lib.h.

◆ start_time

struct GNUNET_TIME_Absolute GNUNET_TESTING_Command::start_time

When did the execution of this command start?

Definition at line 307 of file gnunet_testing_lib.h.

Referenced by GNUNET_TESTING_interpreter_run_cmd_(), and stat_cmd().

◆ finish_time

struct GNUNET_TIME_Absolute GNUNET_TESTING_Command::finish_time

When did the execution of this command finish?

Definition at line 312 of file gnunet_testing_lib.h.

Referenced by GNUNET_TESTING_cmd_batch_next_(), GNUNET_TESTING_interpreter_next_(), and stat_cmd().

◆ last_req_time

struct GNUNET_TIME_Absolute GNUNET_TESTING_Command::last_req_time

When did we start the last run of this command? Delta to finish_time gives the latency for the last successful run.

Useful in case num_tries was positive and the command was run multiple times. In that case, the start_time gives the time when we first tried to run the command, so the difference between start_time and finish_time would be the time all of the num_tries took, while the delta to last_req_time is the time the last (successful) execution took.

Definition at line 323 of file gnunet_testing_lib.h.

Referenced by GNUNET_TESTING_interpreter_current_cmd_touch(), GNUNET_TESTING_interpreter_run_cmd_(), and stat_cmd().

◆ num_tries

unsigned int GNUNET_TESTING_Command::num_tries

How often did we try to execute this command? (In case it is a request that is repated.) Note that a command must have some built-in retry mechanism for this value to be useful.

Definition at line 330 of file gnunet_testing_lib.h.

Referenced by GNUNET_TESTING_interpreter_current_cmd_inc_tries(), GNUNET_TESTING_interpreter_run_cmd_(), and stat_cmd().

◆ asynchronous_finish

bool GNUNET_TESTING_Command::asynchronous_finish

If "true", the interpreter should not immediately run the next command, even if this command did not complete via GNUNET_TESTING_async_finish().

Otherwise, GNUNET_TESTING_cmd_finish() must be used to ensure that a command actually completed.

Definition at line 338 of file gnunet_testing_lib.h.

Referenced by GNUNET_TESTING_interpreter_run_cmd_(), GNUNET_TRANSPORT_cmd_send_simple_performance(), and run_finish().


The documentation for this struct was generated from the following file: