GNUnet 0.21.1
gnunet_testing_ng_lib.h File Reference
Include dependency graph for gnunet_testing_ng_lib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define GNUNET_TESTING_SIMPLE_TRAITS(op, prefix)    op (prefix, process, struct GNUNET_OS_Process *)
 Call op on all simple traits. More...
 
#define GNUNET_TESTING_INDEXED_TRAITS(op, prefix)
 Call op on all indexed traits. More...
 

Functions

struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_signal (const char *label, const char *process_label, int signal)
 Meta-header for next-generation testing logic. More...
 
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_sleep (const char *label, struct GNUNET_TIME_Relative duration)
 Sleep for duration. More...
 
const struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_exec_bash_script (const char *label, const char *script, char *const script_argv[], int argc, GNUNET_ChildCompletedCallback cb)
 Command to execute a script synchronously. More...
 
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_process (const struct GNUNET_TESTING_Command *cmd, struct GNUNET_OS_Process ***ret)
 
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_process (struct GNUNET_OS_Process **value)
 
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_uint32 (const struct GNUNET_TESTING_Command *cmd, unsigned int index, const uint32_t **ret)
 
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_uint32 (unsigned int index, const uint32_t *value)
 
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_uint64 (const struct GNUNET_TESTING_Command *cmd, unsigned int index, const uint64_t **ret)
 
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_uint64 (unsigned int index, const uint64_t *value)
 
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_int64 (const struct GNUNET_TESTING_Command *cmd, unsigned int index, const int64_t **ret)
 
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_int64 (unsigned int index, const int64_t *value)
 
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_uint (const struct GNUNET_TESTING_Command *cmd, unsigned int index, const unsigned int **ret)
 
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_uint (unsigned int index, const unsigned int *value)
 
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_string (const struct GNUNET_TESTING_Command *cmd, unsigned int index, const char **ret)
 
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_string (unsigned int index, const char *value)
 
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_uuid (const struct GNUNET_TESTING_Command *cmd, unsigned int index, const struct GNUNET_Uuid **ret)
 
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_uuid (unsigned int index, const struct GNUNET_Uuid *value)
 
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_time (const struct GNUNET_TESTING_Command *cmd, unsigned int index, const struct GNUNET_TIME_Absolute **ret)
 
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_time (unsigned int index, const struct GNUNET_TIME_Absolute *value)
 
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_absolute_time (const struct GNUNET_TESTING_Command *cmd, unsigned int index, const struct GNUNET_TIME_Absolute **ret)
 
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_absolute_time (unsigned int index, const struct GNUNET_TIME_Absolute *value)
 
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_relative_time (const struct GNUNET_TESTING_Command *cmd, unsigned int index, const struct GNUNET_TIME_Relative **ret)
 
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_relative_time (unsigned int index, const struct GNUNET_TIME_Relative *value)
 

Macro Definition Documentation

◆ GNUNET_TESTING_SIMPLE_TRAITS

#define GNUNET_TESTING_SIMPLE_TRAITS (   op,
  prefix 
)     op (prefix, process, struct GNUNET_OS_Process *)

Call op on all simple traits.

Definition at line 92 of file gnunet_testing_ng_lib.h.

◆ GNUNET_TESTING_INDEXED_TRAITS

#define GNUNET_TESTING_INDEXED_TRAITS (   op,
  prefix 
)
Value:
op (prefix, uint32, const uint32_t) \
op (prefix, uint64, const uint64_t) \
op (prefix, int64, const int64_t) \
op (prefix, uint, const unsigned int) \
op (prefix, string, const char) \
op (prefix, uuid, const struct GNUNET_Uuid) \
op (prefix, time, const struct GNUNET_TIME_Absolute) \
op (prefix, absolute_time, const struct GNUNET_TIME_Absolute) \
op (prefix, relative_time, const struct GNUNET_TIME_Relative)
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
static int prefix
If printing the value of PREFIX has been requested.
Definition: gnunet-config.c:59
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
A UUID, a 128 bit "random" value.

Call op on all indexed traits.

Definition at line 99 of file gnunet_testing_ng_lib.h.

Function Documentation

◆ GNUNET_TESTING_cmd_signal()

struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_signal ( const char *  label,
const char *  process_label,
int  signal 
)

Meta-header for next-generation testing logic.

Author
Christian Grothoff chris.nosp@m.tian.nosp@m.@grot.nosp@m.hoff.nosp@m..org
Marcello Stanisci
t3sserakt Create a "signal" CMD.
Parameters
labelcommand label.
process_labellabel of a command that has a process trait
signalsignal to send to process.
Returns
the command.

◆ GNUNET_TESTING_cmd_sleep()

struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_sleep ( const char *  label,
struct GNUNET_TIME_Relative  duration 
)

Sleep for duration.

Parameters
labelcommand label.
durationtime to sleep
Returns
the command.

◆ GNUNET_TESTING_cmd_exec_bash_script()

const struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_exec_bash_script ( const char *  label,
const char *  script,
char *const  script_argv[],
int  argc,
GNUNET_ChildCompletedCallback  cb 
)

Command to execute a script synchronously.

FIXME: is this accurate? How is this limited to BASH scripts or even scripts?

Parameters
labelLabel of the command.
scriptThe name of the script.
script_argvThe arguments of the script.

Definition at line 196 of file testing_api_cmd_exec_bash_script.c.

201{
202 struct BashScriptState *bss;
203
204 bss = GNUNET_new (struct BashScriptState);
205 bss->script = script;
206 bss->script_argv = script_argv; // FIXME this is not just a cast to fix
207 bss->argc = argc;
208 bss->cb = cb;
209
210 return GNUNET_TESTING_command_new (bss,
211 label,
214 NULL,
215 &bss->ac);
216}
struct GNUNET_TESTING_Command GNUNET_TESTING_command_new(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.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_TESTING_AsyncContext ac
Context for our asynchronous completion.
const char * script
Script this cmd will execute.
char *const * script_argv
Arguments for the script.
int argc
Size of script_argv.
GNUNET_ChildCompletedCallback cb
Callback handed over to the command, which should be called upon death or completion of the script.
static void exec_bash_script_cleanup(void *cls)
The cleanup function of this cmd frees resources the cmd allocated.
static void exec_bash_script_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
Run method of the command created by the interpreter to wait for another command to finish.

References BashScriptState::ac, BashScriptState::argc, BashScriptState::cb, exec_bash_script_cleanup(), exec_bash_script_run(), GNUNET_new, GNUNET_TESTING_command_new(), BashScriptState::script, and BashScriptState::script_argv.

Here is the call graph for this function:

◆ GNUNET_TESTING_get_trait_process()

enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_process ( const struct GNUNET_TESTING_Command cmd,
struct GNUNET_OS_Process ***  ret 
)

◆ GNUNET_TESTING_make_trait_process()

struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_process ( struct GNUNET_OS_Process **  value)

◆ GNUNET_TESTING_get_trait_uint32()

enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_uint32 ( const struct GNUNET_TESTING_Command cmd,
unsigned int  index,
const uint32_t **  ret 
)

◆ GNUNET_TESTING_make_trait_uint32()

struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_uint32 ( unsigned int  index,
const uint32_t *  value 
)

◆ GNUNET_TESTING_get_trait_uint64()

enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_uint64 ( const struct GNUNET_TESTING_Command cmd,
unsigned int  index,
const uint64_t **  ret 
)

◆ GNUNET_TESTING_make_trait_uint64()

struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_uint64 ( unsigned int  index,
const uint64_t *  value 
)

◆ GNUNET_TESTING_get_trait_int64()

enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_int64 ( const struct GNUNET_TESTING_Command cmd,
unsigned int  index,
const int64_t **  ret 
)

◆ GNUNET_TESTING_make_trait_int64()

struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_int64 ( unsigned int  index,
const int64_t *  value 
)

◆ GNUNET_TESTING_get_trait_uint()

enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_uint ( const struct GNUNET_TESTING_Command cmd,
unsigned int  index,
const unsigned int **  ret 
)

◆ GNUNET_TESTING_make_trait_uint()

struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_uint ( unsigned int  index,
const unsigned int *  value 
)

◆ GNUNET_TESTING_get_trait_string()

enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_string ( const struct GNUNET_TESTING_Command cmd,
unsigned int  index,
const char **  ret 
)

◆ GNUNET_TESTING_make_trait_string()

struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_string ( unsigned int  index,
const char *  value 
)

◆ GNUNET_TESTING_get_trait_uuid()

enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_uuid ( const struct GNUNET_TESTING_Command cmd,
unsigned int  index,
const struct GNUNET_Uuid **  ret 
)

◆ GNUNET_TESTING_make_trait_uuid()

struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_uuid ( unsigned int  index,
const struct GNUNET_Uuid value 
)

◆ GNUNET_TESTING_get_trait_time()

enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_time ( const struct GNUNET_TESTING_Command cmd,
unsigned int  index,
const struct GNUNET_TIME_Absolute **  ret 
)

◆ GNUNET_TESTING_make_trait_time()

struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_time ( unsigned int  index,
const struct GNUNET_TIME_Absolute value 
)

◆ GNUNET_TESTING_get_trait_absolute_time()

enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_absolute_time ( const struct GNUNET_TESTING_Command cmd,
unsigned int  index,
const struct GNUNET_TIME_Absolute **  ret 
)

◆ GNUNET_TESTING_make_trait_absolute_time()

struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_absolute_time ( unsigned int  index,
const struct GNUNET_TIME_Absolute value 
)

◆ GNUNET_TESTING_get_trait_relative_time()

enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait_relative_time ( const struct GNUNET_TESTING_Command cmd,
unsigned int  index,
const struct GNUNET_TIME_Relative **  ret 
)

◆ GNUNET_TESTING_make_trait_relative_time()

struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_relative_time ( unsigned int  index,
const struct GNUNET_TIME_Relative value 
)