diff mbox series

btrfs-progs: fix zstd compression test on a kernel without ztsd support

Message ID 20190903122721.9865-1-jthumshirn@suse.de (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: fix zstd compression test on a kernel without ztsd support | expand

Commit Message

Johannes Thumshirn Sept. 3, 2019, 12:27 p.m. UTC
The test-case 'misc-tests/025-zstd-compression' is failing on a kernel
without zstd compression support.

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

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 tests/misc-tests/025-zstd-compression/test.sh | 5 +++++
 1 file changed, 5 insertions(+)

Comments

David Sterba Sept. 3, 2019, 4:09 p.m. UTC | #1
On Tue, Sep 03, 2019 at 02:27:21PM +0200, Johannes Thumshirn wrote:
> The test-case 'misc-tests/025-zstd-compression' is failing on a kernel
> without zstd compression support.
> 
> Check if zstd compression is supported by the kernel and if not skip the
> test-case.
> 
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
>  tests/misc-tests/025-zstd-compression/test.sh | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tests/misc-tests/025-zstd-compression/test.sh b/tests/misc-tests/025-zstd-compression/test.sh
> index 22795d27500e..f9ff1d089fd5 100755
> --- a/tests/misc-tests/025-zstd-compression/test.sh
> +++ b/tests/misc-tests/025-zstd-compression/test.sh
> @@ -6,6 +6,11 @@ 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"

Sorry, I misled you with this check. The test needs to detect zstd
support in 'btrfs restore'. The only thing I see right now is to grep
for zstd in output of 'ldd', because unlike for btrfs-convert, the help
does not list the optional features.
Johannes Thumshirn Sept. 4, 2019, 7:36 a.m. UTC | #2
On 03/09/2019 18:09, David Sterba wrote:
>> +if ! [ -f "/sys/fs/btrfs/features/compress_zstd" ]; then
>> +       _not_run "kernel does not support zstd compression feature"
> 
> Sorry, I misled you with this check. The test needs to detect zstd
> support in 'btrfs restore'. The only thing I see right now is to grep
> for zstd in output of 'ldd', because unlike for btrfs-convert, the help
> does not list the optional features.

Well, yes and no. You can compile a btrfs binary with zstd support and
run it on a kernel without. The check would catch this case.

But I see it can't cope with a btrfs binary without zstd support
compiled in indeed.

Let me cook something.

Byte,
	Johannes
diff mbox series

Patch

diff --git a/tests/misc-tests/025-zstd-compression/test.sh b/tests/misc-tests/025-zstd-compression/test.sh
index 22795d27500e..f9ff1d089fd5 100755
--- a/tests/misc-tests/025-zstd-compression/test.sh
+++ b/tests/misc-tests/025-zstd-compression/test.sh
@@ -6,6 +6,11 @@  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
+
 # Extract the test image
 image=$(extract_image compress.raw.xz)