[PATCH 15/15] iotests: make qemu_io_log() check return codes by default

John Snow posted 15 patches 3 years, 10 months ago
There is a newer version of this series
[PATCH 15/15] iotests: make qemu_io_log() check return codes by default
Posted by John Snow 3 years, 10 months ago
Just like qemu_img_log(), upgrade qemu_io_log() to enforce a return code
of zero by default.

Affected tests: 242 245 255 274 303 307 nbd-reconnect-on-open

Signed-off-by: John Snow <jsnow@redhat.com>
---
 tests/qemu-iotests/iotests.py                  | 5 +++--
 tests/qemu-iotests/tests/nbd-reconnect-on-open | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 0b631e1f8c..c05637bd57 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -365,8 +365,9 @@ def qemu_io(*args: str, check: bool = True, combine_stdio: bool = True
     return qemu_tool(*qemu_io_wrap_args(args),
                      check=check, combine_stdio=combine_stdio)
 
-def qemu_io_log(*args: str) -> subprocess.CompletedProcess[str]:
-    result = qemu_io(*args, check=False)
+def qemu_io_log(*args: str, check: bool = True
+                ) -> subprocess.CompletedProcess[str]:
+    result = qemu_io(*args, check=check)
     log(result.stdout, filters=[filter_testfiles, filter_qemu_io])
     return result
 
diff --git a/tests/qemu-iotests/tests/nbd-reconnect-on-open b/tests/qemu-iotests/tests/nbd-reconnect-on-open
index 8be721a24f..d0b401b060 100755
--- a/tests/qemu-iotests/tests/nbd-reconnect-on-open
+++ b/tests/qemu-iotests/tests/nbd-reconnect-on-open
@@ -39,7 +39,7 @@ def check_fail_to_connect(open_timeout):
     log(f'Check fail to connect with {open_timeout} seconds of timeout')
 
     start_t = time.time()
-    qemu_io_log(*create_args(open_timeout))
+    qemu_io_log(*create_args(open_timeout), check=False)
     delta_t = time.time() - start_t
 
     max_delta = open_timeout + 0.2
-- 
2.34.1
Re: [PATCH 15/15] iotests: make qemu_io_log() check return codes by default
Posted by Hanna Reitz 3 years, 10 months ago
On 18.03.22 21:36, John Snow wrote:
> Just like qemu_img_log(), upgrade qemu_io_log() to enforce a return code
> of zero by default.
>
> Affected tests: 242 245 255 274 303 307 nbd-reconnect-on-open
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>   tests/qemu-iotests/iotests.py                  | 5 +++--
>   tests/qemu-iotests/tests/nbd-reconnect-on-open | 2 +-
>   2 files changed, 4 insertions(+), 3 deletions(-)

Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Re: [PATCH 15/15] iotests: make qemu_io_log() check return codes by default
Posted by Eric Blake 3 years, 10 months ago
On Fri, Mar 18, 2022 at 04:36:55PM -0400, John Snow wrote:
> Just like qemu_img_log(), upgrade qemu_io_log() to enforce a return code
> of zero by default.
> 
> Affected tests: 242 245 255 274 303 307 nbd-reconnect-on-open
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  tests/qemu-iotests/iotests.py                  | 5 +++--
>  tests/qemu-iotests/tests/nbd-reconnect-on-open | 2 +-
>  2 files changed, 4 insertions(+), 3 deletions(-)
>

If I'm reading the commit message correctly, 'Affected tests' are all
tests that used qemu_io_log, but only nbd-reconnect-on-open needed a
change because it was the only one that explicitly tested a scenario
that triggers an expected non-zero status.

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
Re: [PATCH 15/15] iotests: make qemu_io_log() check return codes by default
Posted by John Snow 3 years, 10 months ago
On Mon, Mar 21, 2022 at 2:22 PM Eric Blake <eblake@redhat.com> wrote:
>
> On Fri, Mar 18, 2022 at 04:36:55PM -0400, John Snow wrote:
> > Just like qemu_img_log(), upgrade qemu_io_log() to enforce a return code
> > of zero by default.
> >
> > Affected tests: 242 245 255 274 303 307 nbd-reconnect-on-open
> >
> > Signed-off-by: John Snow <jsnow@redhat.com>
> > ---
> >  tests/qemu-iotests/iotests.py                  | 5 +++--
> >  tests/qemu-iotests/tests/nbd-reconnect-on-open | 2 +-
> >  2 files changed, 4 insertions(+), 3 deletions(-)
> >
>
> If I'm reading the commit message correctly, 'Affected tests' are all
> tests that used qemu_io_log, but only nbd-reconnect-on-open needed a
> change because it was the only one that explicitly tested a scenario
> that triggers an expected non-zero status.

Yeah, it was meant more as a test aid. I'll change the wording a little bit.

>
> Reviewed-by: Eric Blake <eblake@redhat.com>

Thanks. By the way, did you check out iotest 040 in all of this? There
*was* a failure I wasn't sure how to address, I wrote about it in the
cover letter.

--js