qemu-block
[Top][All Lists]
Advanced

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

Re: [PATCH 2/2] iotests/303: Check for zstd support


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [PATCH 2/2] iotests/303: Check for zstd support
Date: Tue, 22 Feb 2022 18:55:22 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

21.02.2022 20:08, Hanna Reitz wrote:
303 runs two test cases, one of which requires zstd support.
Unfortunately, given that this is not a unittest-style test, we cannot
easily skip that single case, and instead can only skip the whole test.

(Alternatively, we could split this test into a zlib and a zstd part,
but that seems excessive, given that this test is not in auto and thus
likely only run by developers who have zstd support compiled in.)

Fixes: 677e0bae686e7c670a71d1f ("iotest 303: explicit compression type")
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
---
  tests/qemu-iotests/303 | 15 +++++++++++----
  1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/tests/qemu-iotests/303 b/tests/qemu-iotests/303
index 16c2e10827..5a3efb4ba3 100755
--- a/tests/qemu-iotests/303
+++ b/tests/qemu-iotests/303
@@ -21,7 +21,8 @@
import iotests
  import subprocess
-from iotests import qemu_img_create, qemu_io, file_path, log, filter_qemu_io
+from iotests import notrun, qemu_img_pipe_and_status, qemu_io, file_path, \
+        log, filter_qemu_io
iotests.script_initialize(supported_fmts=['qcow2'],
                            unsupported_imgopts=['refcount_bits', 'compat'])
@@ -55,9 +56,15 @@ def add_bitmap(num, begin, end, disabled):
def test(compression_type: str, json_output: bool) -> None:
-    qemu_img_create('-f', iotests.imgfmt,
-                    '-o', f'compression_type={compression_type}',
-                    disk, '10M')
+    opts = f'compression_type={compression_type}'
+    output, status = qemu_img_pipe_and_status('create',
+                                              '-f', iotests.imgfmt,
+                                              '-o', opts,
+                                              disk, '10M')
+    if status == 1 and \
+            "'compression-type' does not accept value 'zstd'" in output:
+        notrun('zstd compression not supported')
+

Could we make from it a function in iotests.py like has_working_luks() / 
verify_working_luks() ?

Then in this test we'll simply have at start iotests.verify_zstd(), and in previous test 
we'll do something like "comp_type = 'zstd' if iotests.has_zstd() else 'zlib'" 
in classes that wants zstd

      add_bitmap(1, 0, 6, False)
      add_bitmap(2, 6, 8, True)



--
Best regards,
Vladimir



reply via email to

[Prev in Thread] Current Thread [Next in Thread]