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

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT
 

Enumerations

enum  { SKIPME = 0xbebebebebe4ebebe, END = 0xbcbcbcbcbcbcb7bc }
 
enum  { LABEL_ID_0 = 0x17 }
 

Functions

static void init_fini (void)
 
static bool trace_eq (const struct m0_addb2_trace *t0, const struct m0_addb2_trace *t1)
 
static int check_submit (const struct m0_addb2_mach *mach, struct m0_addb2_trace *trace)
 
static void push_pop (void)
 
static void push0_pop (void)
 
static void push5_pop (void)
 
static void pushN_popN (void)
 
static void add (void)
 
static void add_var (void)
 
static int full_submit (const struct m0_addb2_mach *mach, struct m0_addb2_trace *trace)
 
static void full (void)
 
void idle_idle (const struct m0_addb2_mach *mach)
 
static void stop_idle (void)
 
static int sensor_submit (const struct m0_addb2_mach *mach, struct m0_addb2_trace *trace)
 
static void sensor_depth (void)
 

Variables

static const struct m0_addb2_mach_ops null_ops
 
const uint64_t payload []
 
static struct m0_addb2_traceshouldbe
 
static int added
 
static bool enough
 
static int total
 
static int keep
 
static int used
 
static const struct m0_addb2_tracebusy [1000]
 
static bool idled = false
 
static uint64_t found
 
static unsigned depth
 
struct m0_ut_suite addb2_base_ut
 

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT

Definition at line 22 of file base.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SKIPME 
END 

Definition at line 47 of file base.c.

◆ anonymous enum

anonymous enum
Enumerator
LABEL_ID_0 

Definition at line 61 of file base.c.

Function Documentation

◆ add()

static void add ( void  )
static

"add" test: add one record in empty context, check that the generated trace is valid.

Definition at line 233 of file base.c.

Here is the call graph for this function:

◆ add_var()

static void add_var ( void  )
static

"add-var" test: add a number of records with variably-sized payloads in a non-empty context, check that the generated trace is valid.

Definition at line 255 of file base.c.

Here is the call graph for this function:

◆ check_submit()

static int check_submit ( const struct m0_addb2_mach mach,
struct m0_addb2_trace trace 
)
static

Definition at line 92 of file base.c.

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

◆ full()

static void full ( void  )
static

"full" test: add records with variable identifiers until a number of trace buffers is fully occupied. Check the traces.

Definition at line 334 of file base.c.

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

◆ full_submit()

static int full_submit ( const struct m0_addb2_mach mach,
struct m0_addb2_trace trace 
)
static

Definition at line 307 of file base.c.

Here is the caller graph for this function:

◆ idle_idle()

void idle_idle ( const struct m0_addb2_mach mach)

Definition at line 348 of file base.c.

Here is the caller graph for this function:

◆ init_fini()

static void init_fini ( void  )
static

"init-fini" test.

Smoke test: initialise and finalise addb2 machine.

Definition at line 38 of file base.c.

Here is the call graph for this function:

◆ push0_pop()

static void push0_pop ( void  )
static

"push0-pop" test.

Push a label with empty payload, pop it; check that the generated trace is valid.

Definition at line 138 of file base.c.

Here is the call graph for this function:

◆ push5_pop()

static void push5_pop ( void  )
static

"push5-pop" test.

Push a label, pop it, check that the generated trace is valid.

Definition at line 163 of file base.c.

Here is the call graph for this function:

◆ push_pop()

static void push_pop ( void  )
static

"push-pop" test.

Push one label, pop it; check that the generated trace is valid.

Definition at line 111 of file base.c.

Here is the call graph for this function:

◆ pushN_popN()

static void pushN_popN ( void  )
static

"push^N-pop^N" test.

Push a few labels, pop them all, check that the generated trace is valid.

Definition at line 193 of file base.c.

Here is the call graph for this function:

◆ sensor_depth()

static void sensor_depth ( void  )
static

"sensor-depth" test: create a depth context, add a sensor in it, force trace buffer to completion. Check that the context and sensor are reprodced in the next trace buffer.

Definition at line 402 of file base.c.

Here is the call graph for this function:

◆ sensor_submit()

static int sensor_submit ( const struct m0_addb2_mach mach,
struct m0_addb2_trace trace 
)
static

Definition at line 379 of file base.c.

Here is the caller graph for this function:

◆ stop_idle()

static void stop_idle ( void  )
static

"stop-idle" test: check that m0_addb2_stop() works correctly.

Definition at line 357 of file base.c.

Here is the call graph for this function:

◆ trace_eq()

static bool trace_eq ( const struct m0_addb2_trace t0,
const struct m0_addb2_trace t1 
)
static

Definition at line 52 of file base.c.

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

Variable Documentation

◆ addb2_base_ut

struct m0_ut_suite addb2_base_ut
Initial value:
= {
.ts_name = "addb2-base",
.ts_init = NULL,
.ts_fini = NULL,
.ts_tests = {
{ "init-fini", &init_fini },
{ "push-pop", &push_pop },
{ "push0-pop", &push0_pop },
{ "push5-pop", &push5_pop },
{ "push^N-pop^N", &pushN_popN },
{ "add", &add },
{ "add-var", &add_var },
{ "full", &full },
{ "stop-idle", &stop_idle },
{ "sensor-depth", &sensor_depth },
{ NULL, NULL }
}
}
#define NULL
Definition: misc.h:38
static void sensor_depth(void)
Definition: base.c:402
static void full(void)
Definition: base.c:334
static void push0_pop(void)
Definition: base.c:138
static void pushN_popN(void)
Definition: base.c:193
static void push5_pop(void)
Definition: base.c:163
static void add_var(void)
Definition: base.c:255
static void push_pop(void)
Definition: base.c:111
static void init_fini(void)
Definition: base.c:38
static void stop_idle(void)
Definition: base.c:357
static void add(void)
Definition: base.c:233

Definition at line 431 of file base.c.

◆ added

int added
static

Definition at line 300 of file base.c.

◆ busy

const struct m0_addb2_trace* busy[1000]
static

Definition at line 305 of file base.c.

◆ depth

unsigned depth
static

Definition at line 377 of file base.c.

◆ enough

bool enough
static

Definition at line 301 of file base.c.

◆ found

uint64_t found
static

Definition at line 376 of file base.c.

◆ idled

bool idled = false
static

Definition at line 346 of file base.c.

◆ keep

int keep
static

Definition at line 303 of file base.c.

◆ null_ops

const struct m0_addb2_mach_ops null_ops
static
Initial value:
= {
}

Definition at line 30 of file base.c.

◆ payload

const uint64_t payload[]
Initial value:
= {
0x7472756374206d30,
0x5f61646462325f74,
0x726163652073686f,
0x756c646265203d20,
0x7b0a09092e74725f,
0x6e72203d20332c0a,
0x09092e74725f626f,
0x6479203d20287569,
0x3131303030303030,
0x303030303030207c,
0x204c4142454c5f49,
0x445f302c202f2a20,
0x505553482031372c,
0x2031202a2f0a0909,
0x094c4142454c5f56,
0x414c55455f302c20,
0x2020202020202020,
0x2020202020202020,
0x2f2a207061796c6f,
0x6164202a2f0a0909,
0x0930783066303030,
0x3030303030303030
}

Definition at line 65 of file base.c.

◆ shouldbe

struct m0_addb2_trace* shouldbe
static

Definition at line 90 of file base.c.

◆ total

int total
static

Definition at line 302 of file base.c.

◆ used

int used
static

Definition at line 304 of file base.c.