summaryrefslogtreecommitdiffstats
path: root/tests/qemu-iotests/041
diff options
context:
space:
mode:
authorJohn Snow2022-03-21 21:16:10 +0100
committerHanna Reitz2022-03-22 10:14:34 +0100
commit1670ae7af668958e76be6749f1f729d6dc9861e9 (patch)
tree09f439af49b7a078bfe58956405d8414238f32f2 /tests/qemu-iotests/041
parentiotests/remove-bitmap-from-backing: use qemu_img_info() (diff)
downloadqemu-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-xtests/qemu-iotests/0415
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