iotests: use qemu_img_json() when applicable
authorJohn Snow <jsnow@redhat.com>
Mon, 21 Mar 2022 20:16:07 +0000 (16:16 -0400)
committerHanna Reitz <hreitz@redhat.com>
Tue, 22 Mar 2022 09:14:29 +0000 (10:14 +0100)
qemu_img_json() gives better diagnostic information on failure.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20220321201618.903471-8-jsnow@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
tests/qemu-iotests/iotests.py

index 56aa0682777f7c341b9ff6032d77b4dc5311ebda..4725313150b1dc7cfc759a3a34f7e4a958f72ceb 100644 (file)
@@ -309,11 +309,11 @@ def qemu_img_json(*args: str) -> Any:
 
     return json.loads(res.stdout)
 
-def qemu_img_measure(*args):
-    return json.loads(qemu_img_pipe("measure", "--output", "json", *args))
+def qemu_img_measure(*args: str) -> Any:
+    return qemu_img_json("measure", "--output", "json", *args)
 
-def qemu_img_check(*args):
-    return json.loads(qemu_img_pipe("check", "--output", "json", *args))
+def qemu_img_check(*args: str) -> Any:
+    return qemu_img_json("check", "--output", "json", *args)
 
 def qemu_img_pipe(*args: str) -> str:
     '''Run qemu-img and return its output'''