[v2] btrfs-progs: fix zstd compression test on a kernel without ztsd support
diff mbox series

Message ID 20190904081802.8985-1-jthumshirn@suse.de
State New
Headers show
Series
  • [v2] btrfs-progs: fix zstd compression test on a kernel without ztsd support
Related show

Commit Message

Johannes Thumshirn Sept. 4, 2019, 8:18 a.m. UTC
The test-case 'misc-tests/025-zstd-compression' is failing on a kernel or
btrfs binary built without zstd compression support.

Check if zstd compression is supported by either the kernel or the btrfs
binary and if not skip the test-case.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>

---
Changes to v1:
- Also check $TOP/btrfs not just the kernel for zstd support (Dave)
---
 tests/misc-tests/025-zstd-compression/test.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Noah Massey Sept. 4, 2019, 3:30 p.m. UTC | #1
On Wed, Sep 4, 2019 at 4:19 AM Johannes Thumshirn <jthumshirn@suse.de> wrote:
>
> The test-case 'misc-tests/025-zstd-compression' is failing on a kernel or
> btrfs binary built without zstd compression support.
>
> Check if zstd compression is supported by either the kernel or the btrfs
> binary and if not skip the test-case.
>

s/either/both/; s/or/and/


> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
>
> ---
> Changes to v1:
> - Also check $TOP/btrfs not just the kernel for zstd support (Dave)
> ---
>  tests/misc-tests/025-zstd-compression/test.sh | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/tests/misc-tests/025-zstd-compression/test.sh b/tests/misc-tests/025-zstd-compression/test.sh
> index 22795d27500e..d967e358fcb2 100755
> --- a/tests/misc-tests/025-zstd-compression/test.sh
> +++ b/tests/misc-tests/025-zstd-compression/test.sh
> @@ -6,6 +6,16 @@ source "$TEST_TOP/common"
>  check_prereq btrfs
>  check_global_prereq md5sum
>
> +if ! [ -f "/sys/fs/btrfs/features/compress_zstd" ]; then
> +       _not_run "kernel does not support zstd compression feature"
> +       exit
> +fi
> +
> +if ! ldd "$TOP/btrfs" | grep -q zstd; then
> +       _not_run "btrfs is not compiled with zstd compression support"
> +       exit
> +fi
> +
>  # Extract the test image
>  image=$(extract_image compress.raw.xz)
>
> --
> 2.16.4
>

Patch
diff mbox series

diff --git a/tests/misc-tests/025-zstd-compression/test.sh b/tests/misc-tests/025-zstd-compression/test.sh
index 22795d27500e..d967e358fcb2 100755
--- a/tests/misc-tests/025-zstd-compression/test.sh
+++ b/tests/misc-tests/025-zstd-compression/test.sh
@@ -6,6 +6,16 @@  source "$TEST_TOP/common"
 check_prereq btrfs
 check_global_prereq md5sum
 
+if ! [ -f "/sys/fs/btrfs/features/compress_zstd" ]; then
+       _not_run "kernel does not support zstd compression feature"
+       exit
+fi
+
+if ! ldd "$TOP/btrfs" | grep -q zstd; then
+	_not_run "btrfs is not compiled with zstd compression support"
+	exit
+fi
+
 # Extract the test image
 image=$(extract_image compress.raw.xz)