GNUnet  0.20.0
testing_messenger_setup.h File Reference

A simple test-case setup for the messenger service. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  test_configuration
 

Functions

int GNUNET_run_messenger_setup (const char *test_name, const struct test_configuration *cfg)
 

Detailed Description

A simple test-case setup for the messenger service.

Author
Tobias Frisch

Definition in file testing_messenger_setup.h.

Function Documentation

◆ GNUNET_run_messenger_setup()

int GNUNET_run_messenger_setup ( const char *  test_name,
const struct test_configuration cfg 
)

Definition at line 521 of file testing_messenger_setup.c.

523 {
524  struct test_properties properties;
525  memset(&properties, 0, sizeof(properties));
526 
527  properties.cfg = cfg;
528  properties.peers = GNUNET_new_array(cfg->count, struct test_peer);
529 
530  for (unsigned int i = 0; i < cfg->count; i++)
531  if (0 != (cfg->stages[i] & 0x11))
532  properties.num_hosts++;
533 
534  properties.status = 1;
535  properties.barrier = GNUNET_init_barrier (cfg->count, &barrier_cb, &properties);
536 
537  if (GNUNET_OK != GNUNET_TESTBED_test_run (test_name, "test_messenger_api.conf",
538  cfg->count,
540  &run, &properties,
541  &init, &properties))
542  return 1;
543 
544  GNUNET_free(properties.peers);
545 
546  return properties.status;
547 }
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
@ GNUNET_OK
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
int GNUNET_TESTBED_test_run(const char *testname, const char *cfg_filename, unsigned int num_peers, uint64_t event_mask, GNUNET_TESTBED_ControllerCallback cc, void *cc_cls, GNUNET_TESTBED_TestMaster test_master, void *test_master_cls)
Convenience method for running a "simple" test on the local system with a single call from 'main'.
@ GNUNET_TESTBED_ET_PEER_START
A peer has been started.
struct GNUNET_BarrierHandle * GNUNET_init_barrier(unsigned int requirement, GNUNET_BarrierStatusCallback cb, void *cb_cls)
Initialise a pseudo-barrier and call the given callback when the required amount of peers (requiremen...
static void barrier_cb(void *cls, struct GNUNET_BarrierHandle *barrier, int status)
static void run(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
Main function for a peer of the testcase.
static void init(void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, unsigned int links_succeeded, unsigned int links_failed)

References test_properties::barrier, barrier_cb(), cfg, test_properties::cfg, GNUNET_free, GNUNET_init_barrier(), GNUNET_new_array, GNUNET_OK, GNUNET_TESTBED_ET_PEER_START, GNUNET_TESTBED_test_run(), init(), test_properties::num_hosts, test_properties::peers, run(), and test_properties::status.

Here is the call graph for this function: