diff options
author | John Snow | 2022-03-21 21:16:10 +0100 |
---|---|---|
committer | Hanna Reitz | 2022-03-22 10:14:34 +0100 |
commit | 1670ae7af668958e76be6749f1f729d6dc9861e9 (patch) | |
tree | 09f439af49b7a078bfe58956405d8414238f32f2 /tests/qemu-iotests/041 | |
parent | iotests/remove-bitmap-from-backing: use qemu_img_info() (diff) | |
download | qemu-1670ae7af668958e76be6749f1f729d6dc9861e9.tar.gz qemu-1670ae7af668958e76be6749f1f729d6dc9861e9.tar.xz 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/041')
-rwxr-xr-x | tests/qemu-iotests/041 | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 index db9f5dc540..3e16acee56 100755 --- a/tests/qemu-iotests/041 +++ b/tests/qemu-iotests/041 @@ -24,7 +24,7 @@ import os import re import json import iotests -from iotests import qemu_img, qemu_img_pipe, qemu_io +from iotests import qemu_img, qemu_img_map, qemu_io backing_img = os.path.join(iotests.test_dir, 'backing.img') target_backing_img = os.path.join(iotests.test_dir, 'target-backing.img') @@ -1360,8 +1360,7 @@ class TestFilters(iotests.QMPTestCase): self.vm.qmp('blockdev-del', node_name='target') - target_map = qemu_img_pipe('map', '--output=json', target_img) - target_map = json.loads(target_map) + target_map = qemu_img_map(target_img) assert target_map[0]['start'] == 0 assert target_map[0]['length'] == 512 * 1024 |