diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2018-04-09 00:42:12 +0200 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2018-04-09 17:57:15 +0200 |
commit | 975ee6bd44ca18c82ecf5aea91c361baf248a0ff (patch) | |
tree | 26b1a4f94baeee8f06d41ac0f599a6d553709119 /tests/fsm/fsm_test.err | |
parent | 2bcc873e93be0554694ade1f2ee6ef0ac8011d05 (diff) |
fsm_test: more thoroughly test FSM inst ids and names
Place id and name testing in its separate section, test_id_api().
Add a test that actually allocates an FSM instance with a NULL id, which is
allowed, but uncovers a bug of an unset FSM instance name. osmo_fsm_inst_name()
falls back to the fsm struct's name on NULL, but osmo_fsm_inst_find_by_name()
fails to match if the instance's name is NULL (and until recently even
crashed). Show this in fsm_test.c with loud comments.
Add test to clear the id by passing NULL.
Add test for setting an empty id.
Add test for setting an invalid identifier (osmo_identifier_valid() == false).
Change-Id: I646ed918576ce196c395dc5f42a1507c52ace2c5
Diffstat (limited to 'tests/fsm/fsm_test.err')
-rw-r--r-- | tests/fsm/fsm_test.err | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/fsm/fsm_test.err b/tests/fsm/fsm_test.err index facc9f78..bc159bda 100644 --- a/tests/fsm/fsm_test.err +++ b/tests/fsm/fsm_test.err @@ -9,4 +9,48 @@ Checking FSM allocation [0;mTest_FSM(my_id){TWO}: Timeout of T2342 [0;mTimer [0;mTest_FSM(my_id){TWO}: Deallocated +[0;m +--- test_id_api() +Test_FSM{NULL}: Allocated +[0;m osmo_fsm_inst_name() == "Test_FSM" + osmo_fsm_inst_find_by_name("Test_FSM") == NULL +osmo_fsm_inst_update_id("my_id") + rc == 0, ok + osmo_fsm_inst_name() == "Test_FSM(my_id)" + osmo_fsm_inst_find_by_name("Test_FSM(my_id)") == fi + osmo_fsm_inst_find_by_id("my_id") == fi +osmo_fsm_inst_update_id("another_id") + rc == 0, ok + osmo_fsm_inst_name() == "Test_FSM(another_id)" + osmo_fsm_inst_find_by_name("Test_FSM(another_id)") == fi + osmo_fsm_inst_find_by_id("another_id") == fi +osmo_fsm_inst_update_id(NULL) + rc == 0, ok + osmo_fsm_inst_name() == "Test_FSM" + osmo_fsm_inst_find_by_name("Test_FSM") == fi +osmo_fsm_inst_update_id(NULL) + rc == 0, ok + osmo_fsm_inst_name() == "Test_FSM" + osmo_fsm_inst_find_by_name("Test_FSM") == fi +osmo_fsm_inst_update_id("arbitrary_id") + rc == 0, ok + osmo_fsm_inst_name() == "Test_FSM(arbitrary_id)" + osmo_fsm_inst_find_by_name("Test_FSM(arbitrary_id)") == fi + osmo_fsm_inst_find_by_id("arbitrary_id") == fi +osmo_fsm_inst_update_id("") +Attempting to allocate FSM instance of type 'Test_FSM' with illegal identifier '' +[0;m rc == -22, ok + osmo_fsm_inst_name() == "Test_FSM(arbitrary_id)" + osmo_fsm_inst_find_by_name("Test_FSM(arbitrary_id)") == fi +osmo_fsm_inst_update_id("invalid.id") +Attempting to allocate FSM instance of type 'Test_FSM' with illegal identifier 'invalid.id' +[0;m rc == -22, ok + osmo_fsm_inst_name() == "Test_FSM(arbitrary_id)" + osmo_fsm_inst_find_by_name("Test_FSM(arbitrary_id)") == fi + +--- test_id_api() done + +Test_FSM(arbitrary_id){NULL}: Terminating (cause = OSMO_FSM_TERM_REQUEST) +[0;mTest_FSM(arbitrary_id){NULL}: Freeing instance +[0;mTest_FSM(arbitrary_id){NULL}: Deallocated [0;m
\ No newline at end of file |