datapath: Remove old patch interface definitions.
[sliver-openvswitch.git] / tests / lockfile.at
1 AT_BANNER([lockfile unit tests])
2
3 m4_define([CHECK_LOCKFILE],
4   [AT_SETUP([m4_translit([$1], [_], [ ])])
5    AT_KEYWORDS([lockfile])
6    AT_CHECK([test-lockfile $1], [0], [$1: success (m4_if(
7      [$2], [1], [$2 child], [$2 children]))
8 ], [stderr])
9    AT_CHECK([sed 's/pid [[0-9]]*/pid <pid>/' stderr], [0], [$3])
10    AT_CLEANUP])
11
12 CHECK_LOCKFILE([lock_and_unlock], [0])
13
14 CHECK_LOCKFILE([lock_and_unlock_twice], [0])
15
16 CHECK_LOCKFILE([lock_blocks_same_process], [0],
17   [lockfile|WARN|.file.~lock~: failed to lock file: Resource deadlock avoided
18 ])
19
20 CHECK_LOCKFILE([lock_blocks_same_process_twice], [0],
21   [lockfile|WARN|.file.~lock~: failed to lock file: Resource deadlock avoided
22 lockfile|WARN|.file.~lock~: failed to lock file: Resource deadlock avoided
23 ])
24
25 CHECK_LOCKFILE([lock_blocks_other_process], [1],
26   [lockfile|WARN|.file.~lock~: child does not inherit lock
27 lockfile|WARN|.file.~lock~: cannot lock file because it is already locked by pid <pid>
28 ])
29
30 CHECK_LOCKFILE([lock_twice_blocks_other_process], [1],
31   [lockfile|WARN|.file.~lock~: failed to lock file: Resource deadlock avoided
32 lockfile|WARN|.file.~lock~: child does not inherit lock
33 lockfile|WARN|.file.~lock~: cannot lock file because it is already locked by pid <pid>
34 ])
35
36 CHECK_LOCKFILE([lock_and_unlock_allows_other_process], [1])
37
38 CHECK_LOCKFILE([lock_multiple], [0],
39   [lockfile|WARN|.a.~lock~: failed to lock file: Resource deadlock avoided
40 ])
41
42 CHECK_LOCKFILE([lock_symlink], [0],
43   [lockfile|WARN|.a.~lock~: failed to lock file: Resource deadlock avoided
44 lockfile|WARN|.b.~lock~: failed to lock file: Resource deadlock avoided
45 lockfile|WARN|.b.~lock~: failed to lock file: Resource deadlock avoided
46 lockfile|WARN|.a.~lock~: failed to lock file: Resource deadlock avoided
47 ])
48
49 CHECK_LOCKFILE([lock_symlink_to_dir], [0],
50   [lockfile|WARN|dir/.b.~lock~: failed to lock file: Resource deadlock avoided
51 ])