Motr  M0
fom_timedwait_ut.c File Reference
#include "lib/errno.h"
#include "lib/memory.h"
#include "lib/semaphore.h"
#include "lib/finject.h"
#include "rpc/rpc_opcodes.h"
#include "fop/fom.h"
#include "reqh/reqh.h"
#include "reqh/reqh_service.h"
#include "ut/ut.h"
Include dependency graph for fom_timedwait_ut.c:

Go to the source code of this file.

Data Structures

struct  tw_fom
 

Enumerations

enum  tw_test {
  TW_TEST_IMMED_SUCCESS, TW_TEST_DELAYED_SUCCESS, TW_TEST_IMMED_TIMEOUT, TW_TEST_DELAYED_TIMEOUT,
  TW_TEST_IMMED_UNREACHABLE, TW_TEST_DELAYED_UNREACHABLE
}
 
enum  tw_fom_phase { INIT = M0_FOM_PHASE_INIT, FINISH = M0_FOM_PHASE_FINISH, PHASE1 = M0_FOM_PHASE_NR, PHASE2 }
 

Functions

static void tw_fom_fini (struct m0_fom *fom)
 
static int tw_fom_tick (struct m0_fom *fom)
 
static size_t tw_fom_home_locality (const struct m0_fom *fom)
 
static int twsvc_start (struct m0_reqh_service *svc)
 
static void twsvc_stop (struct m0_reqh_service *svc)
 
static void twsvc_fini (struct m0_reqh_service *svc)
 
static int twsvc_type_allocate (struct m0_reqh_service **svc, const struct m0_reqh_service_type *stype)
 
static void wakeup (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static void fom_reschedule (struct tw_fom *fom)
 
static void tw_fom_create (struct m0_fom **out, struct m0_reqh *reqh, enum tw_test test)
 
static void tw_fom_destroy (struct tw_fom *fom)
 
static void tw_fom_start (struct m0_fom *fom)
 
static void tw_fom_timeout_signal (struct m0_fom *fom)
 
static void reqh_init (void)
 
static void reqh_start (void)
 
static void reqh_stop (void)
 
static void reqh_fini (void)
 
static struct m0_fomtw_init (enum tw_test test)
 
static void tw_fini (struct m0_fom *fom0)
 
static void immediate_success (void)
 
static void delayed_success (void)
 
static void immediate_timeout (void)
 
static void delayed_timeout (void)
 
static void immediate_unreachable (void)
 
static void delayed_unreachable (void)
 
int tw_test_suite_init (void)
 

Variables

static struct m0_sm_state_descr tw_fom_phases []
 
static struct m0_sm_conf tw_sm_conf
 
static struct m0_fom_type tw_fomt
 
static struct m0_reqh twreqh
 
static struct m0_reqh_servicetwsvc
 
static const struct m0_fom_ops tw_fom_ops
 
const struct m0_fom_type_ops tw_fom_type_ops
 
static const struct m0_reqh_service_ops twsvc_ops
 
static const struct m0_reqh_service_type_ops twsvc_type_ops
 
static struct m0_reqh_service_type ut_tw_service_type
 
struct m0_ut_suite fom_timedwait_ut
 

Enumeration Type Documentation

◆ tw_fom_phase

Enumerator
INIT 
FINISH 
PHASE1 
PHASE2 

Definition at line 52 of file fom_timedwait_ut.c.

◆ tw_test

enum tw_test
Enumerator
TW_TEST_IMMED_SUCCESS 
TW_TEST_DELAYED_SUCCESS 
TW_TEST_IMMED_TIMEOUT 
TW_TEST_DELAYED_TIMEOUT 
TW_TEST_IMMED_UNREACHABLE 
TW_TEST_DELAYED_UNREACHABLE 

Definition at line 33 of file fom_timedwait_ut.c.

Function Documentation

◆ delayed_success()

static void delayed_success ( void  )
static

Definition at line 378 of file fom_timedwait_ut.c.

Here is the call graph for this function:

◆ delayed_timeout()

static void delayed_timeout ( void  )
static

Definition at line 401 of file fom_timedwait_ut.c.

Here is the call graph for this function:

◆ delayed_unreachable()

static void delayed_unreachable ( void  )
static

Definition at line 425 of file fom_timedwait_ut.c.

Here is the call graph for this function:

◆ fom_reschedule()

static void fom_reschedule ( struct tw_fom fom)
static

Definition at line 169 of file fom_timedwait_ut.c.

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

◆ immediate_success()

static void immediate_success ( void  )
static

Definition at line 365 of file fom_timedwait_ut.c.

Here is the call graph for this function:

◆ immediate_timeout()

static void immediate_timeout ( void  )
static

Definition at line 389 of file fom_timedwait_ut.c.

Here is the call graph for this function:

◆ immediate_unreachable()

static void immediate_unreachable ( void  )
static

Definition at line 414 of file fom_timedwait_ut.c.

Here is the call graph for this function:

◆ reqh_fini()

static void reqh_fini ( void  )
static

Definition at line 329 of file fom_timedwait_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 299 of file fom_timedwait_ut.c.

Here is the caller graph for this function:

◆ reqh_start()

static void reqh_start ( void  )
static

Definition at line 310 of file fom_timedwait_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 321 of file fom_timedwait_ut.c.

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

◆ tw_fini()

static void tw_fini ( struct m0_fom fom0)
static

Definition at line 350 of file fom_timedwait_ut.c.

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

◆ tw_fom_create()

static void tw_fom_create ( struct m0_fom **  out,
struct m0_reqh reqh,
enum tw_test  test 
)
static

Definition at line 241 of file fom_timedwait_ut.c.

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

◆ tw_fom_destroy()

static void tw_fom_destroy ( struct tw_fom fom)
static

Definition at line 261 of file fom_timedwait_ut.c.

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

◆ tw_fom_fini()

static void tw_fom_fini ( struct m0_fom fom)
static

Definition at line 270 of file fom_timedwait_ut.c.

Here is the call graph for this function:

◆ tw_fom_home_locality()

static size_t tw_fom_home_locality ( const struct m0_fom fom)
static

Definition at line 158 of file fom_timedwait_ut.c.

◆ tw_fom_start()

static void tw_fom_start ( struct m0_fom fom)
static

Definition at line 279 of file fom_timedwait_ut.c.

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

◆ tw_fom_tick()

static int tw_fom_tick ( struct m0_fom fom)
static

Definition at line 178 of file fom_timedwait_ut.c.

Here is the call graph for this function:

◆ tw_fom_timeout_signal()

static void tw_fom_timeout_signal ( struct m0_fom fom)
static

Definition at line 288 of file fom_timedwait_ut.c.

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

◆ tw_init()

static struct m0_fom* tw_init ( enum tw_test  test)
static

Definition at line 339 of file fom_timedwait_ut.c.

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

◆ tw_test_suite_init()

int tw_test_suite_init ( void  )

Definition at line 436 of file fom_timedwait_ut.c.

Here is the call graph for this function:

◆ twsvc_fini()

static void twsvc_fini ( struct m0_reqh_service svc)
static

Definition at line 128 of file fom_timedwait_ut.c.

Here is the call graph for this function:

◆ twsvc_start()

static int twsvc_start ( struct m0_reqh_service svc)
static

Definition at line 119 of file fom_timedwait_ut.c.

◆ twsvc_stop()

static void twsvc_stop ( struct m0_reqh_service svc)
static

Definition at line 124 of file fom_timedwait_ut.c.

◆ twsvc_type_allocate()

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

Definition at line 133 of file fom_timedwait_ut.c.

◆ wakeup()

static void wakeup ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)
static

Definition at line 163 of file fom_timedwait_ut.c.

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

Variable Documentation

◆ fom_timedwait_ut

struct m0_ut_suite fom_timedwait_ut
Initial value:
= {
.ts_name = "fom-timedwait-ut",
.ts_init = tw_test_suite_init,
.ts_fini = NULL,
.ts_tests = {
{ "immediate-success", immediate_success },
{ "delayed-success", delayed_success },
{ "immediate-timeout", immediate_timeout },
{ "delayed-timeout", delayed_timeout },
{ "immediate-unreachable", immediate_unreachable },
{ "delayed-unreachable", delayed_unreachable },
{ NULL, NULL }
}
}
static void delayed_unreachable(void)
#define NULL
Definition: misc.h:38
static void delayed_success(void)
static void immediate_success(void)
static void delayed_timeout(void)
int tw_test_suite_init(void)
static void immediate_timeout(void)
static void immediate_unreachable(void)

Definition at line 444 of file fom_timedwait_ut.c.

◆ tw_fom_ops

const struct m0_fom_ops tw_fom_ops
static
Initial value:
= {
.fo_fini = tw_fom_fini,
.fo_tick = tw_fom_tick,
.fo_home_locality = tw_fom_home_locality
}
static int tw_fom_tick(struct m0_fom *fom)
static size_t tw_fom_home_locality(const struct m0_fom *fom)
static void tw_fom_fini(struct m0_fom *fom)

Definition at line 94 of file fom_timedwait_ut.c.

◆ tw_fom_phases

struct m0_sm_state_descr tw_fom_phases[]
static
Initial value:
= {
[INIT] = {
.sd_flags = M0_SDF_INITIAL,
.sd_name = "init",
.sd_allowed = M0_BITS(PHASE1, PHASE2)
},
[PHASE1] = {
.sd_name = "phase1",
.sd_allowed = M0_BITS(PHASE2)
},
[PHASE2] = {
.sd_name = "phase2",
.sd_allowed = M0_BITS(FINISH)
},
[FINISH] = {
.sd_name = "finish",
.sd_flags = M0_SDF_TERMINAL,
}
}
#define M0_BITS(...)
Definition: misc.h:236

Definition at line 59 of file fom_timedwait_ut.c.

◆ tw_fom_type_ops

const struct m0_fom_type_ops tw_fom_type_ops
Initial value:
= {
.fto_create = NULL
}
#define NULL
Definition: misc.h:38

Definition at line 100 of file fom_timedwait_ut.c.

◆ tw_fomt

struct m0_fom_type tw_fomt
static

Definition at line 85 of file fom_timedwait_ut.c.

◆ tw_sm_conf

struct m0_sm_conf tw_sm_conf
static
Initial value:
= {
.scf_name = "tw_fom",
.scf_nr_states = ARRAY_SIZE(tw_fom_phases),
.scf_state = tw_fom_phases,
}
static struct m0_sm_state_descr tw_fom_phases[]
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 79 of file fom_timedwait_ut.c.

◆ twreqh

struct m0_reqh twreqh
static

Definition at line 87 of file fom_timedwait_ut.c.

◆ twsvc

struct m0_reqh_service* twsvc
static

Definition at line 88 of file fom_timedwait_ut.c.

◆ twsvc_ops

const struct m0_reqh_service_ops twsvc_ops
static
Initial value:
= {
.rso_start = &twsvc_start,
.rso_stop = &twsvc_stop,
.rso_fini = &twsvc_fini
}
static void twsvc_fini(struct m0_reqh_service *svc)
int m0_reqh_service_async_start_simple(struct m0_reqh_service_start_async_ctx *asc)
Definition: reqh_service.c:601
static int twsvc_start(struct m0_reqh_service *svc)
static void twsvc_stop(struct m0_reqh_service *svc)

Definition at line 112 of file fom_timedwait_ut.c.

◆ twsvc_type_ops

const struct m0_reqh_service_type_ops twsvc_type_ops
static
Initial value:
= {
.rsto_service_allocate = &twsvc_type_allocate
}
static int twsvc_type_allocate(struct m0_reqh_service **svc, const struct m0_reqh_service_type *stype)

Definition at line 143 of file fom_timedwait_ut.c.

◆ ut_tw_service_type

struct m0_reqh_service_type ut_tw_service_type
static
Initial value:
= {
.rst_name = "tw_ut",
.rst_ops = &twsvc_type_ops,
.rst_level = M0_RS_LEVEL_NORMAL,
.rst_typecode = M0_CST_DS1
}
static const struct m0_reqh_service_type_ops twsvc_type_ops

Definition at line 147 of file fom_timedwait_ut.c.