Motr  M0
consumer.c File Reference
#include "lib/trace.h"
#include "lib/misc.h"
#include "ut/ut.h"
#include "addb2/addb2.h"
#include "addb2/consumer.h"
#include "addb2/ut/common.h"
Include dependency graph for consumer.c:

Go to the source code of this file.

Data Structures

struct  stream
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT
 

Enumerations

enum  { LABEL_ID = 0x7fff5aa4a947 }
 

Functions

static int noop_submit (const struct m0_addb2_mach *m, struct m0_addb2_trace *t)
 
static void test_fire (const struct m0_addb2_source *s, const struct m0_addb2_philter *p, const struct m0_addb2_callback *c, const struct m0_addb2_record *r)
 
static void source_get (void)
 
static void source_put (void)
 
static void cmp_fire (const struct m0_addb2_source *s, const struct m0_addb2_philter *p, const struct m0_addb2_callback *c, const struct m0_addb2_record *r)
 
static void empty (void)
 
static void empty_push_pop (void)
 
static void data (void)
 
static void data_label (void)
 
static void sensor (void)
 
static void sensor_N (void)
 
static void sensor_check_fire (const struct m0_addb2_source *s, const struct m0_addb2_philter *p, const struct m0_addb2_callback *c, const struct m0_addb2_record *r)
 
static void id_philter (void)
 
static void global_philter (void)
 

Variables

static struct m0_addb2_machm
 
static struct m0_addb2_sources
 
static struct m0_addb2_philter p
 
static struct m0_addb2_callback c
 
static struct m0_addb2_sensor sen
 
static void(* fire )(const struct m0_addb2_source *, const struct m0_addb2_philter *, const struct m0_addb2_callback *, const struct m0_addb2_record *) = NULL
 
static struct streamshouldbe
 
static uint64_t fired
 
static uint64_t payload [1024]
 
struct m0_ut_suite addb2_consumer_ut
 

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT

Definition at line 22 of file consumer.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
LABEL_ID 

Definition at line 110 of file consumer.c.

Function Documentation

◆ cmp_fire()

static void cmp_fire ( const struct m0_addb2_source s,
const struct m0_addb2_philter p,
const struct m0_addb2_callback c,
const struct m0_addb2_record r 
)
static

Definition at line 85 of file consumer.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ data()

static void data ( void  )
static

"data" test: add a record, check that it is returned to the consumer.

Definition at line 141 of file consumer.c.

Here is the call graph for this function:

◆ data_label()

static void data_label ( void  )
static

"data-label" test: create a context, add records; check that records are returned with correct labels.

Definition at line 165 of file consumer.c.

Here is the call graph for this function:

◆ empty()

static void empty ( void  )
static

"empty" test: check that empty trace is empty.

Definition at line 101 of file consumer.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ empty_push_pop()

static void empty_push_pop ( void  )
static

"empty-push-pop" test: check that trace with context manipulations only contains no records.

Definition at line 120 of file consumer.c.

Here is the call graph for this function:

◆ global_philter()

static void global_philter ( void  )
static

"global-philter" test: check that m0_addb2_philter_global_{add,del}() manipulate global philter list.

Definition at line 360 of file consumer.c.

Here is the call graph for this function:

◆ id_philter()

static void id_philter ( void  )
static

"id-philter" test: create a context, add a sensor, add a number of records. Create an id-philter for the sensor, check that the philter sees all sensor read outs.

Definition at line 316 of file consumer.c.

Here is the call graph for this function:

◆ noop_submit()

static int noop_submit ( const struct m0_addb2_mach m,
struct m0_addb2_trace t 
)
static

Definition at line 31 of file consumer.c.

Here is the caller graph for this function:

◆ sensor()

static void sensor ( void  )
static

"sensor" test: create a context, add a sensor; check that the sensor readings are returned correctly.

Definition at line 243 of file consumer.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sensor_check_fire()

static void sensor_check_fire ( const struct m0_addb2_source s,
const struct m0_addb2_philter p,
const struct m0_addb2_callback c,
const struct m0_addb2_record r 
)
static

Definition at line 295 of file consumer.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sensor_N()

static void sensor_N ( void  )
static

"sensor-N" test: create a context, add a sensor, force the trace buffer to completion; check that the sensor readings are reproduced.

Definition at line 268 of file consumer.c.

Here is the call graph for this function:

◆ source_get()

static void source_get ( void  )
static

Definition at line 57 of file consumer.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ source_put()

static void source_put ( void  )
static

Definition at line 67 of file consumer.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_fire()

static void test_fire ( const struct m0_addb2_source s,
const struct m0_addb2_philter p,
const struct m0_addb2_callback c,
const struct m0_addb2_record r 
)
static

Definition at line 49 of file consumer.c.

Here is the caller graph for this function:

Variable Documentation

◆ addb2_consumer_ut

struct m0_ut_suite addb2_consumer_ut
Initial value:
= {
.ts_name = "addb2-consumer",
.ts_init = NULL,
.ts_fini = NULL,
.ts_tests = {
{ "empty", &empty },
{ "empty-push-pop", &empty_push_pop },
{ "data", &data },
{ "data-label", &data_label },
{ "sensor", &sensor },
{ "sensor-N", &sensor_N },
{ "id-philter", &id_philter },
{ "global-philter", &global_philter },
{ NULL, NULL }
}
}
static void id_philter(void)
Definition: consumer.c:316
static void sensor(void)
Definition: consumer.c:243
#define NULL
Definition: misc.h:38
static void data(void)
Definition: consumer.c:141
static void empty_push_pop(void)
Definition: consumer.c:120
static void global_philter(void)
Definition: consumer.c:360
static void sensor_N(void)
Definition: consumer.c:268
static void data_label(void)
Definition: consumer.c:165
static void empty(void)
Definition: consumer.c:101

Definition at line 391 of file consumer.c.

◆ c

struct m0_addb2_callback c
static

Definition at line 41 of file consumer.c.

◆ fire

void(* fire) (const struct m0_addb2_source *, const struct m0_addb2_philter *, const struct m0_addb2_callback *, const struct m0_addb2_record *) = NULL
static

Definition at line 44 of file consumer.c.

◆ fired

uint64_t fired
static

Definition at line 83 of file consumer.c.

◆ m

struct m0_addb2_mach* m
static

Definition at line 38 of file consumer.c.

◆ p

struct m0_addb2_philter p
static

Definition at line 40 of file consumer.c.

◆ payload

uint64_t payload[1024]
static

Definition at line 114 of file consumer.c.

◆ s

struct m0_addb2_source* s
static

Definition at line 39 of file consumer.c.

◆ sen

struct m0_addb2_sensor sen
static

Definition at line 42 of file consumer.c.

◆ shouldbe

struct stream * shouldbe
static