7 TEST(resources_announce_forget
)
10 RESOURCE_HANDLE_INIT (t1
);
11 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
12 RESOURCE_FORGET(NOBUG_ON
, t1
);
13 RESOURCE_DUMPALL(NOBUG_ON
);
16 /* Basic enter/leave tests */
17 TEST(resources_enter_exclusive_leave
)
20 RESOURCE_HANDLE_INIT (t1
);
22 RESOURCE_USER_INIT (e1
);
23 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
25 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_EXCLUSIVE
, e1
);
26 RESOURCE_LEAVE(NOBUG_ON
, e1
);
28 RESOURCE_DUMPALL(NOBUG_ON
);
29 RESOURCE_FORGET(NOBUG_ON
, t1
);
30 RESOURCE_DUMPALL(NOBUG_ON
);
33 TEST(resources_enter_waiting_leave
)
36 RESOURCE_HANDLE_INIT (t1
);
38 RESOURCE_USER_INIT (e1
);
39 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
41 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_WAITING
, e1
);
42 RESOURCE_LEAVE(NOBUG_ON
, e1
);
44 RESOURCE_DUMPALL(NOBUG_ON
);
45 RESOURCE_FORGET(NOBUG_ON
, t1
);
46 RESOURCE_DUMPALL(NOBUG_ON
);
49 TEST(resources_enter_recursive_leave
)
52 RESOURCE_HANDLE_INIT (t1
);
54 RESOURCE_USER_INIT (e1
);
55 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
57 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_RECURSIVE
, e1
);
58 RESOURCE_LEAVE(NOBUG_ON
, e1
);
60 RESOURCE_DUMPALL(NOBUG_ON
);
61 RESOURCE_FORGET(NOBUG_ON
, t1
);
62 RESOURCE_DUMPALL(NOBUG_ON
);
65 /* leaving too much tests */
66 TEST(resources_enter_exclusive_leave2
)
69 RESOURCE_HANDLE_INIT (t1
);
71 RESOURCE_USER_INIT (e1
);
72 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
74 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_EXCLUSIVE
, e1
);
75 RESOURCE_LEAVE(NOBUG_ON
, e1
);
76 RESOURCE_LEAVE(NOBUG_ON
, e1
);
78 RESOURCE_DUMPALL(NOBUG_ON
);
79 RESOURCE_FORGET(NOBUG_ON
, t1
);
80 RESOURCE_DUMPALL(NOBUG_ON
);
83 TEST(resources_enter_waiting_leave2
)
86 RESOURCE_HANDLE_INIT (t1
);
88 RESOURCE_USER_INIT (e1
);
89 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
91 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_WAITING
, e1
);
92 RESOURCE_LEAVE(NOBUG_ON
, e1
);
93 RESOURCE_LEAVE(NOBUG_ON
, e1
);
95 RESOURCE_DUMPALL(NOBUG_ON
);
96 RESOURCE_FORGET(NOBUG_ON
, t1
);
97 RESOURCE_DUMPALL(NOBUG_ON
);
100 TEST(resources_enter_recursive_leave2
)
103 RESOURCE_HANDLE_INIT (t1
);
105 RESOURCE_USER_INIT (e1
);
106 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
108 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_RECURSIVE
, e1
);
109 RESOURCE_LEAVE(NOBUG_ON
, e1
);
110 RESOURCE_LEAVE(NOBUG_ON
, e1
);
112 RESOURCE_DUMPALL(NOBUG_ON
);
113 RESOURCE_FORGET(NOBUG_ON
, t1
);
114 RESOURCE_DUMPALL(NOBUG_ON
);
119 /* forgot to leave tests */
120 TEST(resources_enter_exclusive
)
123 RESOURCE_HANDLE_INIT (t1
);
125 RESOURCE_USER_INIT (e1
);
126 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
128 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_EXCLUSIVE
, e1
);
130 RESOURCE_DUMPALL(NOBUG_ON
);
131 RESOURCE_FORGET(NOBUG_ON
, t1
);
132 RESOURCE_DUMPALL(NOBUG_ON
);
135 TEST(resources_enter_waiting
)
138 RESOURCE_HANDLE_INIT (t1
);
140 RESOURCE_USER_INIT (e1
);
141 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
143 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_WAITING
, e1
);
145 RESOURCE_DUMPALL(NOBUG_ON
);
146 RESOURCE_FORGET(NOBUG_ON
, t1
);
147 RESOURCE_DUMPALL(NOBUG_ON
);
150 TEST(resources_enter_recursive
)
153 RESOURCE_HANDLE_INIT (t1
);
155 RESOURCE_USER_INIT (e1
);
156 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
158 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_RECURSIVE
, e1
);
160 RESOURCE_DUMPALL(NOBUG_ON
);
161 RESOURCE_FORGET(NOBUG_ON
, t1
);
162 RESOURCE_DUMPALL(NOBUG_ON
);
166 /* State without enter tests */
167 TEST(resources_state_exclusive
)
170 RESOURCE_HANDLE_INIT (t1
);
172 RESOURCE_USER_INIT (e1
);
173 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
175 RESOURCE_STATE(NOBUG_ON
, NOBUG_RESOURCE_EXCLUSIVE
, e1
);
177 RESOURCE_DUMPALL(NOBUG_ON
);
178 RESOURCE_FORGET(NOBUG_ON
, t1
);
179 RESOURCE_DUMPALL(NOBUG_ON
);
182 TEST(resources_state_waiting
)
185 RESOURCE_HANDLE_INIT (t1
);
187 RESOURCE_USER_INIT (e1
);
188 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
190 RESOURCE_STATE(NOBUG_ON
, NOBUG_RESOURCE_WAITING
, e1
);
192 RESOURCE_DUMPALL(NOBUG_ON
);
193 RESOURCE_FORGET(NOBUG_ON
, t1
);
194 RESOURCE_DUMPALL(NOBUG_ON
);
197 TEST(resources_state_recursive
)
200 RESOURCE_HANDLE_INIT (t1
);
202 RESOURCE_USER_INIT (e1
);
203 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
205 RESOURCE_STATE(NOBUG_ON
, NOBUG_RESOURCE_RECURSIVE
, e1
);
207 RESOURCE_DUMPALL(NOBUG_ON
);
208 RESOURCE_FORGET(NOBUG_ON
, t1
);
209 RESOURCE_DUMPALL(NOBUG_ON
);
213 /* waiting transistions valid tests */
214 TEST(resources_enter_waiting_state_exclusive
)
217 RESOURCE_HANDLE_INIT (t1
);
219 RESOURCE_USER_INIT (e1
);
220 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
222 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_WAITING
, e1
);
223 RESOURCE_STATE(NOBUG_ON
, NOBUG_RESOURCE_EXCLUSIVE
, e1
);
224 RESOURCE_LEAVE(NOBUG_ON
, e1
);
226 RESOURCE_DUMPALL(NOBUG_ON
);
227 RESOURCE_FORGET(NOBUG_ON
, t1
);
228 RESOURCE_DUMPALL(NOBUG_ON
);
231 TEST(resources_enter_waiting_state_recursive
)
234 RESOURCE_HANDLE_INIT (t1
);
236 RESOURCE_USER_INIT (e1
);
237 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
239 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_WAITING
, e1
);
240 RESOURCE_STATE(NOBUG_ON
, NOBUG_RESOURCE_RECURSIVE
, e1
);
241 RESOURCE_LEAVE(NOBUG_ON
, e1
);
243 RESOURCE_DUMPALL(NOBUG_ON
);
244 RESOURCE_FORGET(NOBUG_ON
, t1
);
245 RESOURCE_DUMPALL(NOBUG_ON
);
249 TEST(resources_enter_waiting_enter_waiting
)
252 RESOURCE_HANDLE_INIT (t1
);
254 RESOURCE_USER_INIT (e1
);
256 RESOURCE_USER_INIT (e2
);
257 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
259 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_WAITING
, e1
);
260 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_WAITING
, e2
);
261 RESOURCE_LEAVE(NOBUG_ON
, e1
);
262 RESOURCE_LEAVE(NOBUG_ON
, e2
);
264 RESOURCE_DUMPALL(NOBUG_ON
);
265 RESOURCE_FORGET(NOBUG_ON
, t1
);
266 RESOURCE_DUMPALL(NOBUG_ON
);
269 TEST(resources_enter_waiting_enter_recursive
)
272 RESOURCE_HANDLE_INIT (t1
);
274 RESOURCE_USER_INIT (e1
);
276 RESOURCE_USER_INIT (e2
);
277 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
279 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_WAITING
, e1
);
280 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_RECURSIVE
, e2
);
281 RESOURCE_LEAVE(NOBUG_ON
, e1
);
282 RESOURCE_LEAVE(NOBUG_ON
, e2
);
284 RESOURCE_FORGET(NOBUG_ON
, t1
);
285 RESOURCE_DUMPALL(NOBUG_ON
);
288 TEST(resources_enter_waiting_enter_exclusive
)
291 RESOURCE_HANDLE_INIT (t1
);
293 RESOURCE_USER_INIT (e1
);
295 RESOURCE_USER_INIT (e2
);
296 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
298 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_WAITING
, e1
);
299 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_EXCLUSIVE
, e2
);
300 RESOURCE_LEAVE(NOBUG_ON
, e1
);
301 RESOURCE_LEAVE(NOBUG_ON
, e2
);
303 RESOURCE_FORGET(NOBUG_ON
, t1
);
304 RESOURCE_DUMPALL(NOBUG_ON
);
310 TEST(resources_enter_exclusive_state_waiting
)
313 RESOURCE_HANDLE_INIT (t1
);
315 RESOURCE_USER_INIT (e1
);
316 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
318 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_EXCLUSIVE
, e1
);
319 RESOURCE_STATE(NOBUG_ON
, NOBUG_RESOURCE_WAITING
, e1
);
320 RESOURCE_LEAVE(NOBUG_ON
, e1
);
322 RESOURCE_FORGET(NOBUG_ON
, t1
);
323 RESOURCE_DUMPALL(NOBUG_ON
);
326 TEST(resources_enter_exclusive_state_recursive
)
329 RESOURCE_HANDLE_INIT (t1
);
331 RESOURCE_USER_INIT (e1
);
332 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
334 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_EXCLUSIVE
, e1
);
335 RESOURCE_STATE(NOBUG_ON
, NOBUG_RESOURCE_RECURSIVE
, e1
);
337 RESOURCE_DUMPALL(NOBUG_ON
);
338 RESOURCE_FORGET(NOBUG_ON
, t1
);
339 RESOURCE_DUMPALL(NOBUG_ON
);
342 TEST(resources_enter_exclusive_state_exclusive
)
345 RESOURCE_HANDLE_INIT (t1
);
347 RESOURCE_USER_INIT (e1
);
348 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
350 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_EXCLUSIVE
, e1
);
351 RESOURCE_STATE(NOBUG_ON
, NOBUG_RESOURCE_EXCLUSIVE
, e1
);
353 RESOURCE_DUMPALL(NOBUG_ON
);
354 RESOURCE_FORGET(NOBUG_ON
, t1
);
355 RESOURCE_DUMPALL(NOBUG_ON
);
358 TEST(resources_enter_exclusive_enter_waiting
)
361 RESOURCE_HANDLE_INIT (t1
);
363 RESOURCE_USER_INIT (e1
);
365 RESOURCE_USER_INIT (e2
);
366 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
368 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_EXCLUSIVE
, e1
);
369 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_WAITING
, e2
);
370 RESOURCE_LEAVE(NOBUG_ON
, e1
);
371 RESOURCE_LEAVE(NOBUG_ON
, e2
);
373 RESOURCE_FORGET(NOBUG_ON
, t1
);
376 TEST(resources_enter_exclusive_enter_recursive
)
379 RESOURCE_HANDLE_INIT (t1
);
381 RESOURCE_USER_INIT (e1
);
383 RESOURCE_USER_INIT (e2
);
384 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
386 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_EXCLUSIVE
, e1
);
387 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_RECURSIVE
, e2
);
389 RESOURCE_DUMPALL(NOBUG_ON
);
390 RESOURCE_FORGET(NOBUG_ON
, t1
);
391 RESOURCE_DUMPALL(NOBUG_ON
);
394 TEST(resources_enter_exclusive_enter_exclusive
)
397 RESOURCE_HANDLE_INIT (t1
);
399 RESOURCE_USER_INIT (e1
);
401 RESOURCE_USER_INIT (e2
);
402 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
404 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_EXCLUSIVE
, e1
);
405 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_EXCLUSIVE
, e2
);
407 RESOURCE_DUMPALL(NOBUG_ON
);
408 RESOURCE_FORGET(NOBUG_ON
, t1
);
409 RESOURCE_DUMPALL(NOBUG_ON
);
413 TEST(resources_enter_recursive_state_waiting
)
416 RESOURCE_HANDLE_INIT (t1
);
418 RESOURCE_USER_INIT (e1
);
419 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
421 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_RECURSIVE
, e1
);
422 RESOURCE_STATE(NOBUG_ON
, NOBUG_RESOURCE_WAITING
, e1
);
423 RESOURCE_LEAVE(NOBUG_ON
, e1
);
425 RESOURCE_FORGET(NOBUG_ON
, t1
);
428 TEST(resources_enter_recursive_state_recursive
)
431 RESOURCE_HANDLE_INIT (t1
);
433 RESOURCE_USER_INIT (e1
);
434 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
436 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_RECURSIVE
, e1
);
437 RESOURCE_STATE(NOBUG_ON
, NOBUG_RESOURCE_RECURSIVE
, e1
);
439 RESOURCE_DUMPALL(NOBUG_ON
);
440 RESOURCE_FORGET(NOBUG_ON
, t1
);
441 RESOURCE_DUMPALL(NOBUG_ON
);
444 TEST(resources_enter_recursive_state_exclusive
)
447 RESOURCE_HANDLE_INIT (t1
);
449 RESOURCE_USER_INIT (e1
);
450 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
452 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_RECURSIVE
, e1
);
453 RESOURCE_STATE(NOBUG_ON
, NOBUG_RESOURCE_EXCLUSIVE
, e1
);
455 RESOURCE_DUMPALL(NOBUG_ON
);
456 RESOURCE_FORGET(NOBUG_ON
, t1
);
457 RESOURCE_DUMPALL(NOBUG_ON
);
460 TEST(resources_enter_recursive_enter_waiting
)
463 RESOURCE_HANDLE_INIT (t1
);
465 RESOURCE_USER_INIT (e1
);
467 RESOURCE_USER_INIT (e2
);
468 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
470 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_RECURSIVE
, e1
);
471 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_WAITING
, e2
);
472 RESOURCE_LEAVE(NOBUG_ON
, e1
);
473 RESOURCE_LEAVE(NOBUG_ON
, e2
);
475 RESOURCE_DUMPALL(NOBUG_ON
);
476 RESOURCE_FORGET(NOBUG_ON
, t1
);
477 RESOURCE_DUMPALL(NOBUG_ON
);
481 TEST(resources_enter_recursive_enter_exclusive
)
484 RESOURCE_HANDLE_INIT (t1
);
486 RESOURCE_USER_INIT (e1
);
488 RESOURCE_USER_INIT (e2
);
489 RESOURCE_ANNOUNCE(NOBUG_ON
, "type1", "test1", main
, t1
);
491 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_RECURSIVE
, e1
);
492 RESOURCE_ENTER(NOBUG_ON
, t1
, "user1", NOBUG_RESOURCE_EXCLUSIVE
, e2
);
494 RESOURCE_DUMPALL(NOBUG_ON
);
495 RESOURCE_FORGET(NOBUG_ON
, t1
);
496 RESOURCE_DUMPALL(NOBUG_ON
);