37 #define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
109 "barrier %s added locally\n",
127 "added cle for %p %s\n",
134 char *terminator =
"\0";
136 name_len = strlen (barrier->
name);
140 msg->header.
size = htons ((uint16_t) msg_length);
143 memcpy (&
msg[1], barrier->
name, name_len + 1);
144 memcpy (&
msg[name_len + 1],terminator,1);
209 const char *barrier_label,
211 unsigned int node_number,
212 unsigned int running_on_master,
struct GNUNET_MessageHeader * msg
static int ret
Return value of the commandline.
struct GNUNET_TESTING_Interpreter * is
static int write_message(uint16_t message_type, const char *data, size_t data_length)
Write message to the master process.
static struct GNUNET_MQ_Envelope * ac
Handle to current GNUNET_PEERINFO_add_peer() operation.
Convenience API for writing testcases for GNUnet.
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_async_context(struct GNUNET_TESTING_AsyncContext *value)
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.
struct GNUNET_TESTING_Trait GNUNET_TESTING_trait_end(void)
"end" trait.
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait(const struct GNUNET_TESTING_Trait *traits, const void **ret, const char *trait, unsigned int index)
Extract a trait.
void(* GNUNET_TESTING_cmd_helper_write_cb)(struct GNUNET_MessageHeader *message, size_t msg_length)
Callback function to write messages from the helper process running on a netjail node to the master p...
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
GNUNET_GenericReturnValue
Named constants for return values.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
#define GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_REACHED
Struct with information for callbacks.
const char * barrier_name
The name of the barrier this commands wait (if finishing asynchronous) for or/and reaches.
const char * label
The label of this command.
unsigned int running_on_master
Is this cmd running on the master loop.
struct GNUNET_TESTING_AsyncContext ac
Context for our asynchronous completion.
unsigned int asynchronous_finish
If this command will block.
GNUNET_TESTING_cmd_helper_write_cb write_message
Callback to write messages to the master loop.
struct GNUNET_TESTING_Command * command
State each asynchronous command must have in its closure.
const char * name
Name of the barrier.
struct CommandListEntry * cmds_tail
Tail of the DLL with local commands the barrier is attached too.
struct CommandListEntry * cmds_head
Head of the DLL with local commands the barrier is attached too.
unsigned int reached
Number of commands which reached this barrier.
A command to be run by the interpreter.
char label[127+1]
Label for the command.
bool asynchronous_finish
If "true", the interpreter should not immediately call finish, even if finish is non-NULL.
Global state of the interpreter, used by a command to access information about other commands.
A struct GNUNET_TESTING_Trait can be used to exchange data between cmds.
unsigned int index
Index number associated with the trait.
void TST_interpreter_add_barrier(struct GNUNET_TESTING_Interpreter *is, struct GNUNET_TESTING_Barrier *barrier)
Add a barrier to the loop.
struct GNUNET_TESTING_Barrier * TST_interpreter_get_barrier(struct GNUNET_TESTING_Interpreter *is, const char *barrier_name)
Getting a barrier from the interpreter.
void TST_interpreter_finish_attached_cmds(struct GNUNET_TESTING_Interpreter *is, const char *barrier_name)
Finish all "barrier reached" comands attached to this barrier.
unsigned int GNUNET_TESTING_barrier_crossable(struct GNUNET_TESTING_Barrier *barrier)
This function checks, if a barrier can be crossed, which actually means that the cmd representing the...
static void barrier_reached_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
Run the command.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_barrier_reached(const char *label, const char *barrier_label, unsigned int asynchronous_finish, unsigned int node_number, unsigned int running_on_master, GNUNET_TESTING_cmd_helper_write_cb write_message)
Create command.
static enum GNUNET_GenericReturnValue barrier_reached_traits(void *cls, const void **ret, const char *trait, unsigned int index)
Offer internal data from a "batch" CMD, to other commands.
static void barrier_reached_cleanup(void *cls)
Cleanup the state from a "barrier reached" CMD, and possibly cancel a pending operation thereof.
#define LOG(kind,...)
Generic logging shortcut.
struct GNUNET_TESTING_Command * GNUNET_TESTING_interpreter_get_current_command(struct GNUNET_TESTING_Interpreter *is)
Returns the actual running command.
Message formats for communication between testing cmds helper and testcase plugins.