diff mbox series

[v2] fstests: detect btrfs compression and disable certain tests

Message ID c36805e06925606a10ca844a2fa2b30a3db07bdd.1636993704.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series [v2] fstests: detect btrfs compression and disable certain tests | expand

Commit Message

Josef Bacik Nov. 15, 2021, 4:29 p.m. UTC
Our nightly xfstests runs exposed a set of tests that always fail if we
have compression enabled.  This is because compression obviously messes
with the amount of data space allocated on disk, and these tests are
testing either that quota is doing the correct thing, or that we're able
to completely fill the file system.

Add a helper to check to see if we have any of our compression related
mount options set and simply _not_run for these specific tests.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
v1->v2:
- added _require_no_compress(), made it call the btrfs helper for fstyp ==
  btrfs, changed all the tests to use the generic helper instead.
- added the require to btrfs/237

 common/btrfs      |  7 +++++++
 common/rc         | 11 +++++++++++
 tests/btrfs/126   |  4 ++++
 tests/btrfs/139   |  4 ++++
 tests/btrfs/230   |  4 ++++
 tests/btrfs/232   |  4 ++++
 tests/btrfs/237   |  4 ++++
 tests/generic/275 |  4 ++++
 tests/generic/427 |  4 ++++
 9 files changed, 46 insertions(+)
diff mbox series

Patch

diff --git a/common/btrfs b/common/btrfs
index 2eab4b29..8ce8d60c 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -113,6 +113,13 @@  _require_btrfs_fs_sysfs()
 
 }
 
+_require_btrfs_no_compress()
+{
+	if _normalize_mount_options | grep -q "compress"; then
+		_notrun "This test requires no compression enabled"
+	fi
+}
+
 _check_btrfs_filesystem()
 {
 	device=$1
diff --git a/common/rc b/common/rc
index 0d261184..9a953a36 100644
--- a/common/rc
+++ b/common/rc
@@ -1676,6 +1676,17 @@  _require_scratch_nocheck()
     rm -f ${RESULT_DIR}/require_scratch
 }
 
+_require_no_compress()
+{
+	case "$FSTYP" in
+	btrfs)
+		_require_btrfs_no_compress
+		;;
+	*)
+		;;
+	esac
+}
+
 # we need the scratch device and it should be checked post test.
 _require_scratch()
 {
diff --git a/tests/btrfs/126 b/tests/btrfs/126
index a13a0a6e..2b0edb65 100755
--- a/tests/btrfs/126
+++ b/tests/btrfs/126
@@ -19,6 +19,10 @@  _supported_fs btrfs
 _require_scratch
 _require_btrfs_qgroup_report
 
+# This test requires specific data space usage, skip if we have compression
+# enabled.
+_require_no_compress
+
 _scratch_mkfs >/dev/null
 # Use enospc_debug mount option to trigger restrict space info check
 _scratch_mount "-o enospc_debug"
diff --git a/tests/btrfs/139 b/tests/btrfs/139
index 7760182a..c4b09f9f 100755
--- a/tests/btrfs/139
+++ b/tests/btrfs/139
@@ -19,6 +19,10 @@  _supported_fs btrfs
 # We at least need 2GB of free space on $SCRATCH_DEV
 _require_scratch_size $((2 * 1024 * 1024))
 
+# This test requires specific data space usage, skip if we have compression
+# enabled.
+_require_no_compress
+
 _scratch_mkfs > /dev/null 2>&1
 _scratch_mount
 
diff --git a/tests/btrfs/230 b/tests/btrfs/230
index 2daacfbe..46b0c636 100755
--- a/tests/btrfs/230
+++ b/tests/btrfs/230
@@ -17,6 +17,10 @@  _begin_fstest auto quick qgroup limit
 
 _supported_fs btrfs
 
+# This test requires specific data space usage, skip if we have compression
+# enabled.
+_require_no_compress
+
 # Need at least 2GiB
 _require_scratch_size $((2 * 1024 * 1024))
 _scratch_mkfs > /dev/null 2>&1
diff --git a/tests/btrfs/232 b/tests/btrfs/232
index 8691a508..02c7e49d 100755
--- a/tests/btrfs/232
+++ b/tests/btrfs/232
@@ -33,6 +33,10 @@  writer()
 
 _supported_fs btrfs
 
+# This test requires specific data space usage, skip if we have compression
+# enabled.
+_require_no_compress
+
 _require_scratch_size $((2 * 1024 * 1024))
 _scratch_mkfs > /dev/null 2>&1
 _scratch_mount
diff --git a/tests/btrfs/237 b/tests/btrfs/237
index 5994edf8..5168777e 100755
--- a/tests/btrfs/237
+++ b/tests/btrfs/237
@@ -24,6 +24,10 @@  _require_btrfs_command filesystem sync
 _require_command "$BLKZONE_PROG" blkzone
 _require_zoned_device "$SCRATCH_DEV"
 
+# This test requires specific data space usage, skip if we have compression
+# enabled.
+_require_no_compress
+
 get_data_bg()
 {
 	$BTRFS_UTIL_PROG inspect-internal dump-tree -t CHUNK $SCRATCH_DEV |\
diff --git a/tests/generic/275 b/tests/generic/275
index bf0aa2b3..6189edca 100755
--- a/tests/generic/275
+++ b/tests/generic/275
@@ -25,6 +25,10 @@  _cleanup()
 _supported_fs generic
 _require_scratch
 
+# This test requires specific data space usage, skip if we have compression
+# enabled.
+_require_no_compress
+
 echo "------------------------------"
 echo "write until ENOSPC test"
 echo "------------------------------"
diff --git a/tests/generic/427 b/tests/generic/427
index 0f99c1b2..26385d36 100755
--- a/tests/generic/427
+++ b/tests/generic/427
@@ -22,6 +22,10 @@  _require_scratch
 _require_test_program "feature"
 _require_aiodio aio-dio-eof-race
 
+# This test requires specific data space usage, skip if we have compression
+# enabled.
+_require_no_compress
+
 # limit the filesystem size, to save the time of filling filesystem
 _scratch_mkfs_sized $((256 * 1024 * 1024)) >>$seqres.full 2>&1
 _scratch_mount