Setting tag sliver-openvswitch-2.2.90-1
[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([ovstest 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~: cannot lock file because this process has already locked it
18 ])
19
20 CHECK_LOCKFILE([lock_blocks_same_process_twice], [0],
21   [lockfile|WARN|.file.~lock~: cannot lock file because this process has already locked it
22 lockfile|WARN|.file.~lock~: cannot lock file because this process has already locked it
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~: cannot lock file because this process has already locked it
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~: cannot lock file because this process has already locked it
40 ])
41
42 CHECK_LOCKFILE([lock_symlink], [0],
43   [lockfile|WARN|.a.~lock~: cannot lock file because this process has already locked it
44 lockfile|WARN|.b.~lock~: cannot lock file because this process has already locked it
45 lockfile|WARN|.b.~lock~: cannot lock file because this process has already locked it
46 lockfile|WARN|.a.~lock~: cannot lock file because this process has already locked it
47 ])
48
49 CHECK_LOCKFILE([lock_symlink_to_dir], [0],
50   [lockfile|WARN|dir/.b.~lock~: cannot lock file because this process has already locked it
51 ])