summaryrefslogtreecommitdiffstats
path: root/tests/fsm/fsm_test.c
diff options
context:
space:
mode:
authorStefan Sperling <ssperling@sysmocom.de>2018-02-26 19:17:02 +0100
committerHarald Welte <laforge@gnumonks.org>2018-02-26 19:00:23 +0000
commit888dc7d31aa4b39ba8e08884c39be1c09c92f82a (patch)
tree6e5b8f5aee7ce231d7890ccc1d663489cb780115 /tests/fsm/fsm_test.c
parent6950b191e84c73687f9dc77462ff66cbeaec5686 (diff)
print BIG FAT ERROR message if osmo_fsm lacks event names
Event names are displayed in VTY commands so all FSM should have them. Print an error message if an FSM is registered without event names. We could also return an error code, however at present no caller checks the return value of osmo_fsm_register() so this would be pointless. Add event names to the test FSM and update expected output accordingly. Change-Id: I08b100d62b5c50bf025ef87d31ea39072539cf37 Related: OS#3008
Diffstat (limited to 'tests/fsm/fsm_test.c')
-rw-r--r--tests/fsm/fsm_test.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/fsm/fsm_test.c b/tests/fsm/fsm_test.c
index 3bcb7d49..f70b0b5c 100644
--- a/tests/fsm/fsm_test.c
+++ b/tests/fsm/fsm_test.c
@@ -28,6 +28,12 @@ enum test_fsm_evt {
EV_B,
};
+static const struct value_string test_fsm_event_names[] = {
+ OSMO_VALUE_STRING(EV_A),
+ OSMO_VALUE_STRING(EV_B),
+ { 0, NULL }
+};
+
static void test_fsm_null(struct osmo_fsm_inst *fi, uint32_t event, void *data)
{
switch (event) {
@@ -88,6 +94,7 @@ static struct osmo_fsm fsm = {
.states = test_fsm_states,
.num_states = ARRAY_SIZE(test_fsm_states),
.log_subsys = DMAIN,
+ .event_names = test_fsm_event_names,
};
static struct ctrl_handle *g_ctrl;