Motr  M0
service_ut.c File Reference
#include "lib/trace.h"
#include "lib/misc.h"
#include "ut/misc.h"
#include "ut/ut.h"
#include "iscservice/isc.h"
#include "iscservice/isc_service.h"
#include "iscservice/ut/common.h"
#include "lib/finject.h"
#include "rpc/rpclib.h"
#include "rpc/ut/at/at_ut.h"
#include <stdio.h>
Include dependency graph for service_ut.c:

Go to the source code of this file.

Data Structures

struct  remote_invoke_var
 
struct  visitor_entry
 
struct  comp_req_aux
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT
 
#define SERVER_ENDPOINT_ADDR   "0@lo:12345:34:1"
 
#define SERVER_ENDPOINT   M0_NET_XPRT_PREFIX_DEFAULT":"SERVER_ENDPOINT_ADDR
 
#define CLIENT_ENDPOINT_ADDR   "0@lo:12345:34:2"
 
#define F_CONT   0x12345
 
#define BARRIER_CNT   2
 

Enumerations

enum  funct_type { FT_NEITHER_IO, FT_NO_INPUT, FT_NO_OUTPUT, FT_BOTH_IO }
 
enum  concc_type { CT_SAME_FID, CT_DIFF_FID }
 
enum  buf_type { BT_INLINE, BT_INBULK }
 
enum  fop_processing_phase { FPP_SEND, FPP_REPLY_PROCESS, FPP_COMPLETE, FPP_INVALID }
 

Functions

static void req_fop_prepare (struct m0_fop *req_fop, uint32_t buf_type, struct m0_fid *fid, uint32_t f_type)
 
static void isc_item_cb (struct m0_rpc_item *item)
 
static void fid_get (const char *f_name, struct m0_fid *fid)
 
int isc_ut_server_start (void)
 
static void isc_ut_server_stop (void)
 
static void isc_ut_client_start (void)
 
static void isc_ut_client_stop ()
 
static int null_computation (struct m0_buf *in, struct m0_buf *out, struct m0_isc_comp_private *comp_data, int *rc)
 
static struct m0_rpc_machinefom_rmach (const struct m0_fom *fom)
 
static int string_update (struct m0_buf *in, struct m0_buf *out, struct m0_isc_comp_private *comp_data, int *rc)
 
static int strguess (struct m0_buf *in, struct m0_buf *out, struct m0_isc_comp_private *comp_data, int *rc)
 
static void comp_launch (void *args)
 
static void vis_entry_init (uint32_t barrier_cnt)
 
static void vis_entry_fini (void)
 
static int barrier (struct m0_buf *in, struct m0_buf *out, struct m0_isc_comp_private *comp_data, int *rc)
 
static void local_invocation (struct m0_isc_comp_req *comp_req, struct m0_fid *fid, int exp_rc)
 
static void comp_req_init (void *arg, int tid)
 
static void test_comp_launch (void)
 
static void test_local_err_path (void)
 
static void test_comp_state (void)
 
static uint32_t remote_invocation_async (struct m0_fid *fid, int exp_rc, uint32_t buf_type, uint32_t phase, struct m0_fop **arg_fop)
 
static void ret_codes_precond (int exp_rc, uint32_t buf_type, struct m0_fid *fid)
 
static void ret_codes_postcond (int exp_rc, void *arg)
 
static void remote_invocation (struct m0_fid *fid, int exp_rc, uint32_t f_type, uint32_t buf_type)
 
static uint32_t expected_output (uint32_t f_type)
 
static void comp_remote_invoke (struct comp_req_aux *cra, uint32_t f_type)
 
static void test_comp_signature (void)
 
static void test_remote_waiting (void)
 
static void test_remote_err_path (void)
 

Variables

static struct m0_reqh_serviceiscs
 
static struct m0_rpc_server_ctx isc_ut_sctx
 
static struct m0_rpc_client_ctx isc_ut_cctx
 
static struct m0_net_domain isc_ut_client_ndom
 
static uint32_t cc_type
 
static const char * SERVER_LOGFILE = "isc_ut.log"
 
char * isc_ut_server_args []
 
struct remote_invoke_var remote_call_info
 
static const struct m0_rpc_item_ops isc_item_ops
 
struct visitor_entry vis_ent
 
static int ret_codes []
 
struct comp_req_aux cra
 
char * fixed_str = "abcdefgh"
 
struct m0_ut_suite isc_service_ut
 

Macro Definition Documentation

◆ BARRIER_CNT

#define BARRIER_CNT   2

Definition at line 39 of file service_ut.c.

◆ CLIENT_ENDPOINT_ADDR

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

Definition at line 37 of file service_ut.c.

◆ F_CONT

#define F_CONT   0x12345

Definition at line 38 of file service_ut.c.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT

Definition at line 21 of file service_ut.c.

◆ SERVER_ENDPOINT

#define SERVER_ENDPOINT   M0_NET_XPRT_PREFIX_DEFAULT":"SERVER_ENDPOINT_ADDR

Definition at line 36 of file service_ut.c.

◆ SERVER_ENDPOINT_ADDR

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

Definition at line 35 of file service_ut.c.

Enumeration Type Documentation

◆ buf_type

enum buf_type
Enumerator
BT_INLINE 
BT_INBULK 

Definition at line 111 of file service_ut.c.

◆ concc_type

enum concc_type
Enumerator
CT_SAME_FID 
CT_DIFF_FID 

Definition at line 105 of file service_ut.c.

◆ fop_processing_phase

Enumerator
FPP_SEND 
FPP_REPLY_PROCESS 
FPP_COMPLETE 
FPP_INVALID 

Definition at line 539 of file service_ut.c.

◆ funct_type

enum funct_type
Enumerator
FT_NEITHER_IO 
FT_NO_INPUT 
FT_NO_OUTPUT 
FT_BOTH_IO 

Definition at line 90 of file service_ut.c.

Function Documentation

◆ barrier()

static int barrier ( struct m0_buf in,
struct m0_buf out,
struct m0_isc_comp_private comp_data,
int *  rc 
)
static

Definition at line 288 of file service_ut.c.

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

◆ comp_launch()

static void comp_launch ( void *  args)
static

Definition at line 256 of file service_ut.c.

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

◆ comp_remote_invoke()

static void comp_remote_invoke ( struct comp_req_aux cra,
uint32_t  f_type 
)
static

Definition at line 796 of file service_ut.c.

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

◆ comp_req_init()

static void comp_req_init ( void *  arg,
int  tid 
)
static

Definition at line 329 of file service_ut.c.

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

◆ expected_output()

static uint32_t expected_output ( uint32_t  f_type)
static

Definition at line 781 of file service_ut.c.

Here is the caller graph for this function:

◆ fid_get()

static void fid_get ( const char *  f_name,
struct m0_fid fid 
)
static

Definition at line 135 of file service_ut.c.

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

◆ fom_rmach()

static struct m0_rpc_machine* fom_rmach ( const struct m0_fom fom)
static

Definition at line 209 of file service_ut.c.

Here is the caller graph for this function:

◆ isc_item_cb()

static void isc_item_cb ( struct m0_rpc_item item)
static

Definition at line 67 of file service_ut.c.

Here is the call graph for this function:

◆ isc_ut_client_start()

static void isc_ut_client_start ( void  )
static

Definition at line 172 of file service_ut.c.

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

◆ isc_ut_client_stop()

static void isc_ut_client_stop ( )
static

Definition at line 193 of file service_ut.c.

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

◆ isc_ut_server_start()

int isc_ut_server_start ( void  )

Definition at line 142 of file service_ut.c.

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

◆ isc_ut_server_stop()

static void isc_ut_server_stop ( void  )
static

Definition at line 164 of file service_ut.c.

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

◆ local_invocation()

static void local_invocation ( struct m0_isc_comp_req comp_req,
struct m0_fid fid,
int  exp_rc 
)
static

Definition at line 311 of file service_ut.c.

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

◆ null_computation()

static int null_computation ( struct m0_buf in,
struct m0_buf out,
struct m0_isc_comp_private comp_data,
int *  rc 
)
static

Definition at line 202 of file service_ut.c.

Here is the caller graph for this function:

◆ remote_invocation()

static void remote_invocation ( struct m0_fid fid,
int  exp_rc,
uint32_t  f_type,
uint32_t  buf_type 
)
static

Definition at line 718 of file service_ut.c.

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

◆ remote_invocation_async()

static uint32_t remote_invocation_async ( struct m0_fid fid,
int  exp_rc,
uint32_t  buf_type,
uint32_t  phase,
struct m0_fop **  arg_fop 
)
static

Definition at line 546 of file service_ut.c.

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

◆ req_fop_prepare()

static void req_fop_prepare ( struct m0_fop req_fop,
uint32_t  buf_type,
struct m0_fid fid,
uint32_t  f_type 
)
static

Definition at line 598 of file service_ut.c.

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

◆ ret_codes_postcond()

static void ret_codes_postcond ( int  exp_rc,
void *  arg 
)
static

Definition at line 688 of file service_ut.c.

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

◆ ret_codes_precond()

static void ret_codes_precond ( int  exp_rc,
uint32_t  buf_type,
struct m0_fid fid 
)
static

Definition at line 654 of file service_ut.c.

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

◆ strguess()

static int strguess ( struct m0_buf in,
struct m0_buf out,
struct m0_isc_comp_private comp_data,
int *  rc 
)
static

Definition at line 245 of file service_ut.c.

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

◆ string_update()

static int string_update ( struct m0_buf in,
struct m0_buf out,
struct m0_isc_comp_private comp_data,
int *  rc 
)
static

Definition at line 215 of file service_ut.c.

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

◆ test_comp_launch()

static void test_comp_launch ( void  )
static

Definition at line 359 of file service_ut.c.

Here is the call graph for this function:

◆ test_comp_signature()

static void test_comp_signature ( void  )
static

Definition at line 813 of file service_ut.c.

Here is the call graph for this function:

◆ test_comp_state()

static void test_comp_state ( void  )
static

Definition at line 470 of file service_ut.c.

Here is the call graph for this function:

◆ test_local_err_path()

static void test_local_err_path ( void  )
static

Definition at line 419 of file service_ut.c.

Here is the call graph for this function:

◆ test_remote_err_path()

static void test_remote_err_path ( void  )
static

Definition at line 911 of file service_ut.c.

Here is the call graph for this function:

◆ test_remote_waiting()

static void test_remote_waiting ( void  )
static

Definition at line 850 of file service_ut.c.

Here is the call graph for this function:

◆ vis_entry_fini()

static void vis_entry_fini ( void  )
static

Definition at line 277 of file service_ut.c.

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

◆ vis_entry_init()

static void vis_entry_init ( uint32_t  barrier_cnt)
static

Definition at line 269 of file service_ut.c.

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

Variable Documentation

◆ cc_type

uint32_t cc_type
static

Definition at line 45 of file service_ut.c.

◆ cra

struct comp_req_aux cra

◆ fixed_str

char* fixed_str = "abcdefgh"

Definition at line 133 of file service_ut.c.

◆ isc_item_ops

const struct m0_rpc_item_ops isc_item_ops
static
Initial value:
= {
.rio_replied = isc_item_cb,
}
static void isc_item_cb(struct m0_rpc_item *item)
Definition: service_ut.c:67

Definition at line 83 of file service_ut.c.

◆ isc_service_ut

struct m0_ut_suite isc_service_ut
Initial value:
= {
.ts_name = "isc-service-ut",
.ts_init = NULL,
.ts_fini = NULL,
.ts_tests = {
{"comp-launch", test_comp_launch, "Nachiket"},
{"local-error-path", test_local_err_path, "Nachiket"},
{"comp-state", test_comp_state, "Nachiket"},
{"remote-comp-signature", test_comp_signature, "Nachiket"},
{"remote-waiting", test_remote_waiting, "Nachiket"},
{"remote-error-path", test_remote_err_path, "Nachiket"},
}
}
#define NULL
Definition: misc.h:38
static void test_remote_waiting(void)
Definition: service_ut.c:850
static void test_comp_signature(void)
Definition: service_ut.c:813
static void test_local_err_path(void)
Definition: service_ut.c:419
static void test_remote_err_path(void)
Definition: service_ut.c:911
static void test_comp_launch(void)
Definition: service_ut.c:359
static void test_comp_state(void)
Definition: service_ut.c:470

Definition at line 940 of file service_ut.c.

◆ isc_ut_cctx

struct m0_rpc_client_ctx isc_ut_cctx
static

Definition at line 43 of file service_ut.c.

◆ isc_ut_client_ndom

struct m0_net_domain isc_ut_client_ndom
static

Definition at line 44 of file service_ut.c.

◆ isc_ut_sctx

struct m0_rpc_server_ctx isc_ut_sctx
static

Definition at line 42 of file service_ut.c.

◆ isc_ut_server_args

char* isc_ut_server_args[]
Initial value:
= { "m0d", "-T", "LINUX",
"-D", "sr_db", "-S", "sr_stob",
"-A", "linuxstob:sr_addb_stob",
"-w", "10",
"-F",
"-c", M0_UT_PATH("conf.xc")}
#define SERVER_ENDPOINT
Definition: service_ut.c:36
#define M0_UT_CONF_PROCESS
Definition: misc.h:45
#define M0_UT_PATH(name)
Definition: misc.h:41

Definition at line 47 of file service_ut.c.

◆ iscs

struct m0_reqh_service* iscs
static

Definition at line 41 of file service_ut.c.

◆ remote_call_info

struct remote_invoke_var remote_call_info

◆ ret_codes

int ret_codes[]
static
Initial value:
=
{-ENOENT, -EINVAL, -ENOMEM, -EPROTO, -EPERM, -ENOMSG, 0}

Definition at line 123 of file service_ut.c.

◆ SERVER_LOGFILE

const char* SERVER_LOGFILE = "isc_ut.log"
static

Definition at line 46 of file service_ut.c.

◆ vis_ent

struct visitor_entry vis_ent