Go to the source code of this file.
|
M0_INTERNAL void | ut_realm_entity_setup (struct m0_realm *realm, struct m0_entity *ent, struct m0_client *cinst) |
|
static bool | ut_test_floor_tick_cb (struct m0_clink *cl) |
|
static void | ut_test_m0_client_init_floor_tick (struct m0_client *instance, int start_state, int stop_state) |
|
static void | ut_test_m0_client_init_floors (struct m0_client *instance, int limit, bool fail) |
|
static void | ut_test_m0_client_init (void) |
|
M0_INTERNAL int | ut_m0_client_init (struct m0_client **instance) |
|
M0_INTERNAL void | ut_test_m0_client_fini (void) |
|
M0_INTERNAL void | ut_m0_client_fini (struct m0_client **instance) |
|
static void | ut_test_entity_invariant_locked (void) |
|
static void | ut_test_m0_entity_init (void) |
|
static void | ut_test_m0_obj_init (void) |
|
static void | ut_launch_cb_pass (struct m0_op_common *oc) |
|
static void | ut_launch_cb_fail (struct m0_op_common *oc) |
|
static void | ut_init_fake_op (struct m0_op_common *cop, struct m0_entity *ent, void(*cb)(struct m0_op_common *oc)) |
|
static void | ut_test_m0_op_launch_one (void) |
|
static void | ut_test_m0_op_launch (void) |
|
static void | ut_test_op_sm_callme (struct m0_op *op) |
|
static void | ut_test_op_sm_dont_callme (struct m0_op *op) |
|
static void | ut_test_op_sm_cbs_helper (struct m0_op_ops *cbs, int executed, int stable, int failed) |
|
static void | ut_test_op_sm (void) |
|
unsigned long | ut_test_m0_op_wait_timer (unsigned long data) |
|
void | ut_test_m0_op_wait (void) |
|
static void | ut_test_m0_op_alloc (void) |
|
static void | ut_test_m0_op_init (void) |
|
static void | ut_test_m0_entity_fini (void) |
|
static void | ut_test_m0_obj_fini (void) |
|
static void | ut_m0_op_fini_cb (struct m0_op_common *oc) |
|
static void | ut_test_m0_op_fini (void) |
|
static void | ut_test_m0_op_free (void) |
|
static void | ut_test_m0_op_setup (void) |
|
static void | ut_test_m0_op_kick (void) |
|
int | rand (void) |
|
M0_INTERNAL void | ut_shuffle_test_order (struct m0_ut_suite *suite) |
|
M0_INTERNAL int | ut_init (void) |
|
M0_INTERNAL int | ut_fini (void) |
|
◆ M0_TRACE_SUBSYSTEM
#define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CLIENT |
◆ rand()
◆ ut_fini()
M0_INTERNAL int ut_fini |
( |
void |
| ) |
|
Finalises the client UT environment.
Definition at line 1257 of file client.c.
◆ ut_init()
M0_INTERNAL int ut_init |
( |
void |
| ) |
|
Initialises the client UT environment.
Definition at line 1245 of file client.c.
◆ ut_init_fake_op()
Initialises an operation for use as a fake-operation.
Definition at line 531 of file client.c.
◆ ut_launch_cb_fail()
Callback for fake-operation launch, increments a local counter, and moves the state machine along. Called with the m0_sm_group lock held.
Definition at line 519 of file client.c.
◆ ut_launch_cb_pass()
Callback for fake-operation launch, increments a local counter, and moves the state machine along. Called with the m0_sm_group lock held.
Definition at line 503 of file client.c.
◆ ut_m0_client_fini()
M0_INTERNAL void ut_m0_client_fini |
( |
struct m0_client ** |
instance | ) |
|
A version of m0_client_fini for use in unit tests. This will finalise whatever was done in ut_m0_client_init.
- Parameters
-
instance | A pointer to where the instance should be stored. |
Definition at line 354 of file client.c.
◆ ut_m0_client_init()
M0_INTERNAL int ut_m0_client_init |
( |
struct m0_client ** |
instance | ) |
|
A version of m0_client_init for use in unit tests. This will initialise client as far as we can in this environment.
- Parameters
-
instance | A pointer to where the instance should be stored. |
- Returns
- The value of m0_client_init.
Definition at line 265 of file client.c.
◆ ut_m0_op_fini_cb()
Callback for op_fini, used for unit tests to check the callback is occuring.
- Parameters
-
oc | the common operation that has been finished. |
Definition at line 1012 of file client.c.
◆ ut_realm_entity_setup()
Fake setup for a realm and entity.
Definition at line 60 of file client.c.
◆ ut_shuffle_test_order()
M0_INTERNAL void ut_shuffle_test_order |
( |
struct m0_ut_suite * |
suite | ) |
|
A trick to force the UTs to run in random order every time. This allows the tester to discover hidden dependencies among tests (bonus score!).
Definition at line 1205 of file client.c.
◆ ut_test_entity_invariant_locked()
static void ut_test_entity_invariant_locked |
( |
void |
| ) |
|
|
static |
◆ ut_test_floor_tick_cb()
static bool ut_test_floor_tick_cb |
( |
struct m0_clink * |
cl | ) |
|
|
static |
◆ ut_test_m0_client_fini()
M0_INTERNAL void ut_test_m0_client_fini |
( |
void |
| ) |
|
Unit tests m0_client_fini.
Definition at line 330 of file client.c.
◆ ut_test_m0_client_init()
static void ut_test_m0_client_init |
( |
void |
| ) |
|
|
static |
Partial Unit tests m0_client_init.
Unit tests uses fault injections to make initlift_get_next_floor be a no-op, so that they can manually move the 'initlift' between floors to test cleanup/failures etc. In a real environment, the 'initlift' would be moved through all the states to IL_INITIALISED by 'm0_client_init()'.
It isn't possible to test connecting to services and confd etc from here.
Definition at line 211 of file client.c.
◆ ut_test_m0_client_init_floor_tick()
static void ut_test_m0_client_init_floor_tick |
( |
struct m0_client * |
instance, |
|
|
int |
start_state, |
|
|
int |
stop_state |
|
) |
| |
|
static |
Make an arbitrary move between 'floors' of the client init state machine. Makes various asserts about sane behaviour.
- Parameters
-
instance | The client instance we are working with. |
start_state | The state we believe we are in. |
stop_state | The state we would like to be in. |
Definition at line 94 of file client.c.
◆ ut_test_m0_client_init_floors()
static void ut_test_m0_client_init_floors |
( |
struct m0_client * |
instance, |
|
|
int |
limit, |
|
|
bool |
fail |
|
) |
| |
|
static |
Move the client init state machine from the IL_UNINITIALISED state to the specified state, then back again, optionally due to a failure.
- Parameters
-
instance | The client instance we are working with. |
limit | The maximum 'floor' to reach. |
fail | Whether a simulated failure causes us to return to IL_UNINITIALISED |
Definition at line 136 of file client.c.
◆ ut_test_m0_entity_fini()
static void ut_test_m0_entity_fini |
( |
void |
| ) |
|
|
static |
◆ ut_test_m0_entity_init()
static void ut_test_m0_entity_init |
( |
void |
| ) |
|
|
static |
Tests the pre and post conditions of the m0_entity_init() helper function. The testee is seen as a black box that has to react as expected to some specific input and generate some valid output.
Definition at line 434 of file client.c.
◆ ut_test_m0_obj_fini()
static void ut_test_m0_obj_fini |
( |
void |
| ) |
|
|
static |
◆ ut_test_m0_obj_init()
static void ut_test_m0_obj_init |
( |
void |
| ) |
|
|
static |
Tests the pre and post conditions of the m0_obj_init() entry point. Also checks the object is correctly initialised. The testee is seen as a black box that has to react as expected to some specific input and generate some valid output.
Definition at line 465 of file client.c.
◆ ut_test_m0_op_alloc()
static void ut_test_m0_op_alloc |
( |
void |
| ) |
|
|
static |
Tests m0_op_alloc(), focusing on its pre-conditions. Also checks the output is right when function succeeds.
Definition at line 882 of file client.c.
◆ ut_test_m0_op_fini()
static void ut_test_m0_op_fini |
( |
void |
| ) |
|
|
static |
Tests the pre and post conditions of the m0_op_fini() entry point. Tests the optional callback is called if specified, and the state machine is set to UNINITIALISED.
Definition at line 1023 of file client.c.
◆ ut_test_m0_op_free()
static void ut_test_m0_op_free |
( |
void |
| ) |
|
|
static |
Tests memory allocated by op_init/op_alloc can only be freed in the appropriate circumstances.
Definition at line 1067 of file client.c.
◆ ut_test_m0_op_init()
static void ut_test_m0_op_init |
( |
void |
| ) |
|
|
static |
◆ ut_test_m0_op_kick()
static void ut_test_m0_op_kick |
( |
void |
| ) |
|
|
static |
Tests an operation can be kicked without any side effects.
Definition at line 1121 of file client.c.
◆ ut_test_m0_op_launch()
static void ut_test_m0_op_launch |
( |
void |
| ) |
|
|
static |
Unit tests m0_op_launch.
Definition at line 578 of file client.c.
◆ ut_test_m0_op_launch_one()
static void ut_test_m0_op_launch_one |
( |
void |
| ) |
|
|
static |
◆ ut_test_m0_op_setup()
static void ut_test_m0_op_setup |
( |
void |
| ) |
|
|
static |
Tests setting up an operation.
Definition at line 1092 of file client.c.
◆ ut_test_m0_op_wait()
void ut_test_m0_op_wait |
( |
void |
| ) |
|
◆ ut_test_m0_op_wait_timer()
unsigned long ut_test_m0_op_wait_timer |
( |
unsigned long |
data | ) |
|
Callback for the op_wait timer. Moves the provided operation state machine into the EXECUTED state.
- Parameters
-
data | the operation to move, as an ugly integer. |
Definition at line 768 of file client.c.
◆ ut_test_op_sm()
static void ut_test_op_sm |
( |
void |
| ) |
|
|
static |
Tests the operation state machine by moving it through all valid transitions. Also checks the optional callback mechanism works as expected.
Definition at line 671 of file client.c.
◆ ut_test_op_sm_callme()
static void ut_test_op_sm_callme |
( |
struct m0_op * |
op | ) |
|
|
static |
An ops callback that increments a counter, used to check the callbacks were correctly called.
Definition at line 625 of file client.c.
◆ ut_test_op_sm_cbs_helper()
static void ut_test_op_sm_cbs_helper |
( |
struct m0_op_ops * |
cbs, |
|
|
int |
executed, |
|
|
int |
stable, |
|
|
int |
failed |
|
) |
| |
|
static |
Helper method for setting many op_ops values in a one-liner.
- Parameters
-
ops | the ops structure to pack. |
executed | whether the execute callback should assert immediately. |
stable | whether the stable callback should assert immediately. |
failed | whether the failed callback should assert immediately. |
Definition at line 647 of file client.c.
◆ ut_test_op_sm_dont_callme()
static void ut_test_op_sm_dont_callme |
( |
struct m0_op * |
op | ) |
|
|
static |
An ops callback that asserts immediatly. Don't call me - its a trap.
Definition at line 634 of file client.c.
◆ default_config
◆ ut_launch_cb_fail_count
uint32_t ut_launch_cb_fail_count |
|
static |
◆ ut_launch_cb_pass_count
uint32_t ut_launch_cb_pass_count |
|
static |
Counter for op_launch callback.
Definition at line 45 of file client.c.
◆ ut_m0_op_fini_cb_count
uint32_t ut_m0_op_fini_cb_count |
|
static |
Counter for op_fini callbacks.
Definition at line 49 of file client.c.
◆ ut_suite
◆ ut_test_initlift_gnf_counter
int ut_test_initlift_gnf_counter |
|
static |
Counter for initlift get next floor callbacks.
Definition at line 55 of file client.c.
◆ ut_test_op_sm_callme_counter
int ut_test_op_sm_callme_counter |
|
static |
Counter for op_sm callbacks.
Definition at line 52 of file client.c.