mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 04:36:52 -10:00
lockf: Test that lockf does not spin on fd
PR: 294832
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D56723
(cherry picked from commit 0733afdb4d)
This commit is contained in:
1 parent
2052d09b7a
commit
bafb055ab1
1 file changed
+18
@@ -150,6 +150,23 @@ fdlock_body()
|
||||
atf_check test "$status2" -eq 0
|
||||
}
|
||||
|
||||
atf_test_case fdlockspin
|
||||
fdlockspin_head()
|
||||
{
|
||||
atf_set "descr" "Don't spin when locking a file descriptor"
|
||||
}
|
||||
fdlockspin_body()
|
||||
{
|
||||
# Start background locker and give it time to get settled
|
||||
lockf foo sleep 2 & sleep 1
|
||||
# Start foreground locker in fdlock mode
|
||||
atf_check ktrace -tc lockf -t 3 0 <foo
|
||||
# Background locker quit and foreground locker succeeded
|
||||
atf_check -o save:trace kdump -tc
|
||||
# Check how many times foreground locker called flock()
|
||||
atf_check -o inline:"2\n" egrep -c 'CALL +flock' trace
|
||||
}
|
||||
|
||||
atf_test_case keep
|
||||
keep_body()
|
||||
{
|
||||
@@ -232,6 +249,7 @@ atf_init_test_cases()
|
||||
atf_add_test_case badargs
|
||||
atf_add_test_case basic
|
||||
atf_add_test_case fdlock
|
||||
atf_add_test_case fdlockspin
|
||||
atf_add_test_case keep
|
||||
atf_add_test_case needfile
|
||||
atf_add_test_case timeout
|
||||
|
||||
Reference in new issue
Block a user