summary refs log tree commit diff stats
path: root/tests/qemu-iotests/iotests.py
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2022-03-21 16:16:10 -0400
committerHanna Reitz <hreitz@redhat.com>2022-03-22 10:14:34 +0100
commit1670ae7af668958e76be6749f1f729d6dc9861e9 (patch)
tree09f439af49b7a078bfe58956405d8414238f32f2 /tests/qemu-iotests/iotests.py
parentac5bb4861c233c9483d89dff7ef0fa6f799ca1e7 (diff)
downloadfocaccia-qemu-1670ae7af668958e76be6749f1f729d6dc9861e9.tar.gz
focaccia-qemu-1670ae7af668958e76be6749f1f729d6dc9861e9.zip
iotests: add qemu_img_map() function
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>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20220321201618.903471-11-jsnow@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/iotests.py')
-rw-r--r--tests/qemu-iotests/iotests.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 2a1c589b76..b3e793f78a 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -318,6 +318,9 @@ def qemu_img_check(*args: str) -> Any:
 def qemu_img_info(*args: str) -> Any:
     return qemu_img_json('info', "--output", "json", *args)
 
+def qemu_img_map(*args: str) -> Any:
+    return qemu_img_json('map', "--output", "json", *args)
+
 def qemu_img_pipe(*args: str) -> str:
     '''Run qemu-img and return its output'''
     return qemu_img_pipe_and_status(*args)[0]