blob: bf474abad8509cca4bce9502cf4e0be7ae456024 [file] [log] [blame]
Harald Welte136e7372016-05-29 10:53:17 +09001Checking FSM allocation
Harald Welte31c0fef2017-04-16 17:26:30 +02002Test_FSM(my_id){NULL}: Allocated
Stefan Sperling888dc7d2018-02-26 19:17:02 +01003Test_FSM(my_id){NULL}: Received Event EV_B
4Test_FSM(my_id){NULL}: Event EV_B not permitted
5Test_FSM(my_id){NULL}: Received Event EV_A
Harald Welte31c0fef2017-04-16 17:26:30 +02006Test_FSM(my_id){NULL}: state_chg to ONE
Stefan Sperling888dc7d2018-02-26 19:17:02 +01007Test_FSM(my_id){ONE}: Received Event EV_B
Harald Welte31c0fef2017-04-16 17:26:30 +02008Test_FSM(my_id){ONE}: state_chg to TWO
9Test_FSM(my_id){TWO}: Timeout of T2342
Harald Welte136e7372016-05-29 10:53:17 +090010Timer
Neels Hofmeyrd8f175c2018-04-09 00:42:22 +020011Test_FSM(my_id){TWO}: Deallocated
Neels Hofmeyr975ee6b2018-04-09 00:42:12 +020012
13--- test_id_api()
14Test_FSM{NULL}: Allocated
15 osmo_fsm_inst_name() == "Test_FSM"
Neels Hofmeyr71f76a12018-03-31 16:30:25 +020016 osmo_fsm_inst_find_by_name("Test_FSM") == fi
Neels Hofmeyr975ee6b2018-04-09 00:42:12 +020017osmo_fsm_inst_update_id("my_id")
18 rc == 0, ok
19 osmo_fsm_inst_name() == "Test_FSM(my_id)"
20 osmo_fsm_inst_find_by_name("Test_FSM(my_id)") == fi
21 osmo_fsm_inst_find_by_id("my_id") == fi
22osmo_fsm_inst_update_id("another_id")
23 rc == 0, ok
24 osmo_fsm_inst_name() == "Test_FSM(another_id)"
25 osmo_fsm_inst_find_by_name("Test_FSM(another_id)") == fi
26 osmo_fsm_inst_find_by_id("another_id") == fi
27osmo_fsm_inst_update_id(NULL)
28 rc == 0, ok
29 osmo_fsm_inst_name() == "Test_FSM"
30 osmo_fsm_inst_find_by_name("Test_FSM") == fi
31osmo_fsm_inst_update_id(NULL)
32 rc == 0, ok
33 osmo_fsm_inst_name() == "Test_FSM"
34 osmo_fsm_inst_find_by_name("Test_FSM") == fi
35osmo_fsm_inst_update_id("arbitrary_id")
36 rc == 0, ok
37 osmo_fsm_inst_name() == "Test_FSM(arbitrary_id)"
38 osmo_fsm_inst_find_by_name("Test_FSM(arbitrary_id)") == fi
39 osmo_fsm_inst_find_by_id("arbitrary_id") == fi
40osmo_fsm_inst_update_id("")
Neels Hofmeyr6e8c0882018-04-09 02:28:34 +020041Attempting to set illegal id for FSM instance of type 'Test_FSM': ""
Neels Hofmeyr975ee6b2018-04-09 00:42:12 +020042 rc == -22, ok
43 osmo_fsm_inst_name() == "Test_FSM(arbitrary_id)"
44 osmo_fsm_inst_find_by_name("Test_FSM(arbitrary_id)") == fi
45osmo_fsm_inst_update_id("invalid.id")
Neels Hofmeyr6e8c0882018-04-09 02:28:34 +020046Attempting to set illegal id for FSM instance of type 'Test_FSM': "invalid.id"
Neels Hofmeyr975ee6b2018-04-09 00:42:12 +020047 rc == -22, ok
48 osmo_fsm_inst_name() == "Test_FSM(arbitrary_id)"
49 osmo_fsm_inst_find_by_name("Test_FSM(arbitrary_id)") == fi
Neels Hofmeyra64c45a2018-03-31 16:34:49 +020050--- id format tests...
51osmo_fsm_inst_update_id_f("format%cid", '.')
52Attempting to set illegal id for FSM instance of type 'Test_FSM': "format.id"
53 rc == -22, ok
54 osmo_fsm_inst_name() == "Test_FSM(arbitrary_id)"
55 osmo_fsm_inst_find_by_name("Test_FSM(arbitrary_id)") == fi
56osmo_fsm_inst_update_id_f("%s", "")
57Attempting to set illegal id for FSM instance of type 'Test_FSM': ""
58 rc == -22, ok
59 osmo_fsm_inst_name() == "Test_FSM(arbitrary_id)"
60 osmo_fsm_inst_find_by_name("Test_FSM(arbitrary_id)") == fi
61osmo_fsm_inst_update_id_f("format%xid%d", 0x23, 42)
62 rc == 0, ok
63 osmo_fsm_inst_name() == "Test_FSM(format23id42)"
64 osmo_fsm_inst_find_by_name("Test_FSM(format23id42)") == fi
65osmo_fsm_inst_update_id_f(NULL, )
66 rc == 0, ok
67 osmo_fsm_inst_name() == "Test_FSM"
68 osmo_fsm_inst_find_by_name("Test_FSM") == fi
69osmo_fsm_inst_update_id_f(NULL, )
70 rc == 0, ok
71 osmo_fsm_inst_name() == "Test_FSM"
72 osmo_fsm_inst_find_by_name("Test_FSM") == fi
73osmo_fsm_inst_update_id_f("%s%c%s", "arbitrary", '_', "id")
74 rc == 0, ok
75 osmo_fsm_inst_name() == "Test_FSM(arbitrary_id)"
76 osmo_fsm_inst_find_by_name("Test_FSM(arbitrary_id)") == fi
Neels Hofmeyr975ee6b2018-04-09 00:42:12 +020077
78--- test_id_api() done
79
80Test_FSM(arbitrary_id){NULL}: Terminating (cause = OSMO_FSM_TERM_REQUEST)
81Test_FSM(arbitrary_id){NULL}: Freeing instance
82Test_FSM(arbitrary_id){NULL}: Deallocated
Neels Hofmeyr407df022018-05-25 18:20:06 +020083
84--- test_state_chg_keep_timer()
85Test_FSM{NULL}: Allocated
86Test_FSM{NULL}: state_chg to ONE
87Test_FSM{ONE}: state_chg to TWO
88Test_FSM{TWO}: Terminating (cause = OSMO_FSM_TERM_REQUEST)
89Test_FSM{TWO}: Freeing instance
90Test_FSM{TWO}: Deallocated
91Total time passed: 0.000000 s
92Test_FSM{NULL}: Allocated
93Test_FSM{NULL}: state_chg to ONE
94Total time passed: 2.000342 s
95Test_FSM{ONE}: state_chg to TWO
96Total time passed: 2.000342 s
97Total time passed: 9.999999 s
98Total time passed: 10.000000 s
99Test_FSM{TWO}: Timeout of T10
100Test_FSM{TWO}: Terminating (cause = OSMO_FSM_TERM_REQUEST)
101Test_FSM{TWO}: Freeing instance
102Test_FSM{TWO}: Deallocated
103--- test_state_chg_keep_timer() done
Neels Hofmeyrbd5a1dc2019-01-28 15:38:09 +0100104
105--- test_state_chg_T()
106Test_FSM{NULL}: Allocated
107Test_FSM{NULL}: state_chg to ONE
108Test_FSM{ONE}: state_chg to TWO
109Test_FSM{TWO}: Terminating (cause = OSMO_FSM_TERM_REQUEST)
110Test_FSM{TWO}: Freeing instance
111Test_FSM{TWO}: Deallocated
112Test_FSM{NULL}: Allocated
113Test_FSM{NULL}: state_chg to ONE
114Test_FSM{ONE}: state_chg to TWO
115Test_FSM{TWO}: Terminating (cause = OSMO_FSM_TERM_REQUEST)
116Test_FSM{TWO}: Freeing instance
117Test_FSM{TWO}: Deallocated
118--- test_state_chg_T() done