Motr  M0
at_ut.c File Reference
#include "lib/trace.h"
#include "lib/memory.h"
#include "fop/fom.h"
#include "fop/fom_generic.h"
#include "reqh/reqh.h"
#include "reqh/reqh_service.h"
#include "rpc/rpc_opcodes.h"
#include "net/net.h"
#include "net/buffer_pool.h"
#include "ut/ut.h"
#include "rpc/rpc.h"
#include "rpc/rpclib.h"
#include "rpc/at.h"
#include "rpc/ut/at/at_ut.h"
#include "rpc/ut/at/at_ut_xc.h"
Include dependency graph for at_ut.c:

Go to the source code of this file.

Data Structures

struct  atut_reqh
 
struct  atut_clctx
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT
 
#define SERVER_ENDPOINT_ADDR   "0@lo:12345:34:1"
 
#define CLIENT_ENDPOINT_ADDR   "0@lo:12345:34:2"
 

Enumerations

enum  atfom_phase { AT_LOAD = M0_FOPH_TYPE_SPECIFIC, AT_LOAD_DONE, AT_REP_PREP }
 

Functions

static int atsvc_start (struct m0_reqh_service *svc)
 
static void atsvc_stop (struct m0_reqh_service *svc)
 
static void atsvc_fini (struct m0_reqh_service *svc)
 
static int atsvc_type_allocate (struct m0_reqh_service **svc, const struct m0_reqh_service_type *stype)
 
static void req_fini (void)
 
static void req_send (struct atut__req *req, struct atut__rep **rep)
 
M0_INTERNAL void atut__bufdata_alloc (struct m0_buf *buf, size_t size, struct m0_rpc_machine *rmach)
 
static struct m0_rpc_connclient_conn (void)
 
static size_t atfom_home_locality (const struct m0_fom *fom)
 
static bool atdata_is_correct (const struct m0_buf *buf, uint32_t len)
 
static bool atbuf_check (const struct m0_rpc_at_buf *ab, uint32_t len, enum m0_rpc_at_type type)
 
static void reqbuf_check (uint32_t test_id, const struct m0_buf *buf, int rc)
 
static void load_check (uint32_t test_id, const struct m0_rpc_at_buf *ab, int result)
 
static void repbuf_fill (uint32_t test_id, struct m0_buf *buf)
 
static void reply_check (uint32_t test_id, const struct m0_rpc_at_buf *ab, int result)
 
static void reply_rc_check (uint32_t test_id, const struct m0_rpc_at_buf *ab, int rc)
 
bool reply_is_necessary (uint32_t test_id)
 
static int atfom_tick (struct m0_fom *fom0)
 
static void atfom_fini (struct m0_fom *fom0)
 
static int atfom_create (struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
 
static void at_fops_init (void)
 
static void at_fops_fini (void)
 
static void client_start (void)
 
static void client_stop (void)
 
static void reqh_start (void)
 
static void reqh_stop (void)
 
static void reqh_init (void)
 
static void reqh_fini (void)
 
static void init (void)
 
static void fini (void)
 
static void init_fini (void)
 
static void inline_send (void)
 
static void inbulk_send (void)
 
static void inline__recv (uint32_t test_id, uint32_t len)
 
static void inline_recv (void)
 
static void inline_recv_unk (void)
 
static void inbulk_recv_unk (void)
 
static void inbulk_recv (void)
 

Variables

static struct atut_reqh atreqh
 
static struct atut_clctx at_cctx
 
static struct m0_reqh_serviceatsvc
 
static struct m0_fop_type atbuf_req_fopt
 
static struct m0_fop_type atbuf_rep_fopt
 
static const struct m0_fom_ops atfom_ops
 
static m0_bcount_t at_seg_size
 
static m0_bcount_t at_buf_size
 
static const struct m0_reqh_service_ops atsvc_ops
 
static const struct m0_reqh_service_type_ops atsvc_type_ops
 
static struct m0_reqh_service_type atsvc_type
 
static struct m0_fopg_reqfop
 
static struct m0_sm_state_descr atfom_phases []
 
static struct m0_sm_conf at_sm_conf
 
static const struct m0_fom_type_ops atfom_type_ops
 
struct m0_ut_suite rpc_at_ut
 

Macro Definition Documentation

◆ CLIENT_ENDPOINT_ADDR

#define CLIENT_ENDPOINT_ADDR   "0@lo:12345:34:2"

Definition at line 54 of file at_ut.c.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT

Definition at line 23 of file at_ut.c.

◆ SERVER_ENDPOINT_ADDR

#define SERVER_ENDPOINT_ADDR   "0@lo:12345:34:1"

Definition at line 53 of file at_ut.c.

Enumeration Type Documentation

◆ atfom_phase

Enumerator
AT_LOAD 
AT_LOAD_DONE 
AT_REP_PREP 

Definition at line 171 of file at_ut.c.

Function Documentation

◆ at_fops_fini()

static void at_fops_fini ( void  )
static

Definition at line 464 of file at_ut.c.

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

◆ at_fops_init()

static void at_fops_init ( void  )
static

Definition at line 442 of file at_ut.c.

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

◆ atbuf_check()

static bool atbuf_check ( const struct m0_rpc_at_buf ab,
uint32_t  len,
enum m0_rpc_at_type  type 
)
static

Definition at line 205 of file at_ut.c.

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

◆ atdata_is_correct()

static bool atdata_is_correct ( const struct m0_buf buf,
uint32_t  len 
)
static

Definition at line 197 of file at_ut.c.

Here is the caller graph for this function:

◆ atfom_create()

static int atfom_create ( struct m0_fop fop,
struct m0_fom **  out,
struct m0_reqh reqh 
)
static

Definition at line 412 of file at_ut.c.

Here is the call graph for this function:

◆ atfom_fini()

static void atfom_fini ( struct m0_fom fom0)
static

Definition at line 403 of file at_ut.c.

Here is the call graph for this function:

◆ atfom_home_locality()

static size_t atfom_home_locality ( const struct m0_fom fom)
static

Definition at line 192 of file at_ut.c.

◆ atfom_tick()

static int atfom_tick ( struct m0_fom fom0)
static

Definition at line 360 of file at_ut.c.

Here is the call graph for this function:

◆ atsvc_fini()

static void atsvc_fini ( struct m0_reqh_service svc)
static

Definition at line 89 of file at_ut.c.

Here is the call graph for this function:

◆ atsvc_start()

static int atsvc_start ( struct m0_reqh_service svc)
static

Definition at line 80 of file at_ut.c.

◆ atsvc_stop()

static void atsvc_stop ( struct m0_reqh_service svc)
static

Definition at line 85 of file at_ut.c.

◆ atsvc_type_allocate()

static int atsvc_type_allocate ( struct m0_reqh_service **  svc,
const struct m0_reqh_service_type stype 
)
static

Definition at line 94 of file at_ut.c.

◆ atut__bufdata_alloc()

M0_INTERNAL void atut__bufdata_alloc ( struct m0_buf buf,
size_t  size,
struct m0_rpc_machine rmach 
)

Definition at line 143 of file at_ut.c.

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

◆ client_conn()

static struct m0_rpc_conn* client_conn ( void  )
static

Definition at line 162 of file at_ut.c.

Here is the caller graph for this function:

◆ client_start()

static void client_start ( void  )
static

Definition at line 475 of file at_ut.c.

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

◆ client_stop()

static void client_stop ( void  )
static

Definition at line 494 of file at_ut.c.

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

◆ fini()

static void fini ( void  )
static

Definition at line 574 of file at_ut.c.

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

◆ inbulk_recv()

static void inbulk_recv ( void  )
static

Definition at line 720 of file at_ut.c.

Here is the call graph for this function:

◆ inbulk_recv_unk()

static void inbulk_recv_unk ( void  )
static

Definition at line 689 of file at_ut.c.

Here is the call graph for this function:

◆ inbulk_send()

static void inbulk_send ( void  )
static

Definition at line 621 of file at_ut.c.

Here is the call graph for this function:

◆ init()

static void init ( void  )
static

Definition at line 567 of file at_ut.c.

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

◆ init_fini()

static void init_fini ( void  )
static

Definition at line 585 of file at_ut.c.

Here is the call graph for this function:

◆ inline__recv()

static void inline__recv ( uint32_t  test_id,
uint32_t  len 
)
static

Definition at line 649 of file at_ut.c.

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

◆ inline_recv()

static void inline_recv ( void  )
static

Definition at line 679 of file at_ut.c.

Here is the call graph for this function:

◆ inline_recv_unk()

static void inline_recv_unk ( void  )
static

Definition at line 684 of file at_ut.c.

Here is the call graph for this function:

◆ inline_send()

static void inline_send ( void  )
static

Definition at line 593 of file at_ut.c.

Here is the call graph for this function:

◆ load_check()

static void load_check ( uint32_t  test_id,
const struct m0_rpc_at_buf ab,
int  result 
)
static

Definition at line 260 of file at_ut.c.

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

◆ repbuf_fill()

static void repbuf_fill ( uint32_t  test_id,
struct m0_buf buf 
)
static

Definition at line 287 of file at_ut.c.

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

◆ reply_check()

static void reply_check ( uint32_t  test_id,
const struct m0_rpc_at_buf ab,
int  result 
)
static

Definition at line 311 of file at_ut.c.

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

◆ reply_is_necessary()

bool reply_is_necessary ( uint32_t  test_id)

Definition at line 355 of file at_ut.c.

Here is the caller graph for this function:

◆ reply_rc_check()

static void reply_rc_check ( uint32_t  test_id,
const struct m0_rpc_at_buf ab,
int  rc 
)
static

Definition at line 333 of file at_ut.c.

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

◆ req_fini()

static void req_fini ( void  )
static

Definition at line 121 of file at_ut.c.

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

◆ req_send()

static void req_send ( struct atut__req req,
struct atut__rep **  rep 
)
static

Definition at line 127 of file at_ut.c.

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

◆ reqbuf_check()

static void reqbuf_check ( uint32_t  test_id,
const struct m0_buf buf,
int  rc 
)
static

Definition at line 238 of file at_ut.c.

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

◆ reqh_fini()

static void reqh_fini ( void  )
static

Definition at line 558 of file at_ut.c.

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

◆ reqh_init()

static void reqh_init ( void  )
static

Definition at line 527 of file at_ut.c.

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

◆ reqh_start()

static void reqh_start ( void  )
static

Definition at line 503 of file at_ut.c.

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

◆ reqh_stop()

static void reqh_stop ( void  )
static

Definition at line 516 of file at_ut.c.

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

Variable Documentation

◆ at_buf_size

m0_bcount_t at_buf_size
static

Definition at line 63 of file at_ut.c.

◆ at_cctx

struct atut_clctx at_cctx
static

Definition at line 57 of file at_ut.c.

◆ at_seg_size

m0_bcount_t at_seg_size
static

Definition at line 62 of file at_ut.c.

◆ at_sm_conf

struct m0_sm_conf at_sm_conf
static
Initial value:
= {
.scf_name = "atfom",
.scf_nr_states = ARRAY_SIZE(atfom_phases),
.scf_state = atfom_phases,
}
static struct m0_sm_state_descr atfom_phases[]
Definition: at_ut.c:177
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 426 of file at_ut.c.

◆ atbuf_rep_fopt

struct m0_fop_type atbuf_rep_fopt
static

Definition at line 60 of file at_ut.c.

◆ atbuf_req_fopt

struct m0_fop_type atbuf_req_fopt
static

Definition at line 59 of file at_ut.c.

◆ atfom_ops

static const struct m0_fom_ops atfom_ops
static
Initial value:
= {
.fo_tick = atfom_tick,
.fo_home_locality = atfom_home_locality,
.fo_fini = atfom_fini
}
static int atfom_tick(struct m0_fom *fom0)
Definition: at_ut.c:360
static size_t atfom_home_locality(const struct m0_fom *fom)
Definition: at_ut.c:192
static void atfom_fini(struct m0_fom *fom0)
Definition: at_ut.c:403

Definition at line 61 of file at_ut.c.

◆ atfom_phases

struct m0_sm_state_descr atfom_phases[]
static
Initial value:
= {
[AT_LOAD] = {
.sd_name = "load",
.sd_allowed = M0_BITS(AT_LOAD_DONE)
},
.sd_name = "load-done",
},
.sd_name = "prepare-reply",
.sd_allowed = M0_BITS(M0_FOPH_SUCCESS)
},
}
#define M0_BITS(...)
Definition: misc.h:236
Definition: at_ut.c:172

Definition at line 177 of file at_ut.c.

◆ atfom_type_ops

const struct m0_fom_type_ops atfom_type_ops
static
Initial value:
= {
.fto_create = atfom_create
}
static int atfom_create(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: at_ut.c:412

Definition at line 438 of file at_ut.c.

◆ atreqh

struct atut_reqh atreqh
static

Definition at line 56 of file at_ut.c.

◆ atsvc

struct m0_reqh_service* atsvc
static

Definition at line 58 of file at_ut.c.

◆ atsvc_ops

const struct m0_reqh_service_ops atsvc_ops
static
Initial value:
= {
.rso_start = &atsvc_start,
.rso_stop = &atsvc_stop,
.rso_fini = &atsvc_fini
}
static void atsvc_stop(struct m0_reqh_service *svc)
Definition: at_ut.c:85
static int atsvc_start(struct m0_reqh_service *svc)
Definition: at_ut.c:80
int m0_reqh_service_async_start_simple(struct m0_reqh_service_start_async_ctx *asc)
Definition: reqh_service.c:601
static void atsvc_fini(struct m0_reqh_service *svc)
Definition: at_ut.c:89

Definition at line 73 of file at_ut.c.

◆ atsvc_type

struct m0_reqh_service_type atsvc_type
static
Initial value:
= {
.rst_name = "at_ut",
.rst_ops = &atsvc_type_ops,
.rst_level = M0_RS_LEVEL_NORMAL,
.rst_typecode = M0_CST_DS1
}
static const struct m0_reqh_service_type_ops atsvc_type_ops
Definition: at_ut.c:104

Definition at line 108 of file at_ut.c.

◆ atsvc_type_ops

const struct m0_reqh_service_type_ops atsvc_type_ops
static
Initial value:
= {
.rsto_service_allocate = &atsvc_type_allocate
}
static int atsvc_type_allocate(struct m0_reqh_service **svc, const struct m0_reqh_service_type *stype)
Definition: at_ut.c:94

Definition at line 104 of file at_ut.c.

◆ g_reqfop

struct m0_fop* g_reqfop
static

Definition at line 119 of file at_ut.c.

◆ rpc_at_ut

struct m0_ut_suite rpc_at_ut
Initial value:
= {
.ts_name = "rpc-at",
.ts_owners = "Egor",
.ts_init = NULL,
.ts_fini = NULL,
.ts_tests = {
{ "init-fini", init_fini, "Egor" },
{ "inline-send", inline_send, "Egor" },
{ "inbulk-send", inbulk_send, "Egor" },
{ "inline-recv", inline_recv, "Egor" },
{ "inline-recv-unk", inline_recv_unk, "Egor" },
{ "inbulk-recv-unk", inbulk_recv_unk, "Egor" },
{ "inbulk-recv", inbulk_recv, "Egor" },
{ NULL, NULL }
}
}
#define NULL
Definition: misc.h:38
static void inbulk_recv_unk(void)
Definition: at_ut.c:689
static void inline_send(void)
Definition: at_ut.c:593
static void inbulk_send(void)
Definition: at_ut.c:621
static void inline_recv_unk(void)
Definition: at_ut.c:684
static void inline_recv(void)
Definition: at_ut.c:679
static void init_fini(void)
Definition: at_ut.c:585
static void inbulk_recv(void)
Definition: at_ut.c:720

Definition at line 752 of file at_ut.c.