111 "Timeout waiting for command `%s' to finish\n",
134 if (NULL == async_cmd)
137 "Did not find command `%s'\n",
141 if ( (NULL == (aac = async_cmd->
ac)) ||
145 "Cannot finish `%s': not asynchronous\n",
189 const char *finish_label,
215 cmd.asynchronous_finish =
true;
static struct GNUNET_TIME_Relative timeout
User defined timestamp for completing operations.
static struct GNUNET_TESTING_Interpreter * is
struct GNUNET_TESTING_Command GNUNET_TESTING_command_new_ac(void *cls, const char *label, GNUNET_TESTING_CommandRunRoutine run, GNUNET_TESTING_CommandCleanupRoutine cleanup, GNUNET_TESTING_CommandGetTraits traits, struct GNUNET_TESTING_AsyncContext *ac)
Create a new command that may be asynchronous.
void GNUNET_TESTING_async_finish(struct GNUNET_TESTING_AsyncContext *ac)
The asynchronous command of ac has finished.
#define GNUNET_TESTING_FAIL(is)
Print failing line number and trigger shutdown.
void GNUNET_TESTING_async_fail(struct GNUNET_TESTING_AsyncContext *ac)
The asynchronous command of ac has failed.
const struct GNUNET_TESTING_Command * GNUNET_TESTING_interpreter_lookup_command(struct GNUNET_TESTING_Interpreter *is, const char *label)
Lookup command by label.
#define GNUNET_log(kind,...)
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
@ GNUNET_ERROR_TYPE_ERROR
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
void(* GNUNET_SCHEDULER_TaskCallback)(void *cls)
Signature of the main function of a task.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Struct to use for command-specific context information closure of a command waiting for another comma...
struct GNUNET_TESTING_AsyncContext ac
Function to call when done.
GNUNET_SCHEDULER_TaskCallback old_notify
Function to call when async operation is done.
void * old_notify_cls
Closure for notify_finished.
void * cls
Closure for all commands with command-specific context information.
const char * async_label
Label of the asynchronous command the synchronous command of this closure waits for.
struct GNUNET_TIME_Relative timeout
How long to wait until finish fails hard?
struct GNUNET_SCHEDULER_Task * finish_task
Task for running the finish method of the asynchronous task the command is waiting for.
Entry in list of pending tasks.
State each asynchronous command must have in its closure.
GNUNET_SCHEDULER_TaskCallback notify_finished
Function to call when async operation is done.
enum GNUNET_GenericReturnValue finished
Indication if the command finished (GNUNET_OK).
void * notify_finished_cls
Closure for notify_finished.
A command to be run by the interpreter.
struct GNUNET_TESTING_AsyncContext * ac
Pointer to the asynchronous context in the command's closure.
bool asynchronous_finish
If "true", the interpreter should not immediately run the next command, even if this command did not ...
Global state of the interpreter, used by a command to access information about other commands.
Time for relative time used by GNUnet, in microseconds.
static void timeout_finish(void *cls)
Function triggered if the command we are waiting for did not complete on time.
static void cleanup_finish(void *cls)
Cleanup state of a finish command.
const struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_finish(const char *finish_label, const char *cmd_ref, struct GNUNET_TIME_Relative timeout)
Create (synchronous) command that waits for another command to finish.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_make_unblocking(struct GNUNET_TESTING_Command cmd)
Turn asynchronous command into non-blocking command by setting asynchronous_finish to true.
static void run_finish(void *cls, struct GNUNET_TESTING_Interpreter *is)
Run method of the command created by the interpreter to wait for another command to finish.
static void done_finish(void *cls)
Function called when the command we are waiting on is finished.