2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-29 15:28:56 +00:00
Files
openvswitch/tests/lockfile.at
Ben Pfaff 45f1a0d993 lockfile: Log more helpful message when locking fails due to a conflict.
Reported-by: rahim entezari <rahim.entezari@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2012-08-31 10:11:15 -07:00

52 lines
1.8 KiB
Plaintext

AT_BANNER([lockfile unit tests])
m4_define([CHECK_LOCKFILE],
[AT_SETUP([m4_translit([$1], [_], [ ])])
AT_KEYWORDS([lockfile])
AT_CHECK([test-lockfile $1], [0], [$1: success (m4_if(
[$2], [1], [$2 child], [$2 children]))
], [stderr])
AT_CHECK([sed 's/pid [[0-9]]*/pid <pid>/' stderr], [0], [$3])
AT_CLEANUP])
CHECK_LOCKFILE([lock_and_unlock], [0])
CHECK_LOCKFILE([lock_and_unlock_twice], [0])
CHECK_LOCKFILE([lock_blocks_same_process], [0],
[lockfile|WARN|.file.~lock~: failed to lock file: Resource deadlock avoided
])
CHECK_LOCKFILE([lock_blocks_same_process_twice], [0],
[lockfile|WARN|.file.~lock~: failed to lock file: Resource deadlock avoided
lockfile|WARN|.file.~lock~: failed to lock file: Resource deadlock avoided
])
CHECK_LOCKFILE([lock_blocks_other_process], [1],
[lockfile|WARN|.file.~lock~: child does not inherit lock
lockfile|WARN|.file.~lock~: cannot lock file because it is already locked by pid <pid>
])
CHECK_LOCKFILE([lock_twice_blocks_other_process], [1],
[lockfile|WARN|.file.~lock~: failed to lock file: Resource deadlock avoided
lockfile|WARN|.file.~lock~: child does not inherit lock
lockfile|WARN|.file.~lock~: cannot lock file because it is already locked by pid <pid>
])
CHECK_LOCKFILE([lock_and_unlock_allows_other_process], [1])
CHECK_LOCKFILE([lock_multiple], [0],
[lockfile|WARN|.a.~lock~: failed to lock file: Resource deadlock avoided
])
CHECK_LOCKFILE([lock_symlink], [0],
[lockfile|WARN|.a.~lock~: failed to lock file: Resource deadlock avoided
lockfile|WARN|.b.~lock~: failed to lock file: Resource deadlock avoided
lockfile|WARN|.b.~lock~: failed to lock file: Resource deadlock avoided
lockfile|WARN|.a.~lock~: failed to lock file: Resource deadlock avoided
])
CHECK_LOCKFILE([lock_symlink_to_dir], [0],
[lockfile|WARN|dir/.b.~lock~: failed to lock file: Resource deadlock avoided
])