[PATCH 02/15] iotests/163: Fix broken qemu-io invocation

John Snow posted 15 patches 3 years, 10 months ago
There is a newer version of this series
[PATCH 02/15] iotests/163: Fix broken qemu-io invocation
Posted by John Snow 3 years, 10 months ago
The 'read' commands to qemu-io were malformed, and this invocation only
worked by coincidence because the error messages were identical. Oops.

There's no point in checking the patterning of the reference image, so
just check the empty image by itself instead.

(Note: as of this commit, nothing actually enforces that this command
completes successfully, but a forthcoming commit in this series will
enforce that qemu_io() must have a zero status code.)

Signed-off-by: John Snow <jsnow@redhat.com>
---
 tests/qemu-iotests/163 | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tests/qemu-iotests/163 b/tests/qemu-iotests/163
index e4cd4b230f..c94ad16f4a 100755
--- a/tests/qemu-iotests/163
+++ b/tests/qemu-iotests/163
@@ -113,10 +113,7 @@ class ShrinkBaseClass(iotests.QMPTestCase):
         qemu_img('resize',  '-f', iotests.imgfmt, '--shrink', test_img,
                  self.shrink_size)
 
-        self.assertEqual(
-            qemu_io('-c', 'read -P 0x00 %s'%self.shrink_size, test_img),
-            qemu_io('-c', 'read -P 0x00 %s'%self.shrink_size, check_img),
-            "Verifying image content")
+        qemu_io('-c', f"read -P 0x00 0 {self.shrink_size}", test_img)
 
         self.image_verify()
 
-- 
2.34.1
Re: [PATCH 02/15] iotests/163: Fix broken qemu-io invocation
Posted by Hanna Reitz 3 years, 10 months ago
On 18.03.22 21:36, John Snow wrote:
> The 'read' commands to qemu-io were malformed, and this invocation only
> worked by coincidence because the error messages were identical. Oops.
>
> There's no point in checking the patterning of the reference image, so
> just check the empty image by itself instead.
>
> (Note: as of this commit, nothing actually enforces that this command
> completes successfully, but a forthcoming commit in this series will
> enforce that qemu_io() must have a zero status code.)
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>   tests/qemu-iotests/163 | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/tests/qemu-iotests/163 b/tests/qemu-iotests/163
> index e4cd4b230f..c94ad16f4a 100755
> --- a/tests/qemu-iotests/163
> +++ b/tests/qemu-iotests/163
> @@ -113,10 +113,7 @@ class ShrinkBaseClass(iotests.QMPTestCase):
>           qemu_img('resize',  '-f', iotests.imgfmt, '--shrink', test_img,
>                    self.shrink_size)
>   
> -        self.assertEqual(
> -            qemu_io('-c', 'read -P 0x00 %s'%self.shrink_size, test_img),
> -            qemu_io('-c', 'read -P 0x00 %s'%self.shrink_size, check_img),
> -            "Verifying image content")
> +        qemu_io('-c', f"read -P 0x00 0 {self.shrink_size}", test_img)

I’m actually puzzled by the original intent here.  check_img doesn’t 
contain 0x00 in that area...

Well.

Reviewed-by: Hanna Reitz <hreitz@redhat.com>


Re: [PATCH 02/15] iotests/163: Fix broken qemu-io invocation
Posted by Eric Blake 3 years, 10 months ago
On Fri, Mar 18, 2022 at 04:36:42PM -0400, John Snow wrote:
> The 'read' commands to qemu-io were malformed, and this invocation only
> worked by coincidence because the error messages were identical. Oops.
> 
> There's no point in checking the patterning of the reference image, so
> just check the empty image by itself instead.
> 
> (Note: as of this commit, nothing actually enforces that this command
> completes successfully, but a forthcoming commit in this series will
> enforce that qemu_io() must have a zero status code.)
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  tests/qemu-iotests/163 | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/tests/qemu-iotests/163 b/tests/qemu-iotests/163
> index e4cd4b230f..c94ad16f4a 100755
> --- a/tests/qemu-iotests/163
> +++ b/tests/qemu-iotests/163
> @@ -113,10 +113,7 @@ class ShrinkBaseClass(iotests.QMPTestCase):
>          qemu_img('resize',  '-f', iotests.imgfmt, '--shrink', test_img,
>                   self.shrink_size)
>  
> -        self.assertEqual(
> -            qemu_io('-c', 'read -P 0x00 %s'%self.shrink_size, test_img),
> -            qemu_io('-c', 'read -P 0x00 %s'%self.shrink_size, check_img),
> -            "Verifying image content")
> +        qemu_io('-c', f"read -P 0x00 0 {self.shrink_size}", test_img)

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

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org