27#include "gnunet_testing_barrier.h"
28#include "gnunet_testing_netjail_lib.h"
33#include "gnunet_testing_barrier.h"
38#define LOG(kind, ...) GNUNET_log_from (kind, "udp-backchannel", __VA_ARGS__)
40#define BASE_DIR "testdir"
42#define TOPOLOGY_CONFIG "test_transport_udp_backchannel_topo.conf"
44#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
88struct GNUNET_TESTING_BarrierList *
92 return GNUNET_new (
struct GNUNET_TESTING_BarrierList);
105 GNUNET_TESTING_get_trait_async_context (&
block_send,
108 if ((NULL == ac->cont))
128 "Local test exits with status %d\n",
131 ts->finished_cb (rv);
149 GNUNET_TRANSPORT_TESTING_get_trait_connect_peer_state (&
connect_peers,
165 const struct GNUNET_TESTING_LocalPreparedState *lfs;
170 if (NULL == lfs->ac.cont)
191 unsigned int local_m_int;
195 unsigned int sscanf_ret = 0;
207 topology = GNUNET_TESTING_get_topo_from_file (topology_data);
210 topology = GNUNET_TESTING_get_topo_from_string (topology_data);
215 sscanf_ret = sscanf (
m,
"%u", &m_int);
222 sscanf_ret = sscanf (n,
"%u", &n_int);
229 sscanf_ret = sscanf (local_m,
"%u", &local_m_int);
240 num = (n_int - 1) * local_m_int + m_int + topology->
nodes_x;
242 block_send = GNUNET_TESTING_cmd_block_until_external_trigger (
252 "local-test-prepared",
256 "test_transport_api_tcp_node1.conf");
259 "plugin cfgname: %s\n",
281 GNUNET_TESTING_cmd_system_create (
"system-create",
291 GNUNET_TESTING_cmd_send_peer_ready (
"send-peer-ready",
305 GNUNET_TESTING_cmd_system_destroy (
"system-destroy",
317 GNUNET_TESTING_cmd_system_create (
"system-create",
327 GNUNET_TESTING_cmd_send_peer_ready (
343 GNUNET_TESTING_cmd_system_destroy (
"system-destroy",
struct GNUNET_MQ_MessageHandlers handlers[]
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
static int ret
Final status code.
static void write_message(const struct GNUNET_MessageHeader *message)
Callback to write a message to the parent process.
static void finished_cb(void *cls, enum GNUNET_GenericReturnValue rv)
static struct VoipCommand commands[]
List of supported commands.
void GNUNET_TESTING_async_finish(struct GNUNET_TESTING_AsyncContext *ac)
The asynchronous command of ac has finished.
void GNUNET_TESTING_async_fail(struct GNUNET_TESTING_AsyncContext *ac)
The asynchronous command of ac has failed.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_end(void)
Create command array terminator.
struct GNUNET_TESTING_PluginFunctions * GNUNET_TESTING_make_plugin(const struct GNUNET_TESTING_Command *commands)
Bandwidth allocation API for applications to interact with.
#define GNUNET_log(kind,...)
GNUNET_GenericReturnValue
Named constants for return values.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_log_strerror(level, cmd)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
enum GNUNET_GenericReturnValue read_file(char const *const filename, char **buffer)
static struct GNUNET_TESTING_Command block_send
GNUNET_TESTING_MAKE_PLUGIN(libgnunet, udp_backchannel, GNUNET_TESTING_cmd_system_create("system-create", ts->testdir), GNUNET_TRANSPORT_cmd_start_peer("start-peer", "system-create", num, node_ip, handlers, ts->cfgname, notify_connect, GNUNET_NO), GNUNET_TESTING_cmd_send_peer_ready("send-peer-ready", write_message), block_send, connect_peers, GNUNET_TRANSPORT_cmd_backchannel_check("backchannel-check", "start-peer", "system-create", num, m_int, n_int, topology), local_prepared, GNUNET_TRANSPORT_cmd_stop_peer("stop-peer", "start-peer"), GNUNET_TESTING_cmd_system_destroy("system-destroy", "system-create"))
static void handle_result(void *cls, enum GNUNET_GenericReturnValue rv)
Function called with the final result of the test.
static struct GNUNET_TESTING_Command local_prepared
static struct GNUNET_TESTING_Command connect_peers
void * libgnunet_test_transport_plugin_cmd_udp_backchannel_done(void *cls)
Exit point from the plugin.
static void all_local_tests_prepared()
Callback to set the flag indicating all peers are prepared to finish.
static void * notify_connect(struct GNUNET_TESTING_Interpreter *is, const struct GNUNET_PeerIdentity *peer)
Callback from start peer cmd for signaling a peer got connected.
struct GNUNET_TESTING_BarrierList * get_waiting_for_barriers()
static int check_test(void *cls, const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
Function called to check a message of type GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE being received.
static void handle_test(void *cls, const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
Function called to handle a message of type GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE being received.
static struct GNUNET_TESTING_Interpreter * is
void * libgnunet_test_transport_plugin_cmd_udp_backchannel_init(void *cls)
Entry point for the plugin.
#define LOG(kind,...)
Generic logging shortcut.
static void all_peers_started()
Callback to set the flag indicating all peers started.
Message handler for a specific message type.
The identity of the host (wraps the signing key of the peer).
State each asynchronous command must have in its closure.
A command to be run by the interpreter.
void * cls
Closure for all commands with command-specific context information.
Global state of the interpreter, used by a command to access information about other commands.
Topology of our netjail setup.
unsigned int nodes_x
Number of global known nodes.
The plugin API every test case plugin has to implement.
void * cls
Closure to pass to start_testcase.
char * cfgname
The name for the configuration file of the specific node.
char * testdir
The name for a specific test environment directory.
struct GNUNET_TESTING_NetjailTopology * topology
The complete topology information.
void GNUNET_TESTING_free_topology(struct GNUNET_TESTING_NetjailTopology *topology)
Deallocate memory of the struct GNUNET_TESTING_NetjailTopology.
struct GNUNET_TESTING_Command GNUNET_TRANSPORT_cmd_stop_peer(const char *label, const char *start_label)
Create command.
struct GNUNET_TESTING_Command GNUNET_TRANSPORT_cmd_connect_peers(const char *label, const char *start_peer_label, const char *create_label, uint32_t num, struct GNUNET_TESTING_NetjailTopology *topology, unsigned int additional_connects, unsigned int wait_for_connect)
Create command.
struct GNUNET_TESTING_Command GNUNET_TRANSPORT_cmd_backchannel_check(const char *label, const char *start_peer_label, const char *create_label, uint32_t num, unsigned int node_n, unsigned int namespace_n, struct GNUNET_TESTING_NetjailTopology *topology)
Create command.
struct GNUNET_TESTING_Command GNUNET_TRANSPORT_cmd_start_peer(const char *label, const char *system_label, uint32_t no, const char *node_ip, struct GNUNET_MQ_MessageHandler *handlers, const char *cfgname, GNUNET_TRANSPORT_notify_connect_cb notify_connect, unsigned int broadcast)
Create command.
#define GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE
Message type used by GNUNET_TRANSPORT_TESTING_simple_send().