From: Hanna Reitz <hreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
Hanna Reitz <hreitz@redhat.com>,
qemu-devel@nongnu.org
Subject: [PULL 23/25] iotests: make qemu_img_log and img_info_log raise on error
Date: Tue, 22 Mar 2022 12:56:45 +0100 [thread overview]
Message-ID: <20220322115647.726044-24-hreitz@redhat.com> (raw)
In-Reply-To: <20220322115647.726044-1-hreitz@redhat.com>
From: John Snow <jsnow@redhat.com>
Add a `check: bool = True` parameter to both functions and make their
qemu_img() invocations raise on error by default.
users of img_info_log:
206, 207, 210, 211, 212, 213, 237, 242, 266, 274, 302
users of qemu_img_log:
044, 209, 274, 302, 304
iotests 242 and 266 need to use check=False for their negative tests.
iotests 206, 210, 211, 212, 213, 237, 274 and 302 continue working
normally.
As of this commit, all calls to QEMU_IMG made from iotests enforce a
return code of zero by default unless explicitly disabled or suppressed
by passing check=False or with an exception handler.
Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20220321201618.903471-19-jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
---
tests/qemu-iotests/242 | 2 +-
tests/qemu-iotests/266 | 2 +-
tests/qemu-iotests/iotests.py | 8 +++++---
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/tests/qemu-iotests/242 b/tests/qemu-iotests/242
index 547bf382e3..b3afd36d72 100755
--- a/tests/qemu-iotests/242
+++ b/tests/qemu-iotests/242
@@ -100,7 +100,7 @@ add_bitmap(1, True, False)
log('Write an unknown bitmap flag \'{}\' into a new QCOW2 image at offset {}'
.format(hex(bitmap_flag_unknown), flag_offset))
toggle_flag(flag_offset)
-img_info_log(disk)
+img_info_log(disk, check=False)
toggle_flag(flag_offset)
log('Unset the unknown bitmap flag \'{}\' in the bitmap directory entry:\n'
.format(hex(bitmap_flag_unknown)))
diff --git a/tests/qemu-iotests/266 b/tests/qemu-iotests/266
index 71ce81d0df..8fc3807ac5 100755
--- a/tests/qemu-iotests/266
+++ b/tests/qemu-iotests/266
@@ -137,7 +137,7 @@ def main():
iotests.log('')
vm.shutdown()
- iotests.img_info_log(file_path)
+ iotests.img_info_log(file_path, check=False)
iotests.script_main(main,
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 1771d01977..4b788c7491 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -312,13 +312,15 @@ def qemu_img_info(*args: str) -> Any:
def qemu_img_map(*args: str) -> Any:
return qemu_img_json('map', "--output", "json", *args)
-def qemu_img_log(*args: str) -> 'subprocess.CompletedProcess[str]':
- result = qemu_img(*args, check=False)
+def qemu_img_log(*args: str, check: bool = True
+ ) -> 'subprocess.CompletedProcess[str]':
+ result = qemu_img(*args, check=check)
log(result.stdout, filters=[filter_testfiles])
return result
def img_info_log(filename: str, filter_path: Optional[str] = None,
use_image_opts: bool = False, extra_args: Sequence[str] = (),
+ check: bool = True,
) -> None:
args = ['info']
if use_image_opts:
@@ -328,7 +330,7 @@ def img_info_log(filename: str, filter_path: Optional[str] = None,
args += extra_args
args.append(filename)
- output = qemu_img(*args, check=False).stdout
+ output = qemu_img(*args, check=check).stdout
if not filter_path:
filter_path = filename
log(filter_img_info(output, filter_path))
--
2.35.1
next prev parent reply other threads:[~2022-03-22 12:18 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-22 11:56 [PULL 00/25] Block patches for 7.0-rc1 Hanna Reitz
2022-03-22 11:56 ` [PULL 01/25] tests: add (riscv virt) machine mapping to testenv Hanna Reitz
2022-03-22 11:56 ` [PULL 02/25] block/rbd: fix write zeroes with growing images Hanna Reitz
2022-03-22 11:56 ` [PULL 03/25] tests/qemu-iotests: Use GNU sed in two more spots where it is necessary Hanna Reitz
2022-03-22 11:56 ` [PULL 04/25] tests: Do not treat the iotests as separate meson test target anymore Hanna Reitz
2022-03-22 11:56 ` [PULL 05/25] tests/qemu-iotests/testrunner: Supply a test plan in TAP mode Hanna Reitz
2022-03-22 11:56 ` [PULL 06/25] python/utils: add add_visual_margin() text decoration utility Hanna Reitz
2022-03-22 11:56 ` [PULL 07/25] python/utils: add VerboseProcessError Hanna Reitz
2022-03-22 11:56 ` [PULL 08/25] iotests: Remove explicit checks for qemu_img() == 0 Hanna Reitz
2022-03-22 11:56 ` [PULL 09/25] iotests: make qemu_img raise on non-zero rc by default Hanna Reitz
2022-03-22 11:56 ` [PULL 10/25] iotests: fortify compare_images() against crashes Hanna Reitz
2022-03-22 11:56 ` [PULL 11/25] iotests: add qemu_img_json() Hanna Reitz
2022-03-22 11:56 ` [PULL 12/25] iotests: use qemu_img_json() when applicable Hanna Reitz
2022-03-22 11:56 ` [PULL 13/25] iotests: add qemu_img_info() Hanna Reitz
2022-03-22 11:56 ` [PULL 14/25] iotests/remove-bitmap-from-backing: use qemu_img_info() Hanna Reitz
2022-03-22 11:56 ` [PULL 15/25] iotests: add qemu_img_map() function Hanna Reitz
2022-03-22 11:56 ` [PULL 16/25] iotests: change supports_quorum to use qemu_img Hanna Reitz
2022-03-22 11:56 ` [PULL 17/25] iotests: replace unchecked calls to qemu_img_pipe() Hanna Reitz
2022-03-22 11:56 ` [PULL 18/25] iotests/149: Remove qemu_img_pipe() call Hanna Reitz
2022-03-22 11:56 ` [PULL 19/25] iotests: remove remaining calls to qemu_img_pipe() Hanna Reitz
2022-03-22 11:56 ` [PULL 20/25] iotests: use qemu_img() in has_working_luks() Hanna Reitz
2022-03-22 11:56 ` [PULL 21/25] iotests: replace qemu_img_log('create', ...) calls Hanna Reitz
2022-03-22 11:56 ` [PULL 22/25] iotests: remove qemu_img_pipe_and_status() Hanna Reitz
2022-03-22 11:56 ` Hanna Reitz [this message]
2022-03-22 11:56 ` [PULL 24/25] iotests.py: Filters for VM.run_job() Hanna Reitz
2022-03-22 11:56 ` [PULL 25/25] iotests/207: Filter host fingerprint Hanna Reitz
2022-03-22 17:05 ` [PULL 00/25] Block patches for 7.0-rc1 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220322115647.726044-24-hreitz@redhat.com \
--to=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).