On 22.02.22 16:44, Vladimir Sementsov-Ogievskiy wrote:
21.02.2022 20:08, Hanna Reitz wrote:
Some test cases run in iotest 065 require zstd support. Skip them if
qemu-img reports it not to be available.
Reported-by: Thomas Huth <th...@redhat.com>
Fixes: 12a936171d71f839dc907ff ("iotest 065: explicit compression type")
Signed-off-by: Hanna Reitz <hre...@redhat.com>
---
tests/qemu-iotests/065 | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/tests/qemu-iotests/065 b/tests/qemu-iotests/065
index f7c1b68dad..b68df84642 100755
--- a/tests/qemu-iotests/065
+++ b/tests/qemu-iotests/065
@@ -24,7 +24,7 @@ import os
import re
import json
import iotests
-from iotests import qemu_img, qemu_img_pipe
+from iotests import qemu_img_pipe, qemu_img_pipe_and_status
import unittest
test_img = os.path.join(iotests.test_dir, 'test.img')
@@ -35,8 +35,13 @@ class TestImageInfoSpecific(iotests.QMPTestCase):
def setUp(self):
if self.img_options is None:
self.skipTest('Skipping abstract test class')
- qemu_img('create', '-f', iotests.imgfmt, '-o',
self.img_options,
- test_img, '128K')
+ output, status = qemu_img_pipe_and_status('create',
+ '-f', iotests.imgfmt,
+ '-o',
self.img_options,
+ test_img, '128K')
+ if status == 1 and \
+ "'compression-type' does not accept value 'zstd'" in
output:
+ self.case_skip('zstd compression not supported')
def tearDown(self):
os.remove(test_img)
Hmm. Actually you fix the commit 12a936171d71f in a meaning that test
passes now. But that only stresses the fact that 12a936171d71f brings
a degradation in test-count for no-zstd builds. Is it bad?
Probably not really, considering that no-zstd builds shouldn’t be
happening very often. But since it’s something that can absolutely be
worked around, it should be worked around. :)
The simplest solution is to duplicate TestQCow3NotLazy and
TestQCow3LazyQMP with s/zstd/zlib/.. More complicated is to add
generic function to detect is zstd supported or not, and use zstd in
TestQCow3NotLazy and TestQCow3NotLazy only if zstd is supported (and
otherwise use zlib).
I think using zstd only if zstd is supported makes the most sense so we
don’t increase the number of test cases for the more common case where
zstd is compiled in.
Hanna