A command to be run by the interpreter. More...
#include <gnunet_testing_lib.h>
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_AsyncContext * | ac |
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... | |
A command to be run by the interpreter.
Definition at line 238 of file gnunet_testing_lib.h.
struct GNUNET_TESTING_CommandLabel GNUNET_TESTING_Command::label |
Label for the command.
Definition at line 244 of file gnunet_testing_lib.h.
Referenced by batch_run(), finish_test(), GNUNET_TESTING_command_new_ac(), GNUNET_TESTING_DHTU_cmd_send(), GNUNET_TESTING_interpreter_current_cmd_get_label(), GNUNET_TESTING_interpreter_fail(), GNUNET_TESTING_interpreter_lookup_command(), GNUNET_TESTING_set_label(), GNUNET_TRANSPORT_cmd_send_simple_performance(), handle_helper_init(), interpreter_run(), and stat_cmd().
void* GNUNET_TESTING_Command::cls |
Closure for all commands with command-specific context information.
Definition at line 249 of file gnunet_testing_lib.h.
Referenced by batch_cleanup(), finish_test(), GNUNET_TESTING_cmd_batch_get_current_(), GNUNET_TESTING_cmd_batch_next_(), GNUNET_TESTING_cmd_batch_set_current_(), GNUNET_TESTING_command_new_ac(), GNUNET_TESTING_DHTU_cmd_send(), GNUNET_TESTING_interpreter_next_(), GNUNET_TESTING_interpreter_run_cmd_(), notify_connect(), and start_testcase().
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_().
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.
cls | closure |
is | interpreter 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().
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().
GNUNET_TESTING_CommandCleanupRoutine GNUNET_TESTING_Command::cleanup |
Clean up after the command.
Run during forced termination (CTRL-C) or test failure or test success.
cls | closure |
Definition at line 289 of file gnunet_testing_lib.h.
Referenced by batch_cleanup(), and finish_test().
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.
cls | closure | |
[out] | ret | result (could be anything) |
trait | name of the trait | |
index | index number of the object to extract. |
Definition at line 302 of file gnunet_testing_lib.h.
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().
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().
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().
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().
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().