fstests: new testcases for delegation support
v2 cover fstests: new testcases for delegation support
This version of the patchset does a bit of cleanup first, adds a directory delegation test and then a set of tests for file delegations.
Christian has taken the initial directory delegation series into his vfs-6.19.directory.delegations branch [1]. There is a follow-on set of patches to fix some bugs as well [2].
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/log/?h=vfs-6.19.directory.delegations
[2]: https://lore.kernel.org/linux-fsdevel/[email protected]/
---
Changes in v2:
- Add tests for file delegations
- Clean up after testing whether leases are supported
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Jeff Layton (3):
common/rc: clean up after the _require_test_fcntl_setlease() test
generic: add test for directory delegations
generic: add tests for file delegations
common/locktest | 19 +- common/rc | 11 + src/locktest.c | 621 +++++++++++++++++++++++++++++++++++++++++++++++++- tests/generic/998 | 22 ++ tests/generic/998.out | 2 + tests/generic/999 | 22 ++ tests/generic/999.out | 2 + 7 files changed, 684 insertions(+), 15 deletions(-)
---
base-commit: 5b75444bc9123f261e0aa95f72328af4c827786a
change-id: 20251111-dir-deleg-ff05013ca540
Best regards,
Signature · 1 line
Jeff Layton <[email protected]>
PATCH v2 1/3 common/rc: clean up after the _require_test_fcntl_setlease() test
Remove setlease_testfile after validating whether a lease can be set.
--- common/rc | 1 + 1 file changed, 1 insertion(+)
common/rc +1 -0
@@ -4656,6 +4656,7 @@ _require_test_fcntl_setlease() touch $TEST_DIR/setlease_testfile $here/src/locktest -t $TEST_DIR/setlease_testfile >/dev/null 2>&1 local ret=$? + rm -f $TEST_DIR/setlease_testfile [ $ret -eq 22 ] && _notrun "Require fcntl setlease support" [ "$FSTYP" == "nfs" -a $ret -eq 11 ] && \ _notrun "NFS requires delegation before setlease"
Signature · 1 line
2.51.1
PATCH v2 2/3 generic: add test for directory delegations
In reply to Jeff LaytonWith the advent of directory delegation support coming to the kernel, add support for testing them to the existing locktest.c program, and add testcases for all of the different ways that they can be broken.
--- common/locktest | 14 +- common/rc | 10 ++ src/locktest.c | 423 ++++++++++++++++++++++++++++++++++++++++++++++++-- tests/generic/999 | 22 +++ tests/generic/999.out | 2 + 5 files changed, 456 insertions(+), 15 deletions(-)
common/locktest +11 -3
@@ -6,6 +6,7 @@ SERVER_LOG=$TEST_DIR/server.out SERVER_PORT=$TEST_DIR/server.port CLIENT_LOG=$TEST_DIR/client.out TESTFILE=$TEST_DIR/lock_file +DELEGDIR=$TEST_DIR/dirdeleg client_pid="" server_pid=""
@@ -13,7 +14,7 @@ _cleanup() { kill $client_pid > /dev/null 2>&1 kill $server_pid > /dev/null 2>&1 - rm -f $TESTFILE + rm -rf $TESTFILE $DELEGDIR } _dump_logs_fail()
@@ -42,8 +43,6 @@ _run_generic() { rm -f $CLIENT_LOG touch $CLIENT_LOG - touch $TESTFILE - # Start the server $here/src/locktest $mode $TESTFILE 2> $SERVER_LOG 1> $SERVER_PORT & server_pid=$!
@@ -87,9 +86,18 @@ _run_generic() { } _run_locktest() { + touch $TESTFILE + _run_generic "" } _run_leasetest() { + touch $TESTFILE + _run_generic "-L" } + +_run_dirleasetest() { + TESTFILE=$DELEGDIR + _run_generic "-D" +}
common/rc +10 -0
@@ -4662,6 +4662,16 @@ _require_test_fcntl_setlease() _notrun "NFS requires delegation before setlease" } +_require_test_fcntl_setdeleg() +{ + _require_test_program "locktest" + mkdir $TEST_DIR/setdeleg_testdir + $here/src/locktest -t -D $TEST_DIR/setdeleg_testdir >/dev/null 2>&1 + local ret=$? + rm -rf $TEST_DIR/setdeleg_testdir + [ $ret -eq 22 ] && _notrun "Require fcntl setdeleg support" +} + _require_ofd_locks() { # Give a test run by getlk wrlck on testfile.
src/locktest.c +411 -12
569 lines not on this page · raw message
tests/generic/999 new file +22 -0
@@ -0,0 +1,22 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2019 Intel, Corp. All Rights Reserved. +# +# FSQA Test No. XXX +# +# lease test +# +. ./common/preamble +_begin_fstest auto quick + +# Import common functions. +. ./common/filter +. ./common/locktest + +_require_test +_require_test_fcntl_advisory_locks +_require_test_fcntl_setdeleg + +_run_dirleasetest + +exit
tests/generic/999.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 999 +success!
Signature · 1 line
2.51.1
Re: [PATCH fstests v2 2/3] generic: add test for directory delegations
Quoted 6 lines · Jeff Layton
With the advent of directory delegation support coming to the kernel, add support for testing them to the existing
locktest.cprogram, and add testcases for all of the different ways that they can be broken.Signed-off-by Jeff Layton <[email protected]>---
Hi Jeff,
Glad to get you patches to fstests again :)
Quoted 7 lines
common/locktest | 14 +- common/rc | 10 ++ src/locktest.c | 423 ++++++++++++++++++++++++++++++++++++++++++++++++-- tests/generic/999 | 22 +++ tests/generic/999.out | 2 + 5 files changed, 456 insertions(+), 15 deletions(-)
[snip]
tests/generic/999 line 5
Quoted 11 lines
tests/generic/999 new file +5
-0@@ -0,0 +1,22 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2019 Intel, Corp. All Rights Reserved. +# +# FSQA Test No. XXX
FS QA Test No. 999
Please don't change the format which xfstests/new generate. Other script (e.g. tools/mvtest) depends on that :)
Quoted 7 lines
tests/generic/999 new file +7
-0+# +# lease test +# +. ./common/preamble +_begin_fstest auto quick + +# Import common functions.
tests/generic/999 line 22
Quoted 10 lines
tests/generic/999 new file +10
-0+. ./common/filter +. ./common/locktest + +_require_test +_require_test_fcntl_advisory_locks +_require_test_fcntl_setdeleg + +_run_dirleasetest + +exit
_exit 0
Oh, I guess you didn't use ./new to create this test case, you copied it from g/131 or g/571. I'd recommend using ./new to create a new test case :)
Quoted 13 lines
tests/generic/999.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 999 +success!Signature · 2 lines
-- 2.51.1
PATCH v2 3/3 generic: add tests for file delegations
In reply to Jeff LaytonMostly the same ones as leases, but some additional tests to validate that they are broken on metadata changes.
--- common/locktest | 5 ++ src/locktest.c | 202 +++++++++++++++++++++++++++++++++++++++++++++++++- tests/generic/998 | 22 ++++++ tests/generic/998.out | 2 + 4 files changed, 229 insertions(+), 2 deletions(-)
common/locktest +5 -0
@@ -101,3 +101,8 @@ _run_dirleasetest() { TESTFILE=$DELEGDIR _run_generic "-D" } + +_run_filedelegtest() { + TESTFILE=$DELEGDIR + _run_generic "-F" +}
src/locktest.c +200 -2
268 lines not on this page · raw message
tests/generic/998 new file +22 -0
@@ -0,0 +1,22 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2019 Intel, Corp. All Rights Reserved. +# +# FSQA Test No. XXX +# +# file delegation test +# +. ./common/preamble +_begin_fstest auto quick + +# Import common functions. +. ./common/filter +. ./common/locktest + +_require_test +_require_test_fcntl_advisory_locks +_require_test_fcntl_setdeleg + +_run_filedelegtest + +exit
tests/generic/998.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 998 +success!
Signature · 1 line
2.51.1
Re: [PATCH fstests v2 3/3] generic: add tests for file delegations
Quoted 11 lines · Jeff Layton
Mostly the same ones as leases, but some additional tests to validate that they are broken on metadata changes.
Signed-off-by Jeff Layton <[email protected]>--- common/locktest | 5 ++ src/locktest.c | 202 +++++++++++++++++++++++++++++++++++++++++++++++++- tests/generic/998 | 22 ++++++ tests/generic/998.out | 2 + 4 files changed, 229 insertions(+), 2 deletions(-)
[snip]
Quoted 6 lines
tests/generic/998 new file +0
-0
tests/generic/998 line 10
Quoted 10 lines
tests/generic/998 new file +10
-0@@ -0,0 +1,22 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2019 Intel, Corp. All Rights Reserved. +# +# FSQA Test No. XXX +# +# file delegation test +# +. ./common/preamble +_begin_fstest auto quick
Same review points with patch 2/3. And I'm wondering if we these common/locktest related test cases should be in "locks" (refer to doc/group-names.txt) group.
Thanks,
Zorro
Quoted 25 lines
tests/generic/998 new file +12
-0+ +# Import common functions. +. ./common/filter +. ./common/locktest + +_require_test +_require_test_fcntl_advisory_locks +_require_test_fcntl_setdeleg + +_run_filedelegtest + +exittests/generic/998.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 998 +success!Signature · 2 lines
-- 2.51.1