]> git.proxmox.com Git - ovs.git/blob - tests/lockfile.at
dpif-netdev: Incremental addition/deletion of PMD threads.
[ovs.git] / tests / lockfile.at
1 AT_BANNER([lockfile unit tests])
2
3 # CHECK_LOCKFILE([test-name], [number-children], [error-message]
4 # [skip-test-windows])
5 m4_define([CHECK_LOCKFILE],
6 [AT_SETUP([m4_translit([$1], [_], [ ])])
7 m4_if([$4], [yes], [AT_SKIP_IF([test "$IS_WIN32" = "yes"])])
8 AT_KEYWORDS([lockfile])
9 AT_CHECK([ovstest test-lockfile $1], [0], [$1: success (m4_if(
10 [$2], [1], [$2 child], [$2 children]))
11 ], [stderr])
12 AT_CHECK([sed 's/pid [[0-9]]*/pid <pid>/' stderr], [0], [$3])
13 AT_CLEANUP])
14
15 CHECK_LOCKFILE([lock_and_unlock], [0])
16
17 CHECK_LOCKFILE([lock_and_unlock_twice], [0])
18
19 CHECK_LOCKFILE([lock_blocks_same_process], [0],
20 [lockfile|WARN|.file.~lock~: cannot lock file because this process has already locked it
21 ])
22
23 CHECK_LOCKFILE([lock_blocks_same_process_twice], [0],
24 [lockfile|WARN|.file.~lock~: cannot lock file because this process has already locked it
25 lockfile|WARN|.file.~lock~: cannot lock file because this process has already locked it
26 ])
27
28 CHECK_LOCKFILE([lock_blocks_other_process], [1],
29 [lockfile|WARN|.file.~lock~: child does not inherit lock
30 lockfile|WARN|.file.~lock~: cannot lock file because it is already locked by pid <pid>
31 ], [yes])
32
33 CHECK_LOCKFILE([lock_twice_blocks_other_process], [1],
34 [lockfile|WARN|.file.~lock~: cannot lock file because this process has already locked it
35 lockfile|WARN|.file.~lock~: child does not inherit lock
36 lockfile|WARN|.file.~lock~: cannot lock file because it is already locked by pid <pid>
37 ], [yes])
38
39 CHECK_LOCKFILE([lock_and_unlock_allows_other_process], [1], [], [yes])
40
41 CHECK_LOCKFILE([lock_multiple], [0],
42 [lockfile|WARN|.a.~lock~: cannot lock file because this process has already locked it
43 ])
44
45 CHECK_LOCKFILE([lock_symlink], [0],
46 [lockfile|WARN|.a.~lock~: cannot lock file because this process has already locked it
47 lockfile|WARN|.b.~lock~: cannot lock file because this process has already locked it
48 lockfile|WARN|.b.~lock~: cannot lock file because this process has already locked it
49 lockfile|WARN|.a.~lock~: cannot lock file because this process has already locked it
50 ], [yes])
51
52 CHECK_LOCKFILE([lock_symlink_to_dir], [0],
53 [lockfile|WARN|dir/.b.~lock~: cannot lock file because this process has already locked it
54 ], [yes])