Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/lockf/tests/lockf_test.sh
| Show First 20 Lines • Show All 171 Lines • ▼ Show 20 Lines | fdlock_body() | ||||
| wait "$lpid2" | wait "$lpid2" | ||||
| status2=$? | status2=$? | ||||
| atf_check test "$status1" -eq 0 | atf_check test "$status1" -eq 0 | ||||
| atf_check test "$status2" -eq 0 | 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 | atf_test_case keep | ||||
| keep_body() | keep_body() | ||||
| { | { | ||||
| lockf -k "testlock" sleep 10 & | lockf -k "testlock" sleep 10 & | ||||
| lpid=$! | lpid=$! | ||||
| # Make sure that the lock exists now... | # Make sure that the lock exists now... | ||||
| while ! test -e "testlock"; do | while ! test -e "testlock"; do | ||||
| ▲ Show 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| atf_init_test_cases() | atf_init_test_cases() | ||||
| { | { | ||||
| atf_add_test_case badargs | atf_add_test_case badargs | ||||
| atf_add_test_case basic | atf_add_test_case basic | ||||
| atf_add_test_case bubble_error | atf_add_test_case bubble_error | ||||
| atf_add_test_case fdlock | atf_add_test_case fdlock | ||||
| atf_add_test_case fdlockspin | |||||
| atf_add_test_case keep | atf_add_test_case keep | ||||
| atf_add_test_case needfile | atf_add_test_case needfile | ||||
| atf_add_test_case termchild | atf_add_test_case termchild | ||||
| atf_add_test_case timeout | atf_add_test_case timeout | ||||
| atf_add_test_case writepid | atf_add_test_case writepid | ||||
| atf_add_test_case writepid_keep | atf_add_test_case writepid_keep | ||||
| atf_add_test_case wrlock | atf_add_test_case wrlock | ||||
markj: The list of test cases is sorted alphabetically. | |||||
| } | } | ||||
The list of test cases is sorted alphabetically.