Skip to contentSkip to conversation

shared,ext4: move ext4-specific tests out of shared/

PATCH In review Theodore Ts'o 2 participants 8 messages Jun 28, 2019 – Jul 7, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/5 shared,ext4: move ext4-specific tests out of shared/

The tests shared/{001,003,004,272} test behaviour around the ext4's journal. As such, they are pointless to run on ext2, and ext3 no longer is in kernels newer than 4.3. (And most enterprise distributions have been using ext4 to support the ext3 file system; that capability has been around since 2.6.33.) So we can move these tests out of shared and into the ext4 class of tests:

	shared/001 --> ext4/036
	shared/003 --> ext4/037
	shared/004 --> ext4/038
	shared/272 --> ext4/039

---
Changes since v1:
- Adjusted _supported_fs lines

 tests/{shared/001 => ext4/036}         | 6 +++---
 tests/ext4/036.out                     | 2 ++
 tests/{shared/003 => ext4/037}         | 6 ++----
 tests/ext4/037.out                     | 2 ++
 tests/{shared/004 => ext4/038}         | 4 ++--
 tests/ext4/038.out                     | 2 ++
 tests/{shared/272 => ext4/039}         | 2 +-
 tests/{shared/272.out => ext4/039.out} | 2 +-
 tests/ext4/group                       | 4 ++++
 tests/shared/001.out                   | 2 --
 tests/shared/003.out                   | 2 --
 tests/shared/004.out                   | 2 --
 tests/shared/group                     | 4 ----
 13 files changed, 19 insertions(+), 21 deletions(-)
 rename tests/{shared/001 => ext4/036} (90%)
 create mode 100644 tests/ext4/036.out
 rename tests/{shared/003 => ext4/037} (93%)
 create mode 100644 tests/ext4/037.out
 rename tests/{shared/004 => ext4/038} (94%)
 create mode 100644 tests/ext4/038.out
 rename tests/{shared/272 => ext4/039} (97%)
 rename tests/{shared/272.out => ext4/039.out} (72%)
 delete mode 100644 tests/shared/001.out
 delete mode 100644 tests/shared/003.out
 delete mode 100644 tests/shared/004.out
tests/ext4/036 renamed from tests/shared/001 +3 -3
similarity index 90%
rename from tests/shared/001
rename to tests/ext4/036
index bde6e198..08a5e64e 100755
@@ -2,9 +2,9 @@
 # SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2015 Red Hat Inc.  All Rights Reserved.
 #
-# FS QA Test No. 001
+# FS QA Test No. ext4/036 (was shared/001)
 #
-# Test truncate orphan inodes when mounting extN.
+# Test truncate orphan inodes when mounting ext4
 # ext4 used to hit WARNING, this commit fixed the issue
 #
 # 721e3eb ext4: lock i_mutex when truncating orphan inodes
@@ -29,7 +29,7 @@ _cleanup()
 . ./common/filter
 
 # real QA test starts here
-_supported_fs ext2 ext3 ext4
+_supported_fs ext3 ext4
 _supported_os Linux
 _require_scratch
 
tests/ext4/036.out new file +2 -0
new file mode 100644
index 00000000..ed460d98
@@ -0,0 +1,2 @@
+QA output created by 036
+Silence is golden
tests/ext4/037 renamed from tests/shared/003 +2 -4
similarity index 93%
rename from tests/shared/003
rename to tests/ext4/037
index 761b9691..33c46e13 100755
@@ -2,15 +2,13 @@
 # SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2015 Red Hat Inc.  All Rights Reserved.
 #
-# FS QA Test 003
+# FS QA Test ext4/037 (was shared/003)
 #
 # Test mount a needs_recovery partition with noload option.
 # ext4 used to Oops until part of this commit:
 #
 # 744692d ext4: use ext4_get_block_write in buffer write
 #
-# Also test on ext2/3.
-#
 seq=`basename $0`
 seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
@@ -31,7 +29,7 @@ _cleanup()
 . ./common/filter
 
 # real QA test starts here
-_supported_fs ext2 ext3 ext4
+_supported_fs ext3 ext4
 _supported_os Linux
 
 # nofsck as we modify sb via debugfs
tests/ext4/037.out new file +2 -0
new file mode 100644
index 00000000..5c3a30a4
@@ -0,0 +1,2 @@
+QA output created by 037
+Silence is golden
tests/ext4/038 renamed from tests/shared/004 +2 -2
similarity index 94%
rename from tests/shared/004
rename to tests/ext4/038
index 3021c85d..b8f52b5a 100755
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2016 Fujitsu.  All Rights Reserved.
 #
-# FS QA Test 004
+# FS QA Test ext4/038 (was shared/004)
 #
 # Regression test for commit:
 # c9eb13a ext4: fix hang when processing corrupted orphaned inode list
@@ -25,7 +25,7 @@ _cleanup()
 . ./common/rc
 
 # real QA test starts here
-_supported_fs ext2 ext3 ext4
+_supported_fs ext3 ext4
 _supported_os Linux
 _require_scratch
 _require_command "$DEBUGFS_PROG" debugfs
tests/ext4/038.out new file +2 -0
new file mode 100644
index 00000000..5e0f13ec
@@ -0,0 +1,2 @@
+QA output created by 038
+Silence is golden
tests/ext4/039 renamed from tests/shared/272 +1 -1
similarity index 97%
rename from tests/shared/272
rename to tests/ext4/039
index b94dfc3c..28db308d 100755
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
 #
-# FSQA Test No. 272
+# FSQA Test No. ext4/039 (was shared/272)
 #
 # Test data journaling flag switch for a single file  
 #
tests/ext4/039.out renamed from tests/shared/272.out +1 -1
similarity index 72%
rename from tests/shared/272.out
rename to tests/ext4/039.out
index a9eaf84c..2c8aabad 100644
@@ -1,3 +1,3 @@
-QA output created by 272
+QA output created by 039
 Switch data journalling mode. Silence is golden.
 Check filesystem
tests/ext4/group +4 -0
index d27ec893..6418d82d 100644
@@ -38,6 +38,10 @@
 033 auto ioctl resize
 034 auto quick quota
 035 auto quick resize
+036 auto quick
+037 auto quick
+038 auto quick
+039 auto enospc rw
 271 auto rw quick
 301 aio auto ioctl rw stress defrag
 302 aio auto ioctl rw stress defrag
tests/shared/001.out deleted +0 -2
deleted file mode 100644
index 88678b8e..00000000
@@ -1,2 +0,0 @@
-QA output created by 001
-Silence is golden
tests/shared/003.out deleted +0 -2
deleted file mode 100644
index 6895fc80..00000000
@@ -1,2 +0,0 @@
-QA output created by 003
-Silence is golden
tests/shared/004.out deleted +0 -2
deleted file mode 100644
index af8614ae..00000000
@@ -1,2 +0,0 @@
-QA output created by 004
-Silence is golden
tests/shared/group +0 -4
index b091d911..6f184946 100644
@@ -3,10 +3,7 @@
 # - do not start group names with a digit
 # - comment line before each group is "new" description
 #
-001 auto quick
 002 auto metadata quick log
-003 auto quick
-004 auto quick
 005 dangerous_fuzzers
 006 auto enospc
 007 dangerous_fuzzers
@@ -15,6 +12,5 @@
 010 auto stress dedupe
 011 auto quick
 032 mkfs auto quick
-272 auto enospc rw
 289 auto quick
 298 auto trim
Signature · 1 line
2.22.0
#1 lore raw

PATCH v2 2/5 check: add ext4 group list when testing ext2 and ext3

Modern kernels use the ext4 implementation to support ext2 and ext3 mounts, and a number of the ext4 tests are actually suitable for ext2 and ext3. We're trying to move tests out of shared anyway, so instead of moving tests from ext4/NNN to shared, let's just include the ext4 group list when FSTYP is ext2 or ext3.

---
Changes since v1:
- none

 check | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
check +5 -1
index 7511e1ce..2a5d8ab1 100755
@@ -130,6 +130,7 @@ get_group_list()
 	local grp=$1
 	local grpl=""
 	local sub=$(dirname $grp)
+	local fsgroup="$FSTYP"
 
 	if [ -n "$sub" -a "$sub" != "." -a -d "$SRC_DIR/$sub" ]; then
 		# group is given as <subdir>/<group> (e.g. xfs/quick)
@@ -138,7 +139,10 @@ get_group_list()
 		return
 	fi
 
-	for d in $SRC_GROUPS $FSTYP; do
+	if [ "$FSTYP" = ext2 -o "$FSTYP" = ext3 ]; then
+	    fsgroup=ext4
+	fi
+	for d in $SRC_GROUPS $fsgroup; do
 		if ! test -d "$SRC_DIR/$d" ; then
 			continue
 		fi
Signature · 1 line
2.22.0
#2 lore raw

PATCH v2 3/5 shared,ext4: move ext[234]-specific tests out of shared/

In reply to Theodore Ts'o

Move the following tests:

	shared/005 --> ext4/040
	shared/007 --> ext4/041
	shared/289 --> ext4/042

---
Changes since v1:
- none

 tests/{shared/005 => ext4/040}         | 2 +-
 tests/{shared/007.out => ext4/040.out} | 2 +-
 tests/{shared/007 => ext4/041}         | 2 +-
 tests/{shared/005.out => ext4/041.out} | 2 +-
 tests/{shared/289 => ext4/042}         | 2 +-
 tests/{shared/289.out => ext4/042.out} | 2 +-
 tests/ext4/group                       | 3 +++
 tests/shared/group                     | 3 ---
 8 files changed, 9 insertions(+), 9 deletions(-)
 rename tests/{shared/005 => ext4/040} (97%)
 rename tests/{shared/007.out => ext4/040.out} (77%)
 rename tests/{shared/007 => ext4/041} (97%)
 rename tests/{shared/005.out => ext4/041.out} (77%)
 rename tests/{shared/289 => ext4/042} (98%)
 rename tests/{shared/289.out => ext4/042.out} (67%)
tests/ext4/040 renamed from tests/shared/005 +1 -1
similarity index 97%
rename from tests/shared/005
rename to tests/ext4/040
index 67940dd0..3e475f7d 100755
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2017 Oracle, Inc.  All Rights Reserved.
 #
-# FSQA Test No. 005
+# FSQA Test No. ext4/040 (was shared/005)
 #
 # Since loff_t is a signed type, it is invalid for a filesystem to load
 # an inode with i_size = -1ULL.  Unfortunately, nobody checks this,
tests/ext4/040.out renamed from tests/shared/007.out +1 -1
similarity index 77%
rename from tests/shared/007.out
rename to tests/ext4/040.out
index 3afba59a..dbccb495 100644
@@ -1,4 +1,4 @@
-QA output created by 007
+QA output created by 040
 Format and mount
 Corrupt filesystem
 Remount, try to append
tests/ext4/041 renamed from tests/shared/007 +1 -1
similarity index 97%
rename from tests/shared/007
rename to tests/ext4/041
index 65cb5273..5c9c0713 100755
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2017 Oracle, Inc.  All Rights Reserved.
 #
-# FSQA Test No. 007
+# FSQA Test No. ext4/041 (was shared/007)
 #
 # Since loff_t is a signed type, it is invalid for a filesystem to load
 # an inode with i_size = -1ULL.  Unfortunately, nobody checks this,
tests/ext4/041.out renamed from tests/shared/005.out +1 -1
similarity index 77%
rename from tests/shared/005.out
rename to tests/ext4/041.out
index 06e3fcdc..97480072 100644
@@ -1,4 +1,4 @@
-QA output created by 005
+QA output created by 041
 Format and mount
 Corrupt filesystem
 Remount, try to append
tests/ext4/042 renamed from tests/shared/289 +1 -1
similarity index 98%
rename from tests/shared/289
rename to tests/ext4/042
index 94b64430..17d482a1 100755
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2012 Red Hat, Inc.  All Rights Reserved.
 #
-# FS QA Test No. 289
+# FS QA Test No. ext4/042 (was shared/289)
 #
 # Test overhead & df output for extN filesystems
 #
tests/ext4/042.out renamed from tests/shared/289.out +1 -1
similarity index 67%
rename from tests/shared/289.out
rename to tests/ext4/042.out
index a4de760a..1bd6f82a 100644
@@ -1,3 +1,3 @@
-QA output created by 289
+QA output created by 042
 minix f_blocks is in range
 bsd f_blocks is in range
tests/ext4/group +3 -0
index 6418d82d..9dfc0d35 100644
@@ -42,6 +42,9 @@
 037 auto quick
 038 auto quick
 039 auto enospc rw
+040 dangerous_fuzzers
+041 dangerous_fuzzers
+042 auto quick
 271 auto rw quick
 301 aio auto ioctl rw stress defrag
 302 aio auto ioctl rw stress defrag
tests/shared/group +0 -3
index 6f184946..3507d7d4 100644
@@ -4,13 +4,10 @@
 # - comment line before each group is "new" description
 #
 002 auto metadata quick log
-005 dangerous_fuzzers
 006 auto enospc
-007 dangerous_fuzzers
 008 auto stress dedupe
 009 auto stress dedupe
 010 auto stress dedupe
 011 auto quick
 032 mkfs auto quick
-289 auto quick
 298 auto trim
Signature · 1 line
2.22.0
#3 lore raw

PATCH v2 4/5 shared,generic: move shared/006 to generic/

In reply to Theodore Ts'o

The shared/006 uses _scratch_mkfs_sized to create a limited size file system, and then creates inodes until it gets ENOSPC, and then checks to make sure the file system is consistent. It then remounts the file system, removes all of the files, and makes sure the file system is consistent afterwards.

This test was marked as only being supported on ext[234] and xfs, and so it was in shared. However, I've tested and this test works just fine on btrfs, ubifs, tmpfs, and should work on all file systems that support _scratch_mkfs_sized, since even if there isn't a fixed inode table, the file system will eventually run out of disk space.

---
Changes since v1:
- added a new _require_scratch_inode_limits and use it for generic/558
- added missing "_supported_fs generic" line

 common/rc                         | 11 +++++++++++
 tests/{shared/006 => generic/558} |  7 +++----
 tests/generic/558.out             |  2 ++
 tests/generic/group               |  1 +
 tests/shared/006.out              |  2 --
 tests/shared/group                |  1 -
 6 files changed, 17 insertions(+), 7 deletions(-)
 rename tests/{shared/006 => generic/558} (95%)
 create mode 100644 tests/generic/558.out
 delete mode 100644 tests/shared/006.out
common/rc +11 -0
index 9165a6f2..8e024f04 100644
@@ -4147,6 +4147,17 @@ _require_scratch_btime()
 	_scratch_unmount
 }
 
+_require_scratch_inode_limits()
+{
+	_require_scratch
+	_scratch_mkfs > /dev/null 2>&1
+	_scratch_mount
+	if [ $(_get_free_inode $SCRATCH_MNT) -eq 0 ]; then
+		_notrun "$FSTYP does not have a fixed number of inodes available"
+	fi
+	_scratch_unmount
+}
+
 _require_filefrag_options()
 {
 	_require_command "$FILEFRAG_PROG" filefrag
tests/generic/558 renamed from tests/shared/006 +3 -4
similarity index 95%
rename from tests/shared/006
rename to tests/generic/558
index aa65e9a2..5807dba3 100755
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2014 Red Hat Inc.  All Rights Reserved.
 #
-# FS QA Test No. shared/006
+# FS QA Test No. generic/558
 #
 # Stress test fs by using up all inodes and check fs.
 #
@@ -42,10 +42,9 @@ create_file()
 . ./common/filter
 
 # real QA test starts here
-_supported_fs ext4 ext3 ext2 xfs
+_supported_fs generic
 _supported_os Linux
-
-_require_scratch
+_require_scratch_inode_limits
 
 rm -f $seqres.full
 echo "Silence is golden"
tests/generic/558.out new file +2 -0
new file mode 100644
index 00000000..9a6c4e79
@@ -0,0 +1,2 @@
+QA output created by 558
+Silence is golden
tests/generic/group +1 -0
index 543c0627..8fc85b63 100644
@@ -560,3 +560,4 @@
 555 auto quick cap
 556 auto quick casefold
 557 auto quick log
+558 auto enospc
tests/shared/006.out deleted +0 -2
deleted file mode 100644
index 675c1b7c..00000000
@@ -1,2 +0,0 @@
-QA output created by 006
-Silence is golden
tests/shared/group +0 -1
index 3507d7d4..2cf910bd 100644
@@ -4,7 +4,6 @@
 # - comment line before each group is "new" description
 #
 002 auto metadata quick log
-006 auto enospc
 008 auto stress dedupe
 009 auto stress dedupe
 010 auto stress dedupe
Signature · 1 line
2.22.0
#4 lore raw

Re: [PATCH v2 4/5] shared,generic: move shared/006 to generic/

Quoted 37 lines · Theodore Ts'o

The shared/006 uses _scratch_mkfs_sized to create a limited size file system, and then creates inodes until it gets ENOSPC, and then checks to make sure the file system is consistent. It then remounts the file system, removes all of the files, and makes sure the file system is consistent afterwards.

This test was marked as only being supported on ext[234] and xfs, and so it was in shared. However, I've tested and this test works just fine on btrfs, ubifs, tmpfs, and should work on all file systems that support _scratch_mkfs_sized, since even if there isn't a fixed inode table, the file system will eventually run out of disk space.

---
Changes since v1:
- added a new _require_scratch_inode_limits and use it for generic/558
- added missing "_supported_fs generic" line

 common/rc                         | 11 +++++++++++
 tests/{shared/006 => generic/558} |  7 +++----
 tests/generic/558.out             |  2 ++
 tests/generic/group               |  1 +
 tests/shared/006.out              |  2 --
 tests/shared/group                |  1 -
 6 files changed, 17 insertions(+), 7 deletions(-)
 rename tests/{shared/006 => generic/558} (95%)
 create mode 100644 tests/generic/558.out
 delete mode 100644 tests/shared/006.out
common/rc +0 -0
index 9165a6f2..8e024f04 100644
@@ -4147,6 +4147,17 @@ _require_scratch_btime()
 	_scratch_unmount
 }
 

common/rc _require_scratch_btime() · line 4159

Quoted 10 lines
common/rc +10 -0
+_require_scratch_inode_limits()
+{
+	_require_scratch
+	_scratch_mkfs > /dev/null 2>&1
+	_scratch_mount
+	if [ $(_get_free_inode $SCRATCH_MNT) -eq 0 ]; then
+		_notrun "$FSTYP does not have a fixed number of inodes available"
+	fi
+	_scratch_unmount
+}

I think testing against $TEST_DIR should be sufficient, so we could avoid the mkfs & mount & umount SCRATCH_DEV time. i.e.

_require_inode_limits()
{
if [ $(_get_free_inode $TEST_DIR) -eq 0 ]; then
_notrun "$FSTYP does not have a fixed number of inodes available"
fi
}

If this looks reasonable, I can fix it on commit.

Thanks,
Eryu

Quoted 73 lines
common/rc +1 -0
+
 _require_filefrag_options()
 {
 	_require_command "$FILEFRAG_PROG" filefrag
tests/generic/558 renamed from tests/shared/006 +3 -4
similarity index 95%
rename from tests/shared/006
rename to tests/generic/558
index aa65e9a2..5807dba3 100755
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2014 Red Hat Inc.  All Rights Reserved.
 #
-# FS QA Test No. shared/006
+# FS QA Test No. generic/558
 #
 # Stress test fs by using up all inodes and check fs.
 #
@@ -42,10 +42,9 @@ create_file()
 . ./common/filter
 
 # real QA test starts here
-_supported_fs ext4 ext3 ext2 xfs
+_supported_fs generic
 _supported_os Linux
-
-_require_scratch
+_require_scratch_inode_limits
 
 rm -f $seqres.full
 echo "Silence is golden"
tests/generic/558.out new file +2 -0
new file mode 100644
index 00000000..9a6c4e79
@@ -0,0 +1,2 @@
+QA output created by 558
+Silence is golden
tests/generic/group +1 -0
index 543c0627..8fc85b63 100644
@@ -560,3 +560,4 @@
 555 auto quick cap
 556 auto quick casefold
 557 auto quick log
+558 auto enospc
tests/shared/006.out deleted +0 -2
deleted file mode 100644
index 675c1b7c..00000000
@@ -1,2 +0,0 @@
-QA output created by 006
-Silence is golden
tests/shared/group +0 -1
index 3507d7d4..2cf910bd 100644
@@ -4,7 +4,6 @@
 # - comment line before each group is "new" description
 #
 002 auto metadata quick log
-006 auto enospc
 008 auto stress dedupe
 009 auto stress dedupe
 010 auto stress dedupe
Signature · 1 line
2.22.0
#5 lore raw

Re: [PATCH v2 4/5] shared,generic: move shared/006 to generic/

Quoted 5 lines · Eryu Guan
Quoted 5 lines
common/rc +5 -0
+_require_scratch_inode_limits()
+{
+	_require_scratch
+	_scratch_mkfs > /dev/null 2>&1
+	_scratch_mount
Quoted 8 lines

common/rc _require_scratch_btime() · line 4159

Quoted 5 lines
common/rc +5 -0
+	if [ $(_get_free_inode $SCRATCH_MNT) -eq 0 ]; then
+		_notrun "$FSTYP does not have a fixed number of inodes available"
+	fi
+	_scratch_unmount
+}

I think testing against $TEST_DIR should be sufficient, so we could avoid the mkfs & mount & umount SCRATCH_DEV time.

I was following the pattern that I saw with other similar _require tests (for example: _require_scratch_shutdown). I *thought* the reason why this is was done is because if the test only uses the SCRATCH_DEV, there's no making it a requirement that TEST_DEV be available --- since IIRC, we do support SCRATCH_DEV being available, but not TEST_DEV.

I personally don't use xfstests in that way --- when I run xfstests, TEST_DEV is always available and in some cases, SCRATCH_DEV won't be present. But I thought that's why _require_test exists --- so that tests can be skipped if TEST_DEV does not exist.

- Ted

#6 lore raw

Re: [PATCH v2 4/5] shared,generic: move shared/006 to generic/

Quoted 22 lines · Theodore Ts'o
Quoted 5 lines · Eryu Guan
Quoted 5 lines
common/rc +5 -0
+_require_scratch_inode_limits()
+{
+	_require_scratch
+	_scratch_mkfs > /dev/null 2>&1
+	_scratch_mount
Quoted 8 lines

common/rc _require_scratch_btime() · line 4159

Quoted 5 lines
common/rc +5 -0
+	if [ $(_get_free_inode $SCRATCH_MNT) -eq 0 ]; then
+		_notrun "$FSTYP does not have a fixed number of inodes available"
+	fi
+	_scratch_unmount
+}

I think testing against $TEST_DIR should be sufficient, so we could avoid the mkfs & mount & umount SCRATCH_DEV time.

I was following the pattern that I saw with other similar _require tests (for example: _require_scratch_shutdown). I *thought* the reason why this is was done is because if the test only uses the SCRATCH_DEV, there's no making it a requirement that TEST_DEV be available --- since IIRC, we do support SCRATCH_DEV being available, but not TEST_DEV.

Quoted 4 lines

I personally don't use xfstests in that way --- when I run xfstests, TEST_DEV is always available and in some cases, SCRATCH_DEV won't be present. But I thought that's why _require_test exists --- so that tests can be skipped if TEST_DEV does not exist.

xfstests assumes TEST_DEV is always present and SCRATCH_DEV is optional (but recommended). _require_test not only checks if TEST_DEV is avaiable & properly mounted but also implies we should do fsck against TEST_DEV after test, as _require_test does "touch ${RESULT_DIR}/require_test" as well.

Regarding to _require_scratch_xxx, that's usually because the requirement being checked might change when mkfs with different options. But a filesystem will always have a fixed number of inodes no matter what mkfs options it uses (the same is true for not having a fixed number of inodes). So in this case, I think check against TEST_DEV/TEST_DIR should be fine.

Thanks,
Eryu

#7 lore raw

PATCH v2 5/5 shared,generic: move tests using duperemove to generic/

In reply to Theodore Ts'o

Add _require_scratch_duperemove which validates that the file system supports duperemove. This allows us to move three tests from shared/ to generic/. This means these tests will automatically adapt when duperemove supports other file systems. Tests moved are:

	shared/008 --> generic/559
	shared/009 --> generic/560
	shared/010 --> generic/561

---
Changes since v1:
- added missing "_supported_fs generic" lines

 common/reflink                            | 18 ++++++++++++++++++
 tests/{shared/008 => generic/559}         | 10 ++++------
 tests/{shared/008.out => generic/559.out} |  2 +-
 tests/{shared/009 => generic/560}         | 10 +++-------
 tests/{shared/009.out => generic/560.out} |  2 +-
 tests/{shared/010 => generic/561}         | 10 +++-------
 tests/generic/561.out                     |  2 ++
 tests/generic/group                       |  3 +++
 tests/shared/010.out                      |  2 --
 tests/shared/group                        |  3 ---
 10 files changed, 35 insertions(+), 27 deletions(-)
 rename tests/{shared/008 => generic/559} (85%)
 rename tests/{shared/008.out => generic/559.out} (64%)
 rename tests/{shared/009 => generic/560} (91%)
 rename tests/{shared/009.out => generic/560.out} (74%)
 rename tests/{shared/010 => generic/561} (89%)
 create mode 100644 tests/generic/561.out
 delete mode 100644 tests/shared/010.out
common/reflink +18 -0
index 598f0877..ee60398e 100644
@@ -75,6 +75,24 @@ _require_scratch_reflink()
 	_scratch_unmount
 }
 
+# this test requires duperemove working for the file system
+_require_scratch_duperemove()
+{
+	_require_scratch
+	_require_command "$DUPEREMOVE_PROG" duperemove
+
+	_scratch_mkfs > /dev/null
+	_scratch_mount
+	dd if=/dev/zero of="$SCRATCH_MNT/file1" bs=128k count=1 >& /dev/null
+	dd if=/dev/zero of="$SCRATCH_MNT/file2" bs=128k count=1 >& /dev/null
+	if ! "$DUPEREMOVE_PROG" -d "$SCRATCH_MNT/file1" \
+	    "$SCRATCH_MNT/file2" >& /dev/null ; then
+		_scratch_unmount
+		_notrun "duperemove does not support file system type: $FSTYP"
+	fi
+	_scratch_unmount
+}
+
 # this test requires scratch fs to report explicit SHARED flag
 # e.g.
 #   0         4K         8K
tests/generic/559 renamed from tests/shared/008 +4 -6
similarity index 85%
rename from tests/shared/008
rename to tests/generic/559
index a7d76083..b5297b57 100755
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2018 Red Hat Inc.  All Rights Reserved.
 #
-# FS QA Test 008
+# FS QA Test generic/559 (was shared/008)
 #
 # Dedupe a single big file and verify integrity
 #
@@ -29,12 +29,10 @@ _cleanup()
 # remove previous $seqres.full before test
 rm -f $seqres.full
 
-# duperemove only supports btrfs and xfs (with reflink feature).
-# Add other filesystems if it supports more later.
-_supported_fs xfs btrfs
+# real QA test starts here
+_supported_fs generic
 _supported_os Linux
-_require_scratch_dedupe
-_require_command "$DUPEREMOVE_PROG" duperemove
+_require_scratch_duperemove
 
 fssize=$((2 * 1024 * 1024 * 1024))
 _scratch_mkfs_sized $fssize > $seqres.full 2>&1
tests/generic/559.out renamed from tests/shared/008.out +1 -1
similarity index 64%
rename from tests/shared/008.out
rename to tests/generic/559.out
index f29d478f..a558ada3 100644
@@ -1,3 +1,3 @@
-QA output created by 008
+QA output created by 559
 = before cycle mount =
 = after cycle mount =
tests/generic/560 renamed from tests/shared/009 +3 -7
similarity index 91%
rename from tests/shared/009
rename to tests/generic/560
index 933d3098..de1fba92 100755
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2018 Red Hat Inc.  All Rights Reserved.
 #
-# FS QA Test 009
+# FS QA Test generic/560 (was shared/009)
 #
 # Iterate dedupe integrity test. Copy an original data0 several
 # times (d0 -> d1, d1 -> d2, ... dn-1 -> dn), dedupe dataN everytime
@@ -32,13 +32,9 @@ _cleanup()
 rm -f $seqres.full
 
 # real QA test starts here
-
-# duperemove only supports btrfs and xfs (with reflink feature).
-# Add other filesystems if it supports more later.
-_supported_fs xfs btrfs
+_supported_fs generic
 _supported_os Linux
-_require_scratch_dedupe
-_require_command "$DUPEREMOVE_PROG" duperemove
+_require_scratch_duperemove
 
 _scratch_mkfs > $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
tests/generic/560.out renamed from tests/shared/009.out +1 -1
similarity index 74%
rename from tests/shared/009.out
rename to tests/generic/560.out
index 44a78ba3..10ae7edd 100644
@@ -1,4 +1,4 @@
-QA output created by 009
+QA output created by 560
 = Do dedup and verify =
 = Backwords verify =
 = Verify after cycle mount =
tests/generic/561 renamed from tests/shared/010 +3 -7
similarity index 89%
rename from tests/shared/010
rename to tests/generic/561
index 04f55890..3cd0b365 100755
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2018 Red Hat Inc.  All Rights Reserved.
 #
-# FS QA Test 010
+# FS QA Test generic/561 (was shared/010)
 #
 # Dedup & random I/O race test, do multi-threads fsstress and dedupe on
 # same directory/files
@@ -32,13 +32,9 @@ _cleanup()
 rm -f $seqres.full
 
 # real QA test starts here
-
-# duperemove only supports btrfs and xfs (with reflink feature).
-# Add other filesystems if it supports more later.
-_supported_fs xfs btrfs
+_supported_fs generic
 _supported_os Linux
-_require_scratch_dedupe
-_require_command "$DUPEREMOVE_PROG" duperemove
+_require_scratch_duperemove
 _require_command "$KILLALL_PROG" killall
 
 _scratch_mkfs > $seqres.full 2>&1
tests/generic/561.out new file +2 -0
new file mode 100644
index 00000000..5e46f61f
@@ -0,0 +1,2 @@
+QA output created by 561
+Silence is golden
tests/generic/group +3 -0
index 8fc85b63..c30d18e0 100644
@@ -561,3 +561,6 @@
 556 auto quick casefold
 557 auto quick log
 558 auto enospc
+559 auto stress dedupe
+560 auto stress dedupe
+561 auto stress dedupe
tests/shared/010.out deleted +0 -2
deleted file mode 100644
index 1d83a8d6..00000000
@@ -1,2 +0,0 @@
-QA output created by 010
-Silence is golden
tests/shared/group +0 -3
index 2cf910bd..6112c8dd 100644
@@ -4,9 +4,6 @@
 # - comment line before each group is "new" description
 #
 002 auto metadata quick log
-008 auto stress dedupe
-009 auto stress dedupe
-010 auto stress dedupe
 011 auto quick
 032 mkfs auto quick
 298 auto trim
Signature · 1 line
2.22.0