[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 09/12] iotests/image-fleecing: switch to qemu_io()
From: |
John Snow |
Subject: |
[PATCH v3 09/12] iotests/image-fleecing: switch to qemu_io() |
Date: |
Mon, 18 Apr 2022 17:15:01 -0400 |
This test expects failure ... but only sometimes. When? Why?
It's for reads of a region not defined by a bitmap. Adjust the test to
be more explicit about what it expects to fail and why.
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
---
tests/qemu-iotests/tests/image-fleecing | 28 +++++++++++++++++--------
1 file changed, 19 insertions(+), 9 deletions(-)
diff --git a/tests/qemu-iotests/tests/image-fleecing
b/tests/qemu-iotests/tests/image-fleecing
index b7e50761044..ac749702f8e 100755
--- a/tests/qemu-iotests/tests/image-fleecing
+++ b/tests/qemu-iotests/tests/image-fleecing
@@ -22,9 +22,10 @@
#
# Creator/Owner: John Snow <jsnow@redhat.com>
+from subprocess import CalledProcessError
+
import iotests
-from iotests import log, qemu_img, qemu_io, qemu_io_silent, \
- qemu_io_pipe_and_status
+from iotests import log, qemu_img, qemu_io, qemu_io_silent
iotests.script_initialize(
supported_fmts=['qcow2'],
@@ -185,10 +186,14 @@ def do_test(vm, use_cbw, use_snapshot_access_filter,
base_img_path,
for p in patterns + zeroes:
cmd = 'read -P%s %s %s' % p
log(cmd)
- out, ret = qemu_io_pipe_and_status('-r', '-f', 'raw', '-c', cmd,
- nbd_uri)
- if ret != 0:
- print(out)
+
+ try:
+ qemu_io('-r', '-f', 'raw', '-c', cmd, nbd_uri)
+ except CalledProcessError as exc:
+ if bitmap and p in zeroes:
+ log(exc.stdout)
+ else:
+ raise
log('')
log('--- Testing COW ---')
@@ -228,9 +233,14 @@ def do_test(vm, use_cbw, use_snapshot_access_filter,
base_img_path,
args += [target_img_path]
else:
args += ['-f', 'raw', nbd_uri]
- out, ret = qemu_io_pipe_and_status(*args)
- if ret != 0:
- print(out)
+
+ try:
+ qemu_io(*args)
+ except CalledProcessError as exc:
+ if bitmap and p in zeroes:
+ log(exc.stdout)
+ else:
+ raise
log('')
log('--- Cleanup ---')
--
2.34.1
- [PATCH v3 00/12] iotests: add enhanced debugging info to qemu-io failures, John Snow, 2022/04/18
- [PATCH v3 01/12] iotests: replace calls to log(qemu_io(...)) with qemu_io_log(), John Snow, 2022/04/18
- [PATCH v3 09/12] iotests/image-fleecing: switch to qemu_io(),
John Snow <=
- [PATCH v3 02/12] iotests/163: Fix broken qemu-io invocation, John Snow, 2022/04/18
- [PATCH v3 04/12] iotests/040: Don't check image pattern on zero-length image, John Snow, 2022/04/18
- [PATCH v3 06/12] iotests: create generic qemu_tool() function, John Snow, 2022/04/18
- [PATCH v3 07/12] iotests: rebase qemu_io() on top of qemu_tool(), John Snow, 2022/04/18
- [PATCH v3 05/12] iotests/040: Fix TestCommitWithFilters test, John Snow, 2022/04/18
- [PATCH v3 11/12] iotests: remove qemu_io_silent() and qemu_io_silent_check()., John Snow, 2022/04/18
- [PATCH v3 03/12] iotests: Don't check qemu_io() output for specific error strings, John Snow, 2022/04/18
- [PATCH v3 10/12] iotests: remove qemu_io_pipe_and_status(), John Snow, 2022/04/18
- [PATCH v3 12/12] iotests: make qemu_io_log() check return codes by default, John Snow, 2022/04/18