qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 10/18] iotests: add qemu_img_map() function


From: John Snow
Subject: Re: [PATCH v4 10/18] iotests: add qemu_img_map() function
Date: Mon, 21 Mar 2022 12:15:13 -0400



On Mon, Mar 21, 2022, 10:24 AM Eric Blake <eblake@redhat.com> wrote:
On Thu, Mar 17, 2022 at 07:49:29PM -0400, John Snow wrote:
> Add a qemu_img_map() function by analogy with qemu_img_measure(),
> qemu_img_check(), and qemu_img_info() that all return JSON information.
>
> Replace calls to qemu_img_pipe('map', '--output=json', ...) with this
> new function, which provides better diagnostic information on failure.
>
> Note: The output for iotest 211 changes, because logging JSON after it
> was deserialized by Python behaves a little differently than logging the
> raw JSON document string itself.
> (iotests.log() sorts the keys for Python 3.6 support.)
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---

> +++ b/tests/qemu-iotests/211.out

> @@ -55,9 +53,7 @@ file format: IMGFMT
>  virtual size: 32 MiB (33554432 bytes)
>  cluster_size: 1048576

> -[{ "start": 0, "length": 3072, "depth": 0, "present": true, "zero": false, "data": true, "offset": 1024},
> -{ "start": 3072, "length": 33551360, "depth": 0, "present": true, "zero": true, "data": true, "offset": 4096}]
> -
> +[{"data": true, "depth": 0, "length": 3072, "offset": 1024, "present": true, "start": 0, "zero": false}, {"data": true, "depth": 0, "length": 33551360, "offset": 4096, "present": true, "start": 3072, "zero": true}]

The change in format can produce really long lines for a more complex
map, which can introduce its own problems in legibility. But I can
live with it.

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

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

Yeah, we don't have to print out the entire thing, either. We could also pretty-print it if we want to.

(Once we drop 3.6 (which I know is contested as to when we can do it) we can remove a lot of our special QMP sorting code and just start printing the raw JSON objects, which makes dealing with qmp a lot easier in diff-based tests.)

The point was more just to remove any copy-pastables using the JSON and provide only the "one good way". This patch in and of itself is otherwise pretty lateral.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]