RESOURCE_ASSERT_STATE checks for asserting that a resource is in a given state
[nobug.git] / tests / 35resourcethreaded.tests
blob59e55f970f4e5f2e7dc826191e8a1c97d2ef7454
2 TESTING "resource tracker, w/ threads" ./test_nobug_resources_threaded_mt_alpha
5 TEST "resource threaded, state assert, waiting ok" resourcethreaded_assert_state_waiting_ok <<END
6 err: ECHO:
7 err: RESOURCE_ANNOUNCE:
8 err: RESOURCE_ENTER:
9 err: RESOURCE_LEAVE: .*: type: test@.*: main: waiting
10 err: RESOURCE_FORGET:
11 END
14 TEST "resource threaded, state assert, exclusive fail" resourcethreaded_assert_state_exclusive_fail <<END
15 err: ECHO:
16 err: RESOURCE_ANNOUNCE:
17 err: RESOURCE_ENTER:
18 err: RESOURCE_ASSERT_STATE: .*: resource .* has state waiting but exclusive was expected
19 err: RESOURCE_DUMP:
20 err: BACKTRACE:|.*
21 return: !0
22 END
25 TEST "resource threaded, illegal threadid change, multithreading/alpha" resourcethreaded_ilg_threadid <<END
26 err: ECHO: .*: testing
27 err: RESOURCE_ANNOUNCE: .*: main_1: main: type: test@
28 err: ECHO: .*: main_1: main: create thread
29 err: ECHO: .*: thread_2: bugfn: thread startup, attach resource
30 err: RESOURCE_ENTER: .*: thread_2: bugfn: type: test@
31 err: ECHO: .*: thread_2: bugfn: changing id
32 err: NOBUG: changing thread_id while resources are in use
33 return: !0
34 END
37 TEST "resource threaded, waiting/waiting, multithreading/alpha" resourcethreaded_waiting_waiting <<END
38 err: ECHO:
39 err: RESOURCE_ANNOUNCE: .*: main_1: main: type: test@
40 err: RESOURCE_ENTER: .*: main_1: main: type: test@.*: main: waiting
41 err: ECHO: .*: main_1: main: create thread
42 err: ECHO: .*: thread_2: threadfn: thread startup
43 err: ECHO: .*: thread_2: threadfn: enter direct
44 err: RESOURCE_ENTER: .*: thread_2: threadfn: type: test@.*: thread: waiting
45 err: RESOURCE_LEAVE: .*: thread_2: threadfn: type: test@.*: thread: waiting
46 err: ECHO: .*: thread_2: threadfn: thread finished
47 err: ECHO: .*: main_1: main: thread joined
48 err: RESOURCE_LEAVE: .*: main_1: main: type: test@.*: main: waiting
49 err: RESOURCE_FORGET: .*: main_1: main: type: test@
50 END
53 TEST "resource threaded, waiting/exclusive, multithreading/alpha" resourcethreaded_waiting_exclusive <<END
54 err: ECHO:
55 err: RESOURCE_ANNOUNCE: .*: main_1: main: type: test@
56 err: RESOURCE_ENTER: .*: main_1: main: type: test@.*: main: waiting
57 err: ECHO: .*: main_1: main: create thread
58 err: ECHO: .*: thread_2: threadfn: thread startup
59 err: ECHO: .*: thread_2: threadfn: enter via wait
60 err: RESOURCE_ENTER: .*: thread_2: threadfn: type: test@.*: thread: waiting
61 err: RESOURCE_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->exclusive
62 err: RESOURCE_LEAVE: .*: thread_2: threadfn: type: test@.*: thread: exclusive
63 err: ECHO: .*: thread_2: threadfn: thread finished
64 err: ECHO: .*: main_1: main: thread joined
65 err: RESOURCE_LEAVE: .*: main_1: main: type: test@.*: main: waiting
66 err: RESOURCE_FORGET: .*: main_1: main: type: test@
67 END
70 TEST "resource threaded, waiting/recursive, multithreading/alpha" resourcethreaded_waiting_recursive <<END
71 err: ECHO:
72 err: RESOURCE_ANNOUNCE: .*: main_1: main: type: test@
73 err: RESOURCE_ENTER: .*: main_1: main: type: test@.*: main: waiting
74 err: ECHO: .*: main_1: main: create thread
75 err: ECHO: .*: thread_2: threadfn: thread startup
76 err: ECHO: .*: thread_2: threadfn: enter via wait
77 err: RESOURCE_ENTER: .*: thread_2: threadfn: type: test@.*: thread: waiting
78 err: RESOURCE_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->recursive
79 err: RESOURCE_LEAVE: .*: thread_2: threadfn: type: test@.*: thread: recursive
80 err: ECHO: .*: thread_2: threadfn: thread finished
81 err: ECHO: .*: main_1: main: thread joined
82 err: RESOURCE_LEAVE: .*: main_1: main: type: test@.*: main: waiting
83 err: RESOURCE_FORGET: .*: main_1: main: type: test@
84 END
87 TEST "resource threaded, waiting/shared, multithreading/alpha" resourcethreaded_waiting_shared <<END
88 err: ECHO:
89 err: RESOURCE_ANNOUNCE: .*: main_1: main: type: test@
90 err: RESOURCE_ENTER: .*: main_1: main: type: test@.*: main: waiting
91 err: ECHO: .*: main_1: main: create thread
92 err: ECHO: .*: thread_2: threadfn: thread startup
93 err: ECHO: .*: thread_2: threadfn: enter via wait
94 err: RESOURCE_ENTER: .*: thread_2: threadfn: type: test@.*: thread: waiting
95 err: RESOURCE_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->shared
96 err: RESOURCE_LEAVE: .*: thread_2: threadfn: type: test@.*: thread: shared
97 err: ECHO: .*: thread_2: threadfn: thread finished
98 err: ECHO: .*: main_1: main: thread joined
99 err: RESOURCE_LEAVE: .*: main_1: main: type: test@.*: main: waiting
100 err: RESOURCE_FORGET: .*: main_1: main: type: test@
104 TEST "resource threaded, exclusive/waiting, multithreading/alpha" resourcethreaded_exclusive_waiting <<END
105 err: ECHO:
106 err: RESOURCE_ANNOUNCE: .*: main_1: main: type: test@
107 err: RESOURCE_ENTER: .*: main_1: main: type: test@.*: main: exclusive
108 err: ECHO: .*: main_1: main: create thread
109 err: ECHO: .*: thread_2: threadfn: thread startup
110 err: ECHO: .*: thread_2: threadfn: enter direct
111 err: RESOURCE_ENTER: .*: thread_2: threadfn: type: test@.*: thread: waiting
112 err: RESOURCE_LEAVE: .*: thread_2: threadfn: type: test@.*: thread: waiting
113 err: ECHO: .*: thread_2: threadfn: thread finished
114 err: ECHO: .*: main_1: main: thread joined
115 err: RESOURCE_LEAVE: .*: main_1: main: type: test@.*: main: exclusive
116 err: RESOURCE_FORGET: .*: main_1: main: type: test@
120 TEST "resource threaded, exclusive/exclusive, multithreading/alpha" resourcethreaded_exclusive_exclusive <<END
121 err: ECHO:
122 err: RESOURCE_ANNOUNCE: .*: main_1: main: type: test@
123 err: RESOURCE_ENTER: .*: main_1: main: type: test@.*: main: exclusive
124 err: ECHO: .*: main_1: main: create thread
125 err: ECHO: .*: thread_2: threadfn: thread startup
126 err: ECHO: .*: thread_2: threadfn: enter via wait
127 err: RESOURCE_ENTER: .*: thread_2: threadfn: type: test@.*: thread: waiting
128 err: RESOURCE_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->exclusive
129 err: RESOURCE_ASSERT_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->exclusive: resource hold by another thread
130 err: RESOURCE_DUMP: .*: thread_2: threadfn: .* type:test: hold by 2 entities:
131 err: RESOURCE_DUMP:     .* thread thread_2:.* waiting
132 err: RESOURCE_DUMP:     .* main main_1:.* exclusive
133 err: BACKTRACE:
134 err: .*
135 return: !0
139 TEST "resource threaded, exclusive/recursive, multithreading/alpha" resourcethreaded_exclusive_recursive <<END
140 err: ECHO:
141 err: RESOURCE_ANNOUNCE: .*: main_1: main: type: test@
142 err: RESOURCE_ENTER: .*: main_1: main: type: test@.*: main: exclusive
143 err: ECHO: .*: main_1: main: create thread
144 err: ECHO: .*: thread_2: threadfn: thread startup
145 err: ECHO: .*: thread_2: threadfn: enter via wait
146 err: RESOURCE_ENTER: .*: thread_2: threadfn: type: test@.*: thread: waiting
147 err: RESOURCE_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->recursive
148 err: RESOURCE_ASSERT_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->recursive: resource hold by another thread
149 err: RESOURCE_DUMP: .*: thread_2: threadfn: .* type:test: hold by 2 entities:
150 err: RESOURCE_DUMP:     .* thread thread_2:.* waiting
151 err: RESOURCE_DUMP:     .* main main_1:.* exclusive
152 err: BACKTRACE:
153 err: .*
154 return: !0
158 TEST "resource threaded, exclusive/shared, multithreading/alpha" resourcethreaded_exclusive_shared <<END
159 err: ECHO:
160 err: RESOURCE_ANNOUNCE: .*: main_1: main: type: test@
161 err: RESOURCE_ENTER: .*: main_1: main: type: test@.*: main: exclusive
162 err: ECHO: .*: main_1: main: create thread
163 err: ECHO: .*: thread_2: threadfn: thread startup
164 err: ECHO: .*: thread_2: threadfn: enter via wait
165 err: RESOURCE_ENTER: .*: thread_2: threadfn: type: test@.*: thread: waiting
166 err: RESOURCE_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->shared
167 err: RESOURCE_ASSERT_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->shared: resource hold by another thread nonshared
168 err: RESOURCE_DUMP: .*: thread_2: threadfn: .* type:test: hold by 2 entities:
169 err: RESOURCE_DUMP:     .* thread thread_2:.* waiting
170 err: RESOURCE_DUMP:     .* main main_1:.* exclusive
171 err: BACKTRACE:
172 err: .*
173 return: !0
177 TEST "resource threaded, recursive/waiting, multithreading/alpha" resourcethreaded_recursive_waiting <<END
178 err: ECHO:
179 err: RESOURCE_ANNOUNCE: .*: main_1: main: type: test@
180 err: RESOURCE_ENTER: .*: main_1: main: type: test@.*: main: recursive
181 err: ECHO: .*: main_1: main: create thread
182 err: ECHO: .*: thread_2: threadfn: thread startup
183 err: ECHO: .*: thread_2: threadfn: enter direct
184 err: RESOURCE_ENTER: .*: thread_2: threadfn: type: test@.*: thread: waiting
185 err: RESOURCE_LEAVE: .*: thread_2: threadfn: type: test@.*: thread: waiting
186 err: ECHO: .*: thread_2: threadfn: thread finished
187 err: ECHO: .*: main_1: main: thread joined
188 err: RESOURCE_LEAVE: .*: main_1: main: type: test@.*: main: recursive
189 err: RESOURCE_FORGET: .*: main_1: main: type: test@
193 TEST "resource threaded, recursive/exclusive, multithreading/alpha" resourcethreaded_recursive_exclusive <<END
194 err: ECHO:
195 err: RESOURCE_ANNOUNCE: .*: main_1: main: type: test@
196 err: RESOURCE_ENTER: .*: main_1: main: type: test@.*: main: recursive
197 err: ECHO: .*: main_1: main: create thread
198 err: ECHO: .*: thread_2: threadfn: thread startup
199 err: ECHO: .*: thread_2: threadfn: enter via wait
200 err: RESOURCE_ENTER: .*: thread_2: threadfn: type: test@.*: thread: waiting
201 err: RESOURCE_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->exclusive
202 err: RESOURCE_ASSERT_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->exclusive: resource hold by another thread
203 err: RESOURCE_DUMP: .*: thread_2: threadfn: .* type:test: hold by 2 entities:
204 err: RESOURCE_DUMP:     .* thread thread_2:.* waiting
205 err: RESOURCE_DUMP:     .* main main_1:.* recursive
206 err: BACKTRACE:
207 err: .*
208 return: !0
212 TEST "resource threaded, recursive/recursive, multithreading/alpha" resourcethreaded_recursive_recursive <<END
213 err: ECHO:
214 err: RESOURCE_ANNOUNCE: .*: main_1: main: type: test@
215 err: RESOURCE_ENTER: .*: main_1: main: type: test@.*: main: recursive
216 err: ECHO: .*: main_1: main: create thread
217 err: ECHO: .*: thread_2: threadfn: thread startup
218 err: ECHO: .*: thread_2: threadfn: enter via wait
219 err: RESOURCE_ENTER: .*: thread_2: threadfn: type: test@.*: thread: waiting
220 err: RESOURCE_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->recursive
221 err: RESOURCE_ASSERT_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->recursive: resource hold by another thread
222 err: RESOURCE_DUMP: .*: thread_2: threadfn: .* type:test: hold by 2 entities:
223 err: RESOURCE_DUMP:     .* thread thread_2:.* waiting
224 err: RESOURCE_DUMP:     .* main main_1:.* recursive
225 err: BACKTRACE:
226 err: .*
227 return: !0
231 TEST "resource threaded, recursive/shared, multithreading/alpha" resourcethreaded_recursive_shared <<END
232 err: ECHO:
233 err: RESOURCE_ANNOUNCE: .*: main_1: main: type: test@
234 err: RESOURCE_ENTER: .*: main_1: main: type: test@.*: main: recursive
235 err: ECHO: .*: main_1: main: create thread
236 err: ECHO: .*: thread_2: threadfn: thread startup
237 err: ECHO: .*: thread_2: threadfn: enter via wait
238 err: RESOURCE_ENTER: .*: thread_2: threadfn: type: test@.*: thread: waiting
239 err: RESOURCE_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->shared
240 err: RESOURCE_ASSERT_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->shared: resource hold by another thread nonshared
241 err: RESOURCE_DUMP: .*: thread_2: threadfn: .* type:test: hold by 2 entities:
242 err: RESOURCE_DUMP:     .* thread thread_2:.* waiting
243 err: RESOURCE_DUMP:     .* main main_1:.* recursive
244 err: BACKTRACE:
245 err: .*
246 return: !0
250 TEST "resource threaded, shared/waiting, multithreading/alpha" resourcethreaded_shared_waiting <<END
251 err: ECHO:
252 err: RESOURCE_ANNOUNCE: .*: main_1: main: type: test@
253 err: RESOURCE_ENTER: .*: main_1: main: type: test@.*: main: shared
254 err: ECHO: .*: main_1: main: create thread
255 err: ECHO: .*: thread_2: threadfn: thread startup
256 err: ECHO: .*: thread_2: threadfn: enter direct
257 err: RESOURCE_ENTER: .*: thread_2: threadfn: type: test@.*: thread: waiting
258 err: RESOURCE_LEAVE: .*: thread_2: threadfn: type: test@.*: thread: waiting
259 err: ECHO: .*: thread_2: threadfn: thread finished
260 err: ECHO: .*: main_1: main: thread joined
261 err: RESOURCE_LEAVE: .*: main_1: main: type: test@.*: main: shared
262 err: RESOURCE_FORGET: .*: main_1: main: type: test@
266 TEST "resource threaded, shared/exclusive, multithreading/alpha" resourcethreaded_shared_exclusive <<END
267 err: ECHO:
268 err: RESOURCE_ANNOUNCE: .*: main_1: main: type: test@
269 err: RESOURCE_ENTER: .*: main_1: main: type: test@.*: main: shared
270 err: ECHO: .*: main_1: main: create thread
271 err: ECHO: .*: thread_2: threadfn: thread startup
272 err: ECHO: .*: thread_2: threadfn: enter via wait
273 err: RESOURCE_ENTER: .*: thread_2: threadfn: type: test@.*: thread: waiting
274 err: RESOURCE_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->exclusive
275 err: RESOURCE_ASSERT_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->exclusive: resource hold by another thread
276 err: RESOURCE_DUMP: .*: thread_2: threadfn: .* type:test: hold by 2 entities:
277 err: RESOURCE_DUMP:     .* thread thread_2:.* waiting
278 err: RESOURCE_DUMP:     .* main main_1:.* shared
279 err: BACKTRACE:
280 err: .*
281 return: !0
285 TEST "resource threaded, shared/recursive, multithreading/alpha" resourcethreaded_shared_recursive <<END
286 err: ECHO:
287 err: RESOURCE_ANNOUNCE: .*: main_1: main: type: test@
288 err: RESOURCE_ENTER: .*: main_1: main: type: test@.*: main: shared
289 err: ECHO: .*: main_1: main: create thread
290 err: ECHO: .*: thread_2: threadfn: thread startup
291 err: ECHO: .*: thread_2: threadfn: enter via wait
292 err: RESOURCE_ENTER: .*: thread_2: threadfn: type: test@.*: thread: waiting
293 err: RESOURCE_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->recursive
294 err: RESOURCE_ASSERT_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->recursive: resource hold by another thread
295 err: RESOURCE_DUMP: .*: thread_2: threadfn: .* type:test: hold by 2 entities:
296 err: RESOURCE_DUMP:     .* thread thread_2:.* waiting
297 err: RESOURCE_DUMP:     .* main main_1:.* shared
298 err: BACKTRACE:
299 err: .*
300 return: !0
304 TEST "resource threaded, shared/shared, multithreading/alpha" resourcethreaded_shared_shared <<END
305 err: ECHO:
306 err: RESOURCE_ANNOUNCE: .*: main_1: main: type: test@
307 err: RESOURCE_ENTER: .*: main_1: main: type: test@.*: main: shared
308 err: ECHO: .*: main_1: main: create thread
309 err: ECHO: .*: thread_2: threadfn: thread startup
310 err: ECHO: .*: thread_2: threadfn: enter via wait
311 err: RESOURCE_ENTER: .*: thread_2: threadfn: type: test@.*: thread: waiting
312 err: RESOURCE_STATE: .*: thread_2: threadfn: type: test@.*: thread: waiting->shared
313 err: RESOURCE_LEAVE: .*: thread_2: threadfn: type: test@.*: thread: shared
314 err: ECHO: .*: thread_2: threadfn: thread finished
315 err: ECHO: .*: main_1: main: thread joined
316 err: RESOURCE_LEAVE: .*: main_1: main: type: test@.*: main: shared
317 err: RESOURCE_FORGET: .*: main_1: main: type: test@