Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/lockf/tests/lockf_test.sh
| Show First 20 Lines • Show All 322 Lines • ▼ Show 20 Lines | wrlock_body() | ||||
| # Demonstrate that we can lock the file normally, but -w fails if we | # Demonstrate that we can lock the file normally, but -w fails if we | ||||
| # can't write. | # can't write. | ||||
| atf_check lockf -kt 0 "testlock" sleep 0 | atf_check lockf -kt 0 "testlock" sleep 0 | ||||
| atf_check -s exit:${EX_CANTCREAT} -e not-empty \ | atf_check -s exit:${EX_CANTCREAT} -e not-empty \ | ||||
| lockf -wt 0 "testlock" sleep 0 | lockf -wt 0 "testlock" sleep 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_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 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. | |||||
| atf_add_test_case fdlockspin | |||||
| } | } | ||||
The list of test cases is sorted alphabetically.