Skip to contentSkip to conversation

generic: add test for directory delegations

PATCH Superseded Jeff Layton 1 participant 1 message Nov 11, 2025 VFS

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 generic: add test for directory delegations

With 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.

---
Latest upstream posting of the dir delegation patchset is:

https://lore.kernel.org/linux-nfs/[email protected]/

---
 common/locktest       |  14 +-
 src/locktest.c        | 429 ++++++++++++++++++++++++++++++++++++++++++++++++--
 tests/generic/999     |  22 +++
 tests/generic/999.out |   2 +
 4 files changed, 452 insertions(+), 15 deletions(-)
common/locktest +11 -3
index 61e7dd42785dd3d4f21050e10bd5ec9d76a3b15a..f9ac56c5e71f7e0cccf1ee6af19ed74fc349124a 100644
@@ -13,7 +13,7 @@ _cleanup()
 {
 	kill $client_pid > /dev/null 2>&1
 	kill $server_pid > /dev/null 2>&1
-	rm -f $TESTFILE
+	rm -rf $TESTFILE
 }
 
 _dump_logs_fail()
@@ -42,8 +42,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 +85,19 @@ _run_generic() {
 }
 
 _run_locktest() {
+	touch $TESTFILE
+
 	_run_generic ""
 }
 
 _run_leasetest() {
+	touch $TESTFILE
+
 	_run_generic "-L"
 }
+
+_run_dirleasetest() {
+	TESTFILE=$TEST_DIR/lease_dir
+	mkdir -p $TESTFILE
+	_run_generic "-D -d"
+}
src/locktest.c +417 -12

575 lines not on this page · raw message

tests/generic/999 new file +22 -0
new file mode 100755
index 0000000000000000000000000000000000000000..146ad0bc2e12fa4c41f627bd038562d62576227c
@@ -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_setlease
+
+_run_dirleasetest
+
+exit
tests/generic/999.out new file +2 -0
new file mode 100644
index 0000000000000000000000000000000000000000..c2a252d46cdcd730cf1ed2c503fa9631e9fcdd06
@@ -0,0 +1,2 @@
+QA output created by 999
+success!

---
base-commit: 911e9f16800437cc96349f85c6c916c9d8c2d317
change-id: 20251111-dir-deleg-ff05013ca540

Best regards,

Signature · 1 line
Jeff Layton <[email protected]>