Motr  M0
sss_ut.c File Reference
#include "lib/trace.h"
#include "sss/ss_fops.h"
#include "sss/process_fops.h"
#include "sss/device_fops.h"
#include "rpc/rpclib.h"
#include "lib/finject.h"
#include "ut/misc.h"
#include "ut/ut.h"
#include "motr/version.h"
Include dependency graph for sss_ut.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT
 
#define SERVER_DB_NAME   "sss_ut_server.db"
 
#define SERVER_STOB_NAME   "sss_ut_server.stob"
 
#define SERVER_ADDB_STOB_NAME   "linuxstob:sss_ut_server.addb_stob"
 
#define SERVER_LOG_NAME   "sss_ut_server.log"
 
#define SERVER_ENDPOINT_ADDR   "0@lo:12345:34:1"
 
#define SERVER_ENDPOINT   M0_NET_XPRT_PREFIX_DEFAULT":"SERVER_ENDPOINT_ADDR
 
#define CLIENT_DB_NAME   "sss_ut_client.db"
 
#define CLIENT_ENDPOINT_ADDR   "0@lo:12345:34:*"
 

Enumerations

enum  { MAX_RPCS_IN_FLIGHT = 1 }
 

Functions

static void rpc_client_and_server_start (void)
 
static void rpc_client_and_server_stop (void)
 
static struct m0_fopsss_ut_fop_alloc (const char *name, uint32_t cmd)
 
static void sss_ut_req (uint32_t cmd, int32_t expected_rc, uint32_t expected_state)
 
static int sss_ut_init (void)
 
static int sss_ut_fini (void)
 
static void sss_commands_test (void)
 
static struct m0_foput_sss_process_create_req (uint32_t cmd)
 
static void ut_sss_process_param_set (struct m0_fop *fop, const char *name)
 
static void ut_sss_process_req (struct m0_fop *fop, int ssr_rc_exptd)
 
static void sss_process_quiesce_test (void)
 
static void sss_process_reconfig_test (void)
 
static void sss_process_health_test (void)
 
static void sss_process_stop_test (void)
 
static void sss_process_commands_test (void)
 
static void sss_process_svc_list_test (void)
 
static void sss_process_lib_load_noent_test (void)
 
static void sss_process_lib_load_libc_test (void)
 
static void sss_process_lib_load_testlib_test (void)
 
static void sss_fop_ut_release (struct m0_ref *ref)
 
static void sss_process_fom_create_fail (void)
 
static void sss_device_fom_create_fail (void)
 

Variables

static const struct m0_fid ut_fid
 
static struct m0_net_domain client_net_dom
 
static char * server_argv []
 
static struct m0_rpc_server_ctx sctx
 
static struct m0_rpc_client_ctx cctx
 
const struct m0_fom_type_ops ss_process_fom_type_ops
 
struct m0_fop_type m0_fop_process_fopt
 
struct m0_ut_suite sss_ut
 

Macro Definition Documentation

◆ CLIENT_DB_NAME

#define CLIENT_DB_NAME   "sss_ut_client.db"

Definition at line 42 of file sss_ut.c.

◆ CLIENT_ENDPOINT_ADDR

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

Definition at line 43 of file sss_ut.c.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT

Definition at line 23 of file sss_ut.c.

◆ SERVER_ADDB_STOB_NAME

#define SERVER_ADDB_STOB_NAME   "linuxstob:sss_ut_server.addb_stob"

Definition at line 37 of file sss_ut.c.

◆ SERVER_DB_NAME

#define SERVER_DB_NAME   "sss_ut_server.db"

Definition at line 35 of file sss_ut.c.

◆ SERVER_ENDPOINT

#define SERVER_ENDPOINT   M0_NET_XPRT_PREFIX_DEFAULT":"SERVER_ENDPOINT_ADDR

Definition at line 40 of file sss_ut.c.

◆ SERVER_ENDPOINT_ADDR

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

Definition at line 39 of file sss_ut.c.

◆ SERVER_LOG_NAME

#define SERVER_LOG_NAME   "sss_ut_server.log"

Definition at line 38 of file sss_ut.c.

◆ SERVER_STOB_NAME

#define SERVER_STOB_NAME   "sss_ut_server.stob"

Definition at line 36 of file sss_ut.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MAX_RPCS_IN_FLIGHT 

Definition at line 45 of file sss_ut.c.

Function Documentation

◆ rpc_client_and_server_start()

static void rpc_client_and_server_start ( void  )
static

Definition at line 83 of file sss_ut.c.

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

◆ rpc_client_and_server_stop()

static void rpc_client_and_server_stop ( void  )
static

Definition at line 108 of file sss_ut.c.

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

◆ sss_commands_test()

static void sss_commands_test ( void  )
static

Definition at line 183 of file sss_ut.c.

Here is the call graph for this function:

◆ sss_device_fom_create_fail()

static void sss_device_fom_create_fail ( void  )
static

device-fom-fail

Test fail create SNS Device FOM

Definition at line 441 of file sss_ut.c.

Here is the call graph for this function:

◆ sss_fop_ut_release()

static void sss_fop_ut_release ( struct m0_ref ref)
static

Definition at line 392 of file sss_ut.c.

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

◆ sss_process_commands_test()

static void sss_process_commands_test ( void  )
static

Definition at line 299 of file sss_ut.c.

Here is the call graph for this function:

◆ sss_process_fom_create_fail()

static void sss_process_fom_create_fail ( void  )
static

Definition at line 399 of file sss_ut.c.

Here is the call graph for this function:

◆ sss_process_health_test()

static void sss_process_health_test ( void  )
static

Definition at line 282 of file sss_ut.c.

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

◆ sss_process_lib_load_libc_test()

static void sss_process_lib_load_libc_test ( void  )
static

Definition at line 342 of file sss_ut.c.

Here is the call graph for this function:

◆ sss_process_lib_load_noent_test()

static void sss_process_lib_load_noent_test ( void  )
static

Definition at line 333 of file sss_ut.c.

Here is the call graph for this function:

◆ sss_process_lib_load_testlib_test()

static void sss_process_lib_load_testlib_test ( void  )
static

Tests library loading request processing.

Loads libtestlib.so library. The "motr_lib_init()" function in this library (sss/ut/testlib.c) is invoked and enables a specific failure injection point, checked by this test.

Definition at line 358 of file sss_ut.c.

Here is the call graph for this function:

◆ sss_process_quiesce_test()

static void sss_process_quiesce_test ( void  )
static

Definition at line 265 of file sss_ut.c.

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

◆ sss_process_reconfig_test()

static void sss_process_reconfig_test ( void  )
static

Definition at line 273 of file sss_ut.c.

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

◆ sss_process_stop_test()

static void sss_process_stop_test ( void  )
static

Definition at line 290 of file sss_ut.c.

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

◆ sss_process_svc_list_test()

static void sss_process_svc_list_test ( void  )
static

Definition at line 307 of file sss_ut.c.

Here is the call graph for this function:

◆ sss_ut_fini()

static int sss_ut_fini ( void  )
static

Definition at line 175 of file sss_ut.c.

Here is the call graph for this function:

◆ sss_ut_fop_alloc()

static struct m0_fop* sss_ut_fop_alloc ( const char *  name,
uint32_t  cmd 
)
static

Definition at line 120 of file sss_ut.c.

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

◆ sss_ut_init()

static int sss_ut_init ( void  )
static

Definition at line 167 of file sss_ut.c.

Here is the call graph for this function:

◆ sss_ut_req()

static void sss_ut_req ( uint32_t  cmd,
int32_t  expected_rc,
uint32_t  expected_state 
)
static

Definition at line 140 of file sss_ut.c.

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

◆ ut_sss_process_create_req()

static struct m0_fop* ut_sss_process_create_req ( uint32_t  cmd)
static

Definition at line 212 of file sss_ut.c.

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

◆ ut_sss_process_param_set()

static void ut_sss_process_param_set ( struct m0_fop fop,
const char *  name 
)
static

Definition at line 232 of file sss_ut.c.

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

◆ ut_sss_process_req()

static void ut_sss_process_req ( struct m0_fop fop,
int  ssr_rc_exptd 
)
static

Processes commands test

Definition at line 245 of file sss_ut.c.

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

Variable Documentation

◆ cctx

struct m0_rpc_client_ctx cctx
static
Initial value:
= {
.rcx_net_dom = &client_net_dom,
.rcx_local_addr = CLIENT_ENDPOINT_ADDR,
.rcx_remote_addr = SERVER_ENDPOINT_ADDR,
.rcx_max_rpcs_in_flight = MAX_RPCS_IN_FLIGHT,
.rcx_fid = &g_process_fid,
}
#define CLIENT_ENDPOINT_ADDR
Definition: sss_ut.c:43
static struct m0_net_domain client_net_dom
Definition: sss_ut.c:54
#define SERVER_ENDPOINT_ADDR
Definition: sss_ut.c:39
struct m0_fid g_process_fid
Definition: ut.c:689

Definition at line 72 of file sss_ut.c.

◆ client_net_dom

struct m0_net_domain client_net_dom
static

Definition at line 54 of file sss_ut.c.

◆ sctx

struct m0_rpc_server_ctx sctx
static
Initial value:
= {
.rsx_xprts = NULL,
.rsx_xprts_nr = 1,
.rsx_argv = server_argv,
.rsx_argc = ARRAY_SIZE(server_argv),
.rsx_log_file_name = SERVER_LOG_NAME,
}
#define NULL
Definition: misc.h:38
static char * server_argv[]
Definition: sss_ut.c:56
#define SERVER_LOG_NAME
Definition: sss_ut.c:38
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 64 of file sss_ut.c.

◆ server_argv

char* server_argv[]
static
Initial value:
= {
"sss_ut", "-T", "AD", "-D", SERVER_DB_NAME,
"-e", SERVER_ENDPOINT, "-H", SERVER_ENDPOINT_ADDR, "-w", "10",
"-c", M0_UT_PATH("conf.xc")
}
#define SERVER_ENDPOINT
Definition: sss_ut.c:40
#define SERVER_ADDB_STOB_NAME
Definition: sss_ut.c:37
#define SERVER_DB_NAME
Definition: sss_ut.c:35
#define SERVER_STOB_NAME
Definition: sss_ut.c:36
#define SERVER_ENDPOINT_ADDR
Definition: sss_ut.c:39
#define M0_UT_CONF_PROCESS
Definition: misc.h:45
#define M0_UT_PATH(name)
Definition: misc.h:41

Definition at line 56 of file sss_ut.c.

◆ ss_process_fom_type_ops

const struct m0_fom_type_ops ss_process_fom_type_ops

Definition at line 87 of file process_foms.c.

◆ sss_ut

struct m0_ut_suite sss_ut
Initial value:
= {
.ts_name = "sss-ut",
.ts_init = sss_ut_init,
.ts_fini = sss_ut_fini,
.ts_tests = {
{ "commands", sss_commands_test },
{ "process-commands", sss_process_commands_test },
{ "process-services-list", sss_process_svc_list_test },
{ "process-fom-create-fail", sss_process_fom_create_fail },
{ "device-fom-fail", sss_device_fom_create_fail },
{ "lib-load-noent", sss_process_lib_load_noent_test },
{ "lib-load-libc", sss_process_lib_load_libc_test },
{ NULL, NULL },
},
}
static int sss_ut_fini(void)
Definition: sss_ut.c:175
#define NULL
Definition: misc.h:38
static void sss_process_svc_list_test(void)
Definition: sss_ut.c:307
static void sss_device_fom_create_fail(void)
Definition: sss_ut.c:441
static void sss_process_lib_load_noent_test(void)
Definition: sss_ut.c:333
static void sss_commands_test(void)
Definition: sss_ut.c:183
static void sss_process_lib_load_libc_test(void)
Definition: sss_ut.c:342
static void sss_process_fom_create_fail(void)
Definition: sss_ut.c:399
static int sss_ut_init(void)
Definition: sss_ut.c:167
static void sss_process_commands_test(void)
Definition: sss_ut.c:299
static void sss_process_lib_load_testlib_test(void)
Definition: sss_ut.c:358

Definition at line 473 of file sss_ut.c.

◆ ut_fid

const struct m0_fid ut_fid
static
Initial value:
= {
.f_container = 0x7300000000000001,
.f_key = 10
}

Definition at line 49 of file sss_ut.c.