GNUnet  0.11.x
Data Structures | Functions
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 503 of file testing_messenger_setup.c.

References test_properties::barrier, barrier_cb(), cfg, test_properties::cfg, test_configuration::count, 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(), test_configuration::stages, and test_properties::status.

504 {
505  struct test_properties properties;
506  memset(&properties, 0, sizeof(properties));
507 
508  properties.cfg = cfg;
509  properties.peers = GNUNET_new_array(cfg->count, struct test_peer);
510 
511  for (unsigned int i = 0; i < cfg->count; i++)
512  if (0 != (cfg->stages[i] & 0x11))
513  properties.num_hosts++;
514 
515  properties.status = 1;
516  properties.barrier = GNUNET_init_barrier (cfg->count, &barrier_cb, &properties);
517 
518  if (GNUNET_OK != GNUNET_TESTBED_test_run (test_name, "test_messenger_api.conf",
519  cfg->count,
521  &run, &properties,
522  &init, &properties))
523  return 1;
524 
525  GNUNET_free(properties.peers);
526 
527  return properties.status;
528 }
static void run(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
Main function for a peer of the testcase.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
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 &#39;main&#39;...
static void barrier_cb(void *cls, struct GNUNET_BarrierHandle *barrier, int status)
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)
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
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...
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function: