1 AT_BANNER([lockfile unit tests])
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]))
9 AT_CHECK([sed 's/pid [[0-9]]*/pid <pid>/' stderr], [0], [$3])
12 CHECK_LOCKFILE([lock_and_unlock], [0])
14 CHECK_LOCKFILE([lock_and_unlock_twice], [0])
16 CHECK_LOCKFILE([lock_blocks_same_process], [0],
17 [lockfile|WARN|.file.~lock~: failed to lock file: Resource deadlock avoided
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
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>
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>
36 CHECK_LOCKFILE([lock_and_unlock_allows_other_process], [1])
38 CHECK_LOCKFILE([lock_multiple], [0],
39 [lockfile|WARN|.a.~lock~: failed to lock file: Resource deadlock avoided
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
49 CHECK_LOCKFILE([lock_symlink_to_dir], [0],
50 [lockfile|WARN|dir/.b.~lock~: failed to lock file: Resource deadlock avoided