aboutsummaryrefslogtreecommitdiffstats
path: root/tests/tdef/tdef_test.ok
blob: 4bdd3d0b67d970a0c5151b2c04832908adc0951b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
test_tdef_get()
T1=100s
osmo_tdef_get(1, s)	= 100
osmo_tdef_get(1, ms)	= 100000
osmo_tdef_get(1, m)	= 2
osmo_tdef_get(1, custom-unit)	= 100
osmo_tdef_get(1, us)	= 100000000
T2=100ms
osmo_tdef_get(2, s)	= 1
osmo_tdef_get(2, ms)	= 100
osmo_tdef_get(2, m)	= 1
osmo_tdef_get(2, custom-unit)	= 100
osmo_tdef_get(2, us)	= 100000
T3=100m
osmo_tdef_get(3, s)	= 6000
osmo_tdef_get(3, ms)	= 6000000
osmo_tdef_get(3, m)	= 100
osmo_tdef_get(3, custom-unit)	= 100
osmo_tdef_get(3, us)	= 6000000000
T4=100custom-unit
osmo_tdef_get(4, s)	= 100
osmo_tdef_get(4, ms)	= 100
osmo_tdef_get(4, m)	= 100
osmo_tdef_get(4, custom-unit)	= 100
osmo_tdef_get(4, us)	= 100
T7=50s
osmo_tdef_get(7, s)	= 50
osmo_tdef_get(7, ms)	= 50000
osmo_tdef_get(7, m)	= 1
osmo_tdef_get(7, custom-unit)	= 50
osmo_tdef_get(7, us)	= 50000000
T8=300s
osmo_tdef_get(8, s)	= 300
osmo_tdef_get(8, ms)	= 300000
osmo_tdef_get(8, m)	= 5
osmo_tdef_get(8, custom-unit)	= 300
osmo_tdef_get(8, us)	= 300000000
T9=5m
osmo_tdef_get(9, s)	= 300
osmo_tdef_get(9, ms)	= 300000
osmo_tdef_get(9, m)	= 5
osmo_tdef_get(9, custom-unit)	= 5
osmo_tdef_get(9, us)	= 300000000
T10=20m
osmo_tdef_get(10, s)	= 1200
osmo_tdef_get(10, ms)	= 1200000
osmo_tdef_get(10, m)	= 20
osmo_tdef_get(10, custom-unit)	= 20
osmo_tdef_get(10, us)	= 1200000000
T1000=2000ms
osmo_tdef_get(1000, s)	= 2
osmo_tdef_get(1000, ms)	= 2000
osmo_tdef_get(1000, m)	= 1
osmo_tdef_get(1000, custom-unit)	= 2000
osmo_tdef_get(1000, us)	= 2000000
T1001=30000ms
osmo_tdef_get(1001, s)	= 30
osmo_tdef_get(1001, ms)	= 30000
osmo_tdef_get(1001, m)	= 1
osmo_tdef_get(1001, custom-unit)	= 30000
osmo_tdef_get(1001, us)	= 30000000
T1004=1ms
osmo_tdef_get(1004, s)	= 1
osmo_tdef_get(1004, ms)	= 1
osmo_tdef_get(1004, m)	= 1
osmo_tdef_get(1004, custom-unit)	= 1
osmo_tdef_get(1004, us)	= 1000
T1005=0ms
osmo_tdef_get(1005, s)	= 0
osmo_tdef_get(1005, ms)	= 0
osmo_tdef_get(1005, m)	= 0
osmo_tdef_get(1005, custom-unit)	= 0
osmo_tdef_get(1005, us)	= 0
T1006=0s
osmo_tdef_get(1006, s)	= 0
osmo_tdef_get(1006, ms)	= 0
osmo_tdef_get(1006, m)	= 0
osmo_tdef_get(1006, custom-unit)	= 0
osmo_tdef_get(1006, us)	= 0
T1007=0m
osmo_tdef_get(1007, s)	= 0
osmo_tdef_get(1007, ms)	= 0
osmo_tdef_get(1007, m)	= 0
osmo_tdef_get(1007, custom-unit)	= 0
osmo_tdef_get(1007, us)	= 0
T1008=0custom-unit
osmo_tdef_get(1008, s)	= 0
osmo_tdef_get(1008, ms)	= 0
osmo_tdef_get(1008, m)	= 0
osmo_tdef_get(1008, custom-unit)	= 0
osmo_tdef_get(1008, us)	= 0
T1009=0us
osmo_tdef_get(1009, s)	= 0
osmo_tdef_get(1009, ms)	= 0
osmo_tdef_get(1009, m)	= 0
osmo_tdef_get(1009, custom-unit)	= 0
osmo_tdef_get(1009, us)	= 0
T0=1custom-unit
osmo_tdef_get(0, s)	= 1
osmo_tdef_get(0, ms)	= 1
osmo_tdef_get(0, m)	= 1
osmo_tdef_get(0, custom-unit)	= 1
osmo_tdef_get(0, us)	= 1
T123=1s
osmo_tdef_get(123, s)	= 1
osmo_tdef_get(123, ms)	= 1000
osmo_tdef_get(123, m)	= 1
osmo_tdef_get(123, custom-unit)	= 1
osmo_tdef_get(123, us)	= 1000000

test_tdef_get_nonexisting()
osmo_tdef_get(tdefs, 5, s, 999)	= 999
osmo_tdef_get(tdefs, 5, ms, 999)	= 999
osmo_tdef_get(tdefs, 5, m, 999)	= 999
osmo_tdef_get(tdefs, 5, custom-unit, 999)	= 999
osmo_tdef_get(tdefs, 5, us, 999)	= 999

test_tdef_set_and_get()
setting 7 = 42
T7=42s(def=50)
osmo_tdef_get(7, ms)	= 42000
osmo_tdef_get(7, s)	= 42
osmo_tdef_get(7, m)	= 1
osmo_tdef_get(7, custom-unit)	= 42
osmo_tdef_get(7, us)	= 42000000
setting 7 = 420
T7=420s(def=50)
osmo_tdef_get(7, ms)	= 420000
osmo_tdef_get(7, s)	= 420
osmo_tdef_get(7, m)	= 7
osmo_tdef_get(7, custom-unit)	= 420
osmo_tdef_get(7, us)	= 420000000
setting 7 = 10 (ERANGE)
T7=420s(def=50)
osmo_tdef_get(7, ms)	= 420000
osmo_tdef_get(7, s)	= 420
osmo_tdef_get(7, m)	= 7
osmo_tdef_get(7, custom-unit)	= 420
osmo_tdef_get(7, us)	= 420000000
setting 7 = 900 (ERANGE)
T7=420s(def=50)
osmo_tdef_get(7, ms)	= 420000
osmo_tdef_get(7, s)	= 420
osmo_tdef_get(7, m)	= 7
osmo_tdef_get(7, custom-unit)	= 420
osmo_tdef_get(7, us)	= 420000000
setting 23 = 50 (EEXIST)
resetting
T7=50s
osmo_tdef_get(7, s)	= 50

test_tdef_state_timeout()
state=A T=0, no timeout
 --> A (configured as T1 100 s) rc=0;	state=A T=1, 100.000000 s remaining
 --> B (configured as T2 100 ms) rc=0;	state=B T=2, 1.000000 s remaining
 --> C (configured as T3 100 m) rc=0;	state=C T=3, 6000.000000 s remaining
 --> D (configured as T4 100 custom-unit) rc=0;	state=D T=4, 100.000000 s remaining
 --> G (configured as T7 50 s) rc=0;	state=G T=7, 50.000000 s remaining
 --> H (configured as T8 300 s) rc=0;	state=H T=8, 300.000000 s remaining
 --> I (configured as T9 5 m) rc=0;	state=I T=9, 300.000000 s remaining
 --> J (configured as T10 20 m) rc=0;	state=J T=10, 1200.000000 s remaining
- test keep_timer:
Time passes: 123.045678 s
state=J T=10, 1076.954322 s remaining
 --> K (configured as T0(keep_timer) 1 custom-unit) rc=0;	state=K T=10, 1076.954322 s remaining
 --> A (configured as T1 100 s) rc=0;	state=A T=1, 100.000000 s remaining
Time passes: 23.045678 s
state=A T=1, 76.954322 s remaining
 --> K (configured as T0(keep_timer) 1 custom-unit) rc=0;	state=K T=1, 76.954322 s remaining
 --> A (configured as T1 100 s) rc=0;	state=A T=1, 100.000000 s remaining
Time passes: 23.045678 s
state=A T=1, 76.954322 s remaining
 --> L (configured as T123(keep_timer) 1 s) rc=0;	state=L T=1, 76.954322 s remaining
 --> O (no timer configured for this state) rc=0;	state=O T=0, no timeout
 --> L (configured as T123(keep_timer) 1 s) rc=0;	state=L T=123, 1.000000 s remaining
- test T=0:
 --> O (no timer configured for this state) rc=0;	state=O T=0, no timeout
- test no timer:
 --> X (no timer configured for this state) rc=0;	state=X T=0, no timeout
- test undefined timer, using default_val arg of osmo_tdef_fsm_inst_state_chg(), here passed as 999:
 --> Y (configured as T666 0 -) rc=0;	state=Y T=666, 999.000000 s remaining
- test disallowed transition:
 --> Z (no timer configured for this state) rc=0;	state=Z T=0, no timeout
 --> B (configured as T2 100 ms) rc=-1;	state=Z T=0, no timeout
 --> C (configured as T3 100 m) rc=-1;	state=Z T=0, no timeout
 --> D (configured as T4 100 custom-unit) rc=-1;	state=Z T=0, no timeout