summaryrefslogtreecommitdiffstats
path: root/tests/fsm/fsm_test.err
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-04-09 00:42:12 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2018-04-09 17:57:15 +0200
commit975ee6bd44ca18c82ecf5aea91c361baf248a0ff (patch)
tree26b1a4f94baeee8f06d41ac0f599a6d553709119 /tests/fsm/fsm_test.err
parent2bcc873e93be0554694ade1f2ee6ef0ac8011d05 (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.err44
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
Test_FSM(my_id){TWO}: Timeout of T2342
Timer
Test_FSM(my_id){TWO}: Deallocated
+
+--- test_id_api()
+Test_FSM{NULL}: Allocated
+ 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 ''
+ 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'
+ 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)
+Test_FSM(arbitrary_id){NULL}: Freeing instance
+Test_FSM(arbitrary_id){NULL}: Deallocated
 \ No newline at end of file