main interpreter loop for testcases More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testing_lib.h"
#include "testing_api_loop.h"
#include "testing_api_cmd_batch.h"
Go to the source code of this file.
Data Structures | |
struct | SendContext |
struct | GNUNET_TESTING_Interpreter |
Global state of the interpreter, used by a command to access information about other commands. More... | |
struct | RewindIpState |
State for a "rewind" CMD. More... | |
Functions | |
const struct GNUNET_TESTING_Command * | GNUNET_TESTING_interpreter_lookup_command (struct GNUNET_TESTING_Interpreter *is, const char *label) |
Lookup command by label. More... | |
const struct GNUNET_TESTING_Command * | GNUNET_TESTING_interpreter_get_command (struct GNUNET_TESTING_Interpreter *is, const char *name) |
Get command from hash map by variable name. More... | |
static void | send_finished (void *cls, enum GNUNET_GenericReturnValue result) |
void | GNUNET_TESTING_loop_notify_children_ (struct GNUNET_TESTING_Interpreter *is, const struct GNUNET_MessageHeader *hdr) |
Send message to all netjail children (if there are any). More... | |
void | GNUNET_TESTING_loop_notify_parent_ (struct GNUNET_TESTING_Interpreter *is, const struct GNUNET_MessageHeader *hdr) |
Send message to our parent. More... | |
static void | finish_test (void *cls) |
Finish the test run, return the final result. More... | |
static void | interpreter_run (void *cls) |
Run the main interpreter loop that performs exchange operations. More... | |
void | GNUNET_TESTING_interpreter_next_ (void *cls) |
Current command is done, run the next one. More... | |
void | GNUNET_TESTING_interpreter_run_cmd_ (struct GNUNET_TESTING_Interpreter *is, struct GNUNET_TESTING_Command *cmd) |
void | GNUNET_TESTING_interpreter_fail (struct GNUNET_TESTING_Interpreter *is) |
Current command failed, clean up and fail the test case. More... | |
void | GNUNET_TESTING_interpreter_skip (struct GNUNET_TESTING_Interpreter *is) |
Skips the current test, the environment is not prepared correctly. More... | |
void | GNUNET_TESTING_async_fail (struct GNUNET_TESTING_AsyncContext *ac) |
The asynchronous command of ac has failed. More... | |
void | GNUNET_TESTING_async_finish (struct GNUNET_TESTING_AsyncContext *ac) |
The asynchronous command of ac has finished. More... | |
static void | do_timeout (void *cls) |
Function run when the test terminates (good or bad) with timeout. More... | |
static void | setup_is (struct GNUNET_TESTING_Interpreter *is, const struct GNUNET_TESTING_Command *bcommand, const struct GNUNET_TESTING_Command *commands) |
struct GNUNET_TESTING_Interpreter * | GNUNET_TESTING_run (const struct GNUNET_TESTING_Command *commands, struct GNUNET_TIME_Relative timeout, GNUNET_TESTING_ResultCallback rc, void *rc_cls) |
Run the testsuite. More... | |
static struct GNUNET_TESTING_Interpreter * | start_testcase (void *cls, const char *topology_data, uint32_t inherited_barrier_count, const struct GNUNET_ShortHashCode *inherited_barriers, GNUNET_TESTING_cmd_helper_write_cb parent_writer, GNUNET_TESTING_ResultCallback finish_cb, void *finish_cb_cls) |
struct GNUNET_TESTING_PluginFunctions * | GNUNET_TESTING_make_plugin (const struct GNUNET_TESTING_Command *commands) |
void | GNUNET_TESTING_add_netjail_helper_ (struct GNUNET_TESTING_Interpreter *is, struct GNUNET_HELPER_Handle *helper) |
Adding a helper handle to the interpreter. More... | |
struct GNUNET_TESTING_Barrier * | GNUNET_TESTING_get_barrier2_ (struct GNUNET_TESTING_Interpreter *is, const struct GNUNET_ShortHashCode *create_key) |
struct GNUNET_TESTING_Barrier * | GNUNET_TESTING_get_barrier_ (struct GNUNET_TESTING_Interpreter *is, const char *barrier_name) |
void | GNUNET_TESTING_add_barrier_ (struct GNUNET_TESTING_Interpreter *is, struct GNUNET_TESTING_Barrier *barrier) |
Add a barrier to the interpreter to share it with all children as an inherited barrier. More... | |
unsigned int | GNUNET_TESTING_barrier_count_ (struct GNUNET_TESTING_Interpreter *is) |
void | GNUNET_TESTING_barrier_iterate_ (struct GNUNET_TESTING_Interpreter *is, GNUNET_CONTAINER_ShortmapIterator cb, void *cb_cls) |
void | GNUNET_TESTING_interpreter_commands_iterate (struct GNUNET_TESTING_Interpreter *is, bool asc, GNUNET_TESTING_CommandIterator cb, void *cb_cls) |
Iterates over all of the top-level commands of an interpreter. More... | |
void | GNUNET_TESTING_interpreter_current_cmd_touch (struct GNUNET_TESTING_Interpreter *is) |
Update the last request time of the current command to the current time. More... | |
void | GNUNET_TESTING_interpreter_current_cmd_inc_tries (struct GNUNET_TESTING_Interpreter *is) |
Increment the 'num_tries' counter for the current command. More... | |
const char * | GNUNET_TESTING_interpreter_current_cmd_get_label (struct GNUNET_TESTING_Interpreter *is) |
Obtain label of the command being now run. More... | |
static enum GNUNET_GenericReturnValue | seek_batch (struct GNUNET_TESTING_Interpreter *is, const struct GNUNET_TESTING_Command *cmd, const struct GNUNET_TESTING_Command *target) |
Seek for the target command in batch (and rewind to it if successful). More... | |
static void | rewind_ip_run (void *cls, struct GNUNET_TESTING_Interpreter *is) |
Run the "rewind" CMD. More... | |
static void | rewind_ip_free (void *cls) |
struct GNUNET_TESTING_Command | GNUNET_TESTING_cmd_rewind_ip (const char *label, const char *target_label, unsigned int counter) |
Make the instruction pointer point to target_label only if counter is greater than zero. More... | |
main interpreter loop for testcases
Definition in file testing_api_loop.c.
const struct GNUNET_TESTING_Command * GNUNET_TESTING_interpreter_lookup_command | ( | struct GNUNET_TESTING_Interpreter * | is, |
const char * | label | ||
) |
Lookup command by label.
is | interpreter to lookup command in |
label | label of the command to lookup. |
Definition at line 145 of file testing_api_loop.c.
References GNUNET_TESTING_Interpreter::commands, GNUNET_assert, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_OK, GNUNET_TESTING_cmd_is_batch_(), GNUNET_TESTING_get_trait_batch_cmds(), GNUNET_TESTING_get_trait_cmd(), GNUNET_TESTING_Interpreter::ip, is, GNUNET_TESTING_Command::label, run(), GNUNET_TESTING_Command::run, and GNUNET_TESTING_CommandLabel::value.
Referenced by backchannel_check_run(), connect_peers_run(), join_room_run(), netjail_exec_run(), netjail_start_run(), rewind_ip_run(), run_finish(), send_simple_run(), signal_run(), start_peer_run(), start_service_run(), stop_peer_run(), and stop_service_run().
const struct GNUNET_TESTING_Command * GNUNET_TESTING_interpreter_get_command | ( | struct GNUNET_TESTING_Interpreter * | is, |
const char * | name | ||
) |
Get command from hash map by variable name.
is | interpreter state. |
name | name of the variable to get command by |
Definition at line 203 of file testing_api_loop.c.
References GNUNET_CONTAINER_multihashmap_get(), GNUNET_CRYPTO_hash(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, is, name, and GNUNET_TESTING_Interpreter::vars.
|
static |
Definition at line 224 of file testing_api_loop.c.
References GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_OK, is, SendContext::is, result, GNUNET_TESTING_Interpreter::sender_head, and GNUNET_TESTING_Interpreter::sender_tail.
Referenced by GNUNET_TESTING_loop_notify_children_().
void GNUNET_TESTING_loop_notify_children_ | ( | struct GNUNET_TESTING_Interpreter * | is, |
const struct GNUNET_MessageHeader * | hdr | ||
) |
Send message to all netjail children (if there are any).
is | The interpreter loop. |
Definition at line 239 of file testing_api_loop.c.
References GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_HELPER_send(), GNUNET_log, GNUNET_new, GNUNET_TESTING_Interpreter::helpers, is, SendContext::is, GNUNET_TESTING_Interpreter::n_helpers, send_finished(), SendContext::send_handle, GNUNET_TESTING_Interpreter::sender_head, GNUNET_TESTING_Interpreter::sender_tail, and GNUNET_MessageHeader::type.
Referenced by barrier_reached_run(), handle_helper_barrier_crossable(), and handle_helper_barrier_reached().
void GNUNET_TESTING_loop_notify_parent_ | ( | struct GNUNET_TESTING_Interpreter * | is, |
const struct GNUNET_MessageHeader * | hdr | ||
) |
Send message to our parent.
Fails very hard if we do not have one.
is | The interpreter loop. |
Definition at line 265 of file testing_api_loop.c.
References GNUNET_TESTING_FAIL, is, and GNUNET_TESTING_Interpreter::parent_writer.
Referenced by barrier_reached_run(), and handle_helper_barrier_reached().
|
static |
Finish the test run, return the final result.
cls | the struct GNUNET_TESTING_Interpreter |
Definition at line 281 of file testing_api_loop.c.
References GNUNET_TESTING_Interpreter::barriers, GNUNET_TESTING_Command::cleanup, GNUNET_TESTING_Command::cls, GNUNET_TESTING_Interpreter::commands, GNUNET_TESTING_Interpreter::final_task, GNUNET_TESTING_Interpreter::finishing, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multishortmap_destroy(), GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_HELPER_send_cancel(), GNUNET_log, GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_TESTING_Interpreter::helpers, GNUNET_TESTING_Interpreter::ip, is, GNUNET_TESTING_Command::label, GNUNET_TESTING_Interpreter::rc, GNUNET_TESTING_Interpreter::rc_cls, GNUNET_TESTING_Interpreter::result, run(), GNUNET_TESTING_Command::run, SendContext::send_handle, GNUNET_TESTING_Interpreter::sender_head, GNUNET_TESTING_Interpreter::sender_tail, GNUNET_TESTING_Interpreter::skip, GNUNET_TESTING_Interpreter::task, GNUNET_TESTING_Interpreter::timeout_task, GNUNET_TESTING_CommandLabel::value, and GNUNET_TESTING_Interpreter::vars.
Referenced by do_timeout(), GNUNET_TESTING_interpreter_fail(), and interpreter_run().
|
static |
Run the main interpreter loop that performs exchange operations.
Run the main interpreter loop.
cls | contains the struct InterpreterState |
cls | contains the struct GNUNET_TESTING_Interpreter |
Definition at line 440 of file testing_api_loop.c.
References GNUNET_TESTING_Interpreter::commands, finish_test(), GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_OK, GNUNET_TESTING_interpreter_run_cmd_(), GNUNET_TESTING_Interpreter::ip, is, GNUNET_TESTING_Command::label, GNUNET_TESTING_Interpreter::result, GNUNET_TESTING_Command::run, GNUNET_TESTING_Interpreter::task, and GNUNET_TESTING_CommandLabel::value.
Referenced by GNUNET_TESTING_interpreter_next_(), and setup_is().
void GNUNET_TESTING_interpreter_next_ | ( | void * | cls | ) |
Current command is done, run the next one.
Definition at line 351 of file testing_api_loop.c.
References GNUNET_TESTING_Command::cls, GNUNET_TESTING_Interpreter::commands, GNUNET_TESTING_Command::finish_time, GNUNET_ERROR_TYPE_MESSAGE, GNUNET_log, GNUNET_SCHEDULER_add_now(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_SYSERR, GNUNET_TESTING_cmd_batch_next_(), GNUNET_TESTING_cmd_is_batch_(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_duration(), interpreter_run(), GNUNET_TESTING_Interpreter::ip, is, GNUNET_TESTING_Interpreter::result, and GNUNET_TESTING_Interpreter::task.
Referenced by batch_run(), GNUNET_TESTING_async_finish(), and GNUNET_TESTING_interpreter_run_cmd_().
void GNUNET_TESTING_interpreter_run_cmd_ | ( | struct GNUNET_TESTING_Interpreter * | is, |
struct GNUNET_TESTING_Command * | cmd | ||
) |
Definition at line 393 of file testing_api_loop.c.
References GNUNET_TESTING_Command::ac, GNUNET_TESTING_Command::asynchronous_finish, GNUNET_TESTING_Command::cls, GNUNET_TESTING_AsyncContext::finished, GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE, GNUNET_CRYPTO_hash(), GNUNET_NO, GNUNET_TESTING_cmd_is_batch_(), GNUNET_TESTING_interpreter_next_(), GNUNET_TIME_absolute_get(), GNUNET_TESTING_AsyncContext::is, is, GNUNET_TESTING_Command::last_req_time, GNUNET_TESTING_Command::name, GNUNET_TESTING_AsyncContext::next_called, GNUNET_TESTING_Command::num_tries, GNUNET_TESTING_Command::run, GNUNET_TESTING_Command::start_time, and GNUNET_TESTING_Interpreter::vars.
Referenced by batch_run(), and interpreter_run().
void GNUNET_TESTING_interpreter_fail | ( | struct GNUNET_TESTING_Interpreter * | is | ) |
Current command failed, clean up and fail the test case.
is | interpreter state. |
Definition at line 463 of file testing_api_loop.c.
References GNUNET_TESTING_Interpreter::commands, GNUNET_TESTING_Interpreter::final_task, finish_test(), GNUNET_assert, GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_cancel(), GNUNET_SYSERR, GNUNET_TESTING_cmd_is_batch_(), GNUNET_TESTING_get_trait_cmd(), GNUNET_TESTING_Interpreter::ip, is, GNUNET_TESTING_Command::label, GNUNET_TESTING_Interpreter::result, GNUNET_TESTING_Interpreter::timeout_task, and GNUNET_TESTING_CommandLabel::value.
Referenced by connect_peers_run(), do_shutdown(), GNUNET_TESTING_async_fail(), GNUNET_TESTING_interpreter_skip(), join_room_run(), on_message_cb(), rewind_ip_run(), seek_batch(), start_peer_run(), and start_service_run().
void GNUNET_TESTING_interpreter_skip | ( | struct GNUNET_TESTING_Interpreter * | is | ) |
Skips the current test, the environment is not prepared correctly.
is | interpreter state. |
Definition at line 508 of file testing_api_loop.c.
References GNUNET_TESTING_interpreter_fail(), is, and GNUNET_TESTING_Interpreter::skip.
Referenced by netjail_start_run().
void GNUNET_TESTING_async_fail | ( | struct GNUNET_TESTING_AsyncContext * | ac | ) |
The asynchronous command of ac has failed.
ac | command-specific context |
Definition at line 517 of file testing_api_loop.c.
References GNUNET_TESTING_Command::ac, GNUNET_TESTING_AsyncContext::finished, GNUNET_assert, GNUNET_NO, GNUNET_SYSERR, GNUNET_TESTING_interpreter_fail(), and GNUNET_TESTING_AsyncContext::is.
Referenced by barrier_reached_run(), child_completed_callback(), conn_status(), exp_cb(), handle_helper_barrier_reached(), handle_helper_local_finished(), helper_mst(), stop_cb(), and timeout_finish().
void GNUNET_TESTING_async_finish | ( | struct GNUNET_TESTING_AsyncContext * | ac | ) |
The asynchronous command of ac has finished.
ac | command-specific context |
Definition at line 526 of file testing_api_loop.c.
References GNUNET_TESTING_Command::ac, GNUNET_TESTING_AsyncContext::finished, GNUNET_assert, GNUNET_NO, GNUNET_OK, GNUNET_TESTING_interpreter_next_(), GNUNET_TESTING_AsyncContext::is, GNUNET_TESTING_AsyncContext::next_called, GNUNET_TESTING_AsyncContext::notify_finished, and GNUNET_TESTING_AsyncContext::notify_finished_cls.
Referenced by backchannel_check_run(), barrier_reached_run(), child_completed_callback(), conn_status(), do_timeout(), done_finish(), handle_helper_barrier_crossable(), handle_helper_barrier_reached(), handle_helper_local_finished(), hello_iter_cb(), notify_connect(), read_from_log(), run_finish(), send_run(), send_simple_single(), and stop_cb().
|
static |
Function run when the test terminates (good or bad) with timeout.
cls | the interpreter state |
Definition at line 549 of file testing_api_loop.c.
References finish_test(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_SYSERR, is, GNUNET_TESTING_Interpreter::result, and GNUNET_TESTING_Interpreter::timeout_task.
Referenced by GNUNET_TESTING_run().
|
static |
Definition at line 562 of file testing_api_loop.c.
References GNUNET_TESTING_Interpreter::cmds_n, commands, GNUNET_TESTING_Interpreter::commands, GNUNET_assert, GNUNET_CONTAINER_multihashmap_create(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_malloc_large, GNUNET_SCHEDULER_add_now(), interpreter_run(), is, GNUNET_TESTING_Interpreter::task, and GNUNET_TESTING_Interpreter::vars.
Referenced by GNUNET_TESTING_run(), and start_testcase().
struct GNUNET_TESTING_Interpreter * GNUNET_TESTING_run | ( | const struct GNUNET_TESTING_Command * | commands, |
struct GNUNET_TIME_Relative | timeout, | ||
GNUNET_TESTING_ResultCallback | rc, | ||
void * | rc_cls | ||
) |
Run the testsuite.
Note, CMDs are copied into the interpreter state because they are usually defined into the "run" method that returns after having scheduled the test interpreter.
commands | the array of command to execute |
timeout | how long to wait for each command to execute |
rc | function to call with the final result |
rc_cls | closure for rc |
Definition at line 602 of file testing_api_loop.c.
References commands, do_timeout(), GNUNET_new, GNUNET_SCHEDULER_add_delayed(), is, GNUNET_TESTING_Interpreter::rc, GNUNET_TESTING_Interpreter::rc_cls, setup_is(), timeout, and GNUNET_TESTING_Interpreter::timeout_task.
Referenced by loop_run().
|
static |
Definition at line 624 of file testing_api_loop.c.
References GNUNET_TESTING_Barrier::barrier_id, GNUNET_TESTING_Interpreter::barriers, GNUNET_TESTING_Command::cls, commands, GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE, GNUNET_CONTAINER_multishortmap_create(), GNUNET_CONTAINER_multishortmap_put(), GNUNET_new, GNUNET_TESTING_cmd_load_topology_from_string(), GNUNET_TESTING_cmd_set_var(), GNUNET_TESTING_Barrier::inherited, is, GNUNET_TESTING_Interpreter::parent_writer, GNUNET_TESTING_Interpreter::rc, GNUNET_TESTING_Interpreter::rc_cls, and setup_is().
Referenced by GNUNET_TESTING_make_plugin().
struct GNUNET_TESTING_PluginFunctions * GNUNET_TESTING_make_plugin | ( | const struct GNUNET_TESTING_Command * | commands | ) |
Definition at line 677 of file testing_api_loop.c.
References GNUNET_TESTING_PluginFunctions::cls, commands, GNUNET_malloc_large, GNUNET_new, start_testcase(), and GNUNET_TESTING_PluginFunctions::start_testcase.
void GNUNET_TESTING_add_netjail_helper_ | ( | struct GNUNET_TESTING_Interpreter * | is, |
struct GNUNET_HELPER_Handle * | helper | ||
) |
Adding a helper handle to the interpreter.
is | The interpreter. |
helper | The helper handle. |
Definition at line 701 of file testing_api_loop.c.
References GNUNET_array_append, GNUNET_TESTING_Interpreter::helpers, is, and GNUNET_TESTING_Interpreter::n_helpers.
Referenced by start_helper().
struct GNUNET_TESTING_Barrier * GNUNET_TESTING_get_barrier2_ | ( | struct GNUNET_TESTING_Interpreter * | is, |
const struct GNUNET_ShortHashCode * | create_key | ||
) |
Definition at line 711 of file testing_api_loop.c.
References GNUNET_TESTING_Interpreter::barriers, GNUNET_CONTAINER_multishortmap_get(), and is.
Referenced by GNUNET_TESTING_get_barrier_(), handle_helper_barrier_crossable(), and handle_helper_barrier_reached().
struct GNUNET_TESTING_Barrier * GNUNET_TESTING_get_barrier_ | ( | struct GNUNET_TESTING_Interpreter * | is, |
const char * | barrier_name | ||
) |
Definition at line 720 of file testing_api_loop.c.
References GNUNET_TESTING_Interpreter::barriers, GNUNET_TESTING_barrier_name_hash_(), GNUNET_TESTING_get_barrier2_(), and is.
Referenced by barrier_reached_run().
void GNUNET_TESTING_add_barrier_ | ( | struct GNUNET_TESTING_Interpreter * | is, |
struct GNUNET_TESTING_Barrier * | barrier | ||
) |
Add a barrier to the interpreter to share it with all children as an inherited barrier.
is | The interpreter. |
barrier | The barrier to add. |
Definition at line 735 of file testing_api_loop.c.
References GNUNET_TESTING_Barrier::barrier_id, GNUNET_TESTING_Interpreter::barriers, GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE, GNUNET_CONTAINER_multishortmap_create(), GNUNET_CONTAINER_multishortmap_put(), and is.
Referenced by barrier_run().
unsigned int GNUNET_TESTING_barrier_count_ | ( | struct GNUNET_TESTING_Interpreter * | is | ) |
Definition at line 753 of file testing_api_loop.c.
References GNUNET_TESTING_Interpreter::barriers, GNUNET_CONTAINER_multishortmap_size(), and is.
Referenced by send_start_messages().
void GNUNET_TESTING_barrier_iterate_ | ( | struct GNUNET_TESTING_Interpreter * | is, |
GNUNET_CONTAINER_ShortmapIterator | cb, | ||
void * | cb_cls | ||
) |
Definition at line 761 of file testing_api_loop.c.
References GNUNET_TESTING_Interpreter::barriers, GNUNET_CONTAINER_multishortmap_iterate(), and is.
Referenced by send_start_messages().
void GNUNET_TESTING_interpreter_commands_iterate | ( | struct GNUNET_TESTING_Interpreter * | is, |
bool | asc, | ||
GNUNET_TESTING_CommandIterator | cb, | ||
void * | cb_cls | ||
) |
Iterates over all of the top-level commands of an interpreter.
[in] | is | interpreter to iterate over |
asc | true in execution order, false for reverse execution order | |
cb | function to call on each command | |
cb_cls | closure for cb |
Definition at line 774 of file testing_api_loop.c.
References GNUNET_TESTING_Interpreter::commands, end, GNUNET_TESTING_Interpreter::ip, is, and start.
Referenced by stat_run().
void GNUNET_TESTING_interpreter_current_cmd_touch | ( | struct GNUNET_TESTING_Interpreter * | is | ) |
Update the last request time of the current command to the current time.
[in,out] | is | interpreter state where to show that we are doing something |
Definition at line 808 of file testing_api_loop.c.
References GNUNET_TESTING_Interpreter::commands, GNUNET_TIME_absolute_get(), GNUNET_TESTING_Interpreter::ip, is, and GNUNET_TESTING_Command::last_req_time.
void GNUNET_TESTING_interpreter_current_cmd_inc_tries | ( | struct GNUNET_TESTING_Interpreter * | is | ) |
Increment the 'num_tries' counter for the current command.
[in,out] | is | interpreter state where to increment the counter |
Definition at line 817 of file testing_api_loop.c.
References GNUNET_TESTING_Interpreter::commands, GNUNET_TESTING_Interpreter::ip, is, and GNUNET_TESTING_Command::num_tries.
const char * GNUNET_TESTING_interpreter_current_cmd_get_label | ( | struct GNUNET_TESTING_Interpreter * | is | ) |
Obtain label of the command being now run.
is | interpreter state. |
Definition at line 825 of file testing_api_loop.c.
References GNUNET_TESTING_Interpreter::commands, GNUNET_TESTING_Interpreter::ip, is, GNUNET_TESTING_Command::label, and GNUNET_TESTING_CommandLabel::value.
|
static |
Seek for the target command in batch (and rewind to it if successful).
is | the interpreter state (for failures) |
cmd | batch to search for target |
target | command to search for |
Definition at line 862 of file testing_api_loop.c.
References GNUNET_assert, GNUNET_break, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_TESTING_cmd_batch_set_current_(), GNUNET_TESTING_cmd_is_batch_(), GNUNET_TESTING_get_trait_batch_cmds(), GNUNET_TESTING_get_trait_cmd(), GNUNET_TESTING_interpreter_fail(), is, ret, and seek_batch().
Referenced by rewind_ip_run(), and seek_batch().
|
static |
Run the "rewind" CMD.
cls | closure. |
cmd | command being executed now. |
is | the interpreter state. |
Definition at line 927 of file testing_api_loop.c.
References GNUNET_TESTING_Interpreter::commands, RewindIpState::counter, GNUNET_break, GNUNET_OK, GNUNET_SYSERR, GNUNET_TESTING_cmd_is_batch_(), GNUNET_TESTING_interpreter_fail(), GNUNET_TESTING_interpreter_lookup_command(), GNUNET_TESTING_Interpreter::ip, is, ret, run(), seek_batch(), and RewindIpState::target_label.
Referenced by GNUNET_TESTING_cmd_rewind_ip().
|
static |
Definition at line 996 of file testing_api_loop.c.
References GNUNET_free.
Referenced by GNUNET_TESTING_cmd_rewind_ip().
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_rewind_ip | ( | const char * | label, |
const char * | target_label, | ||
unsigned int | counter | ||
) |
Make the instruction pointer point to target_label only if counter is greater than zero.
Note that the command that will be executed next in this case is the one AFTER target_label, as the command we jump to is skipped by the advancing IP after the rewind.
label | command label |
target_label | label of the new instruction pointer's destination after the jump; must be before the current instruction (and the command at the target_label itself will not be run, but the one afterwards) |
counter | counts how many times the rewinding is to happen. |
Definition at line 1005 of file testing_api_loop.c.
References RewindIpState::counter, GNUNET_new, GNUNET_TESTING_command_new, rewind_ip_free(), rewind_ip_run(), and RewindIpState::target_label.