Re: [PATCH] fstests: detect btrfs compression and disable certain tests

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



On Fri, Nov 12, 2021 at 12:23:18PM -0500, Josef Bacik wrote:
> 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@xxxxxxxxxxxxxx>
> ---
>  common/btrfs      | 10 ++++++++++
>  tests/btrfs/126   |  4 ++++
>  tests/btrfs/139   |  4 ++++
>  tests/btrfs/230   |  4 ++++
>  tests/btrfs/232   |  4 ++++
>  tests/generic/275 |  4 ++++
>  tests/generic/427 |  4 ++++
>  7 files changed, 34 insertions(+)
> 
> diff --git a/common/btrfs b/common/btrfs
> index 2eab4b29..b4067121 100644
> --- a/common/btrfs
> +++ b/common/btrfs
> @@ -113,6 +113,16 @@ _require_btrfs_fs_sysfs()
>  
>  }
>  
> +_require_btrfs_no_compress()

I think we could make it a common helper, not juse for btrfs, e.g.

_require_scratch_no_compress()

and do case switch based on $FSTYP, and only call
_require_scratch_btrfs_no_compress() for btrfs. Other $FSTYP could
return directly for now, and extend _require_scratch_no_compress() in
future if other filesystems gain compress support.

> +{
> +	if [ "$FSTYP" != "btrfs" ]; then
> +		return
> +	fi
> +
> +	_scratch_mount_options | grep -q "compress"

Could call _normalize_mount_options instead of _scratch_mount_options

> +	[ $? -eq 0 ] && _notrun "This test requires no compression enabled"
> +}
> +
>  _check_btrfs_filesystem()
>  {
>  	device=$1
> diff --git a/tests/btrfs/126 b/tests/btrfs/126
> index a13a0a6e..d9b638fd 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_btrfs_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..dcf85416 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_btrfs_no_compress
> +
>  _scratch_mkfs > /dev/null 2>&1
>  _scratch_mount
>  
> diff --git a/tests/btrfs/230 b/tests/btrfs/230
> index 2daacfbe..d431be50 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_btrfs_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..eca1bf41 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_btrfs_no_compress
> +
>  _require_scratch_size $((2 * 1024 * 1024))
>  _scratch_mkfs > /dev/null 2>&1
>  _scratch_mount
> diff --git a/tests/generic/275 b/tests/generic/275
> index bf0aa2b3..012bd45f 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_btrfs_no_compress

With _require_scratch_no_compress also avoids calling a btrfs specific
function in a generic test.

Thanks,
Eryu

> +
>  echo "------------------------------"
>  echo "write until ENOSPC test"
>  echo "------------------------------"
> diff --git a/tests/generic/427 b/tests/generic/427
> index 0f99c1b2..2ebcbf43 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_btrfs_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
> -- 
> 2.26.3



[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux