From: Eryu Guan <guan@eryu.me>
To: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com, fstests@vger.kernel.org
Subject: Re: [PATCH] fstests: detect btrfs compression and disable certain tests
Date: Sun, 14 Nov 2021 20:43:12 +0800 [thread overview]
Message-ID: <YZEEYNmDRpgPLqkL@desktop> (raw)
In-Reply-To: <f2b314338ecd06ae734ff0f0537f0cdf247db8f6.1636737764.git.josef@toxicpanda.com>
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@toxicpanda.com>
> ---
> 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
next prev parent reply other threads:[~2021-11-14 12:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-12 17:23 [PATCH] fstests: detect btrfs compression and disable certain tests Josef Bacik
2021-11-14 12:43 ` Eryu Guan [this message]
2021-11-15 11:34 ` Johannes Thumshirn
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=YZEEYNmDRpgPLqkL@desktop \
--to=guan@eryu.me \
--cc=fstests@vger.kernel.org \
--cc=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.