fstests: detect btrfs compression and disable certain tests
authorJosef Bacik <josef@toxicpanda.com>
Mon, 15 Nov 2021 16:29:29 +0000 (11:29 -0500)
committerEryu Guan <guaneryu@gmail.com>
Sun, 21 Nov 2021 14:58:57 +0000 (22:58 +0800)
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>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/btrfs
common/rc
tests/btrfs/126
tests/btrfs/139
tests/btrfs/230
tests/btrfs/232
tests/btrfs/237
tests/generic/275
tests/generic/427

index cd053d3b284a7d9a38e96221f488134a91a79126..fe5985663ab456332b77ed9fa42c05832ac600eb 100644 (file)
@@ -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
index 0a30a8421328043da671e00384e46c86ccece5c1..8e351f17bbbeba91d01294f2761ccf3f83cb5761 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -1687,6 +1687,17 @@ _require_scratch_nolvm()
        [ $? -eq 0 ] && _notrun "test requires a non-lvm scratch device"
 }
 
+_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()
 {
index a13a0a6e8ef4d44968ef0625e80f790abd6e259b..2b0edb65b4bfcfdcc60e71336ae624bb88f0d649 100755 (executable)
@@ -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"
index 7760182aa4efaba4a0d3e0fcd424c789e79b5b15..c4b09f9fc1daca12e0997eb40961bc5fe519f67b 100755 (executable)
@@ -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
 
index 2daacfbeebb63d769f56cfc3f7b20bb92cca80eb..46b0c63693a3130c55c37c9a5610304936bc9e67 100755 (executable)
@@ -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
index 8691a508d345ee0cb4f4fa19472fbcb5bb151234..02c7e49de8ceec49576e69a06b87b8b8e3630068 100755 (executable)
@@ -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
index 5994edf8b16546ea0bfda81f09454a43e2811d26..5168777ee1ec9f1aded0fa1343a4603aa4daa69d 100755 (executable)
@@ -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 |\
index bf0aa2b380afa3345bcb6c736d59cda2777fb106..6189edca2fd5baa36a5a387e6b4fa3bb061d97f7 100755 (executable)
@@ -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 "------------------------------"
index 0f99c1b27107f75f498436cc938c77570155dcfa..26385d36e1d2a10c53db890db07d788037462f8a 100755 (executable)
@@ -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