FS/XFS testing framework
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Zorro Lang <zlang@kernel.org>
Cc: "Darrick J . Wong " <djwong@kernel.org>,
	linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH 2/5] xfs/263: split out the v4 test
Date: Thu, 18 Apr 2024 09:40:43 +0200	[thread overview]
Message-ID: <20240418074046.2326450-3-hch@lst.de> (raw)
In-Reply-To: <20240418074046.2326450-1-hch@lst.de>

Move the v4-specific test into a separate test case so that we can still
run the tests on a kernel without v4 support.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/xfs/096     | 73 ++++++++++++++++++++++++++++++++++++++++
 tests/xfs/096.out | 84 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/263     |  5 ---
 tests/xfs/263.out | 85 -----------------------------------------------
 4 files changed, 157 insertions(+), 90 deletions(-)
 create mode 100755 tests/xfs/096
 create mode 100644 tests/xfs/096.out

diff --git a/tests/xfs/096 b/tests/xfs/096
new file mode 100755
index 000000000..7eff6cb1d
--- /dev/null
+++ b/tests/xfs/096
@@ -0,0 +1,73 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2016 Red Hat, Inc.  All Rights Reserved.
+#
+# FS QA Test 096
+#
+# test xfs_quota state command (XFS v4 version)
+#
+. ./common/preamble
+_begin_fstest auto quick quota
+
+# Import common functions.
+. ./common/filter
+. ./common/quota
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs xfs
+
+_require_scratch
+_require_xfs_quota
+
+function option_string()
+{
+	VAL=$1
+	# Treat 3 options as a bit field, prjquota|grpquota|usrquota
+	OPT="rw"
+	if [ "$((VAL & 4))" -ne "0" ]; then OPT=prjquota,${OPT}; fi;
+	if [ "$((VAL & 2))" -ne "0" ]; then OPT=grpquota,${OPT}; fi;
+	if [ "$((VAL & 1))" -ne "0" ]; then OPT=usrquota,${OPT}; fi;
+	echo $OPT
+}
+
+filter_quota_state() {
+	sed -e 's/Inode: #[0-9]\+/Inode #XXX/g' \
+	    -e '/max warnings:/d' \
+	    -e '/Blocks grace time:/d' \
+	    -e '/Inodes grace time:/d' \
+		| _filter_scratch
+}
+
+filter_quota_state2() {
+	sed -e '/User quota state on/d' \
+	    -e '/ Accounting: /d' \
+	    -e '/ Enforcement: /d' \
+	    -e '/ Inode: /d' \
+	    -e '/Blocks max warnings: /d' \
+	    -e '/Inodes max warnings: /d' \
+		| _filter_scratch
+}
+
+function test_all_state()
+{
+	for I in `seq 0 7`; do
+		OPTIONS=`option_string $I`
+		echo "== Options: $OPTIONS =="
+		# Some combinations won't mount on V4 supers (grp + prj)
+		_qmount_option "$OPTIONS"
+		_try_scratch_mount &>> $seqres.full || continue
+		$XFS_QUOTA_PROG -x -c "state -u" $SCRATCH_MNT | filter_quota_state
+		$XFS_QUOTA_PROG -x -c "state -g" $SCRATCH_MNT | filter_quota_state
+		$XFS_QUOTA_PROG -x -c "state -p" $SCRATCH_MNT | filter_quota_state
+		$XFS_QUOTA_PROG -x -c "state -u" $SCRATCH_MNT | filter_quota_state2
+		_scratch_unmount
+	done
+}
+
+_scratch_mkfs_xfs "-m crc=0 -n ftype=0" >> $seqres.full
+test_all_state
+
+status=0
+exit
diff --git a/tests/xfs/096.out b/tests/xfs/096.out
new file mode 100644
index 000000000..1deb7a8c3
--- /dev/null
+++ b/tests/xfs/096.out
@@ -0,0 +1,84 @@
+QA output created by 096
+== Options: rw ==
+== Options: usrquota,rw ==
+User quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: ON
+  Enforcement: ON
+  Inode #XXX (1 blocks, 1 extents)
+Group quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: OFF
+  Enforcement: OFF
+  Inode: N/A
+Project quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: OFF
+  Enforcement: OFF
+  Inode: N/A
+Blocks grace time: [7 days]
+Inodes grace time: [7 days]
+Realtime Blocks grace time: [7 days]
+== Options: grpquota,rw ==
+User quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: OFF
+  Enforcement: OFF
+  Inode #XXX (1 blocks, 1 extents)
+Group quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: ON
+  Enforcement: ON
+  Inode #XXX (1 blocks, 1 extents)
+Project quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: OFF
+  Enforcement: OFF
+  Inode: N/A
+Blocks grace time: [7 days]
+Inodes grace time: [7 days]
+Realtime Blocks grace time: [7 days]
+== Options: usrquota,grpquota,rw ==
+User quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: ON
+  Enforcement: ON
+  Inode #XXX (1 blocks, 1 extents)
+Group quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: ON
+  Enforcement: ON
+  Inode #XXX (1 blocks, 1 extents)
+Project quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: OFF
+  Enforcement: OFF
+  Inode: N/A
+Blocks grace time: [7 days]
+Inodes grace time: [7 days]
+Realtime Blocks grace time: [7 days]
+== Options: prjquota,rw ==
+User quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: OFF
+  Enforcement: OFF
+  Inode #XXX (1 blocks, 1 extents)
+Group quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: OFF
+  Enforcement: OFF
+  Inode: N/A
+Project quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: ON
+  Enforcement: ON
+  Inode #XXX (1 blocks, 1 extents)
+Blocks grace time: [7 days]
+Inodes grace time: [7 days]
+Realtime Blocks grace time: [7 days]
+== Options: usrquota,prjquota,rw ==
+User quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: ON
+  Enforcement: ON
+  Inode #XXX (1 blocks, 1 extents)
+Group quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: OFF
+  Enforcement: OFF
+  Inode: N/A
+Project quota state on SCRATCH_MNT (SCRATCH_DEV)
+  Accounting: ON
+  Enforcement: ON
+  Inode #XXX (1 blocks, 1 extents)
+Blocks grace time: [7 days]
+Inodes grace time: [7 days]
+Realtime Blocks grace time: [7 days]
+== Options: grpquota,prjquota,rw ==
+== Options: usrquota,grpquota,prjquota,rw ==
diff --git a/tests/xfs/263 b/tests/xfs/263
index bd30dab11..54e9355aa 100755
--- a/tests/xfs/263
+++ b/tests/xfs/263
@@ -66,11 +66,6 @@ function test_all_state()
 	done
 }
 
-echo "==== NO CRC ===="
-_scratch_mkfs_xfs "-m crc=0 -n ftype=0" >> $seqres.full
-test_all_state
-
-echo "==== CRC ===="
 _scratch_mkfs_xfs "-m crc=1" >>$seqres.full
 test_all_state
 
diff --git a/tests/xfs/263.out b/tests/xfs/263.out
index 531d45de5..64c1a5876 100644
--- a/tests/xfs/263.out
+++ b/tests/xfs/263.out
@@ -1,89 +1,4 @@
 QA output created by 263
-==== NO CRC ====
-== Options: rw ==
-== Options: usrquota,rw ==
-User quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: ON
-  Enforcement: ON
-  Inode #XXX (1 blocks, 1 extents)
-Group quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: OFF
-  Enforcement: OFF
-  Inode: N/A
-Project quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: OFF
-  Enforcement: OFF
-  Inode: N/A
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
-== Options: grpquota,rw ==
-User quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: OFF
-  Enforcement: OFF
-  Inode #XXX (1 blocks, 1 extents)
-Group quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: ON
-  Enforcement: ON
-  Inode #XXX (1 blocks, 1 extents)
-Project quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: OFF
-  Enforcement: OFF
-  Inode: N/A
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
-== Options: usrquota,grpquota,rw ==
-User quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: ON
-  Enforcement: ON
-  Inode #XXX (1 blocks, 1 extents)
-Group quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: ON
-  Enforcement: ON
-  Inode #XXX (1 blocks, 1 extents)
-Project quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: OFF
-  Enforcement: OFF
-  Inode: N/A
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
-== Options: prjquota,rw ==
-User quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: OFF
-  Enforcement: OFF
-  Inode #XXX (1 blocks, 1 extents)
-Group quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: OFF
-  Enforcement: OFF
-  Inode: N/A
-Project quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: ON
-  Enforcement: ON
-  Inode #XXX (1 blocks, 1 extents)
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
-== Options: usrquota,prjquota,rw ==
-User quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: ON
-  Enforcement: ON
-  Inode #XXX (1 blocks, 1 extents)
-Group quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: OFF
-  Enforcement: OFF
-  Inode: N/A
-Project quota state on SCRATCH_MNT (SCRATCH_DEV)
-  Accounting: ON
-  Enforcement: ON
-  Inode #XXX (1 blocks, 1 extents)
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
-== Options: grpquota,prjquota,rw ==
-== Options: usrquota,grpquota,prjquota,rw ==
-==== CRC ====
 == Options: rw ==
 == Options: usrquota,rw ==
 User quota state on SCRATCH_MNT (SCRATCH_DEV)
-- 
2.39.2


  parent reply	other threads:[~2024-04-18  7:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-18  7:40 fix kernels without v5 support v2 Christoph Hellwig
2024-04-18  7:40 ` [PATCH 1/5] xfs/045: don't force v4 file systems Christoph Hellwig
2024-04-18 14:55   ` Darrick J. Wong
2024-04-18  7:40 ` Christoph Hellwig [this message]
2024-04-18 14:55   ` [PATCH 2/5] xfs/263: split out the v4 test Darrick J. Wong
2024-04-18  7:40 ` [PATCH 3/5] xfs/512: split out v4 specific tests Christoph Hellwig
2024-04-18 14:56   ` Darrick J. Wong
2024-04-18 15:00     ` Christoph Hellwig
2024-04-18  7:40 ` [PATCH 4/5] xfs/{158,160}: split out v4 tests Christoph Hellwig
2024-04-18 15:00   ` Darrick J. Wong
2024-04-18  7:40 ` [PATCH 5/5] xfs: don't run tests that require v4 file systems when not supported Christoph Hellwig
2024-04-18 15:02   ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240418074046.2326450-3-hch@lst.de \
    --to=hch@lst.de \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=zlang@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox