diff mbox series

[11/67] iotests/224: Filter json:{} from commit command

Message ID 20191001194715.2796-12-mreitz@redhat.com
State New
Headers show
Series iotests: Honor $IMGOPTS in Python tests | expand

Commit Message

Max Reitz Oct. 1, 2019, 7:46 p.m. UTC
We only care that block-commit works with json:{} filenames, we do not
need to see their exact values in the output.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/224     | 15 ++++++++++++---
 tests/qemu-iotests/224.out |  4 ++--
 2 files changed, 14 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/tests/qemu-iotests/224 b/tests/qemu-iotests/224
index d0d0c44104..e227d3ab3c 100755
--- a/tests/qemu-iotests/224
+++ b/tests/qemu-iotests/224
@@ -22,12 +22,19 @@ 
 
 import iotests
 from iotests import log, qemu_img, qemu_io_silent, filter_qmp_testfiles, \
-                    filter_qmp_imgfmt
+                    filter_qmp_imgfmt, filter_json_filename
 import json
+import re
 
 # Need backing file support (for arbitrary backing formats)
 iotests.script_initialize(supported_fmts=['qcow2', 'qcow', 'qed'])
 
+def filter_json_top_or_base(qmsg):
+    def _filter(key, value):
+        if key == 'base' or key == 'top':
+            return filter_json_filename(value)
+        return value
+    return iotests.filter_qmp(qmsg, _filter)
 
 # There are two variations of this test:
 # (1) We do not set filter_node_name.  In that case, the commit_top
@@ -104,7 +111,8 @@  for filter_node_name in False, True:
                         top=mid_name,
                         base=base_name,
                         speed=1,
-                        filters=[filter_qmp_testfiles, filter_qmp_imgfmt])
+                        filters=[filter_qmp_testfiles, filter_qmp_imgfmt,
+                                 filter_json_top_or_base])
         else:
             vm.qmp_log('block-commit',
                         job_id='commit',
@@ -112,7 +120,8 @@  for filter_node_name in False, True:
                         top=mid_name,
                         base=base_name,
                         speed=1,
-                        filters=[filter_qmp_testfiles, filter_qmp_imgfmt])
+                        filters=[filter_qmp_testfiles, filter_qmp_imgfmt,
+                                 filter_json_top_or_base])
 
         vm.qmp_log('job-pause', id='commit')
 
diff --git a/tests/qemu-iotests/224.out b/tests/qemu-iotests/224.out
index 23374a1d29..287d2eac7a 100644
--- a/tests/qemu-iotests/224.out
+++ b/tests/qemu-iotests/224.out
@@ -3,7 +3,7 @@ 
 
 {"execute": "blockdev-add", "arguments": {"backing": {"backing": {"backing": {"driver": "null-co"}, "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/PID-base.img"}, "node-name": "base"}, "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/PID-mid.img"}, "node-name": "mid"}, "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/PID-top.img"}, "node-name": "top"}}
 {"return": {}}
-{"execute": "block-commit", "arguments": {"base": "json:{\"backing\": {\"driver\": \"null-co\"}, \"driver\": \"IMGFMT\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/PID-base.img\"}}", "device": "top", "job-id": "commit", "speed": 1, "top": "json:{\"backing\": {\"backing\": {\"driver\": \"null-co\"}, \"driver\": \"IMGFMT\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/PID-base.img\"}}, \"driver\": \"IMGFMT\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/PID-mid.img\"}}"}}
+{"execute": "block-commit", "arguments": {"base": "json:{ /* filtered */ }", "device": "top", "job-id": "commit", "speed": 1, "top": "json:{ /* filtered */ }"}}
 {"return": {}}
 {"execute": "job-pause", "arguments": {"id": "commit"}}
 {"return": {}}
@@ -12,7 +12,7 @@ 
 
 {"execute": "blockdev-add", "arguments": {"backing": {"backing": {"backing": {"driver": "null-co"}, "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/PID-base.img"}, "node-name": "base"}, "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/PID-mid.img"}, "node-name": "mid"}, "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/PID-top.img"}, "node-name": "top"}}
 {"return": {}}
-{"execute": "block-commit", "arguments": {"base": "json:{\"backing\": {\"driver\": \"null-co\"}, \"driver\": \"IMGFMT\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/PID-base.img\"}}", "device": "top", "filter-node-name": "filter_node", "job-id": "commit", "speed": 1, "top": "json:{\"backing\": {\"backing\": {\"driver\": \"null-co\"}, \"driver\": \"IMGFMT\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/PID-base.img\"}}, \"driver\": \"IMGFMT\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/PID-mid.img\"}}"}}
+{"execute": "block-commit", "arguments": {"base": "json:{ /* filtered */ }", "device": "top", "filter-node-name": "filter_node", "job-id": "commit", "speed": 1, "top": "json:{ /* filtered */ }"}}
 {"return": {}}
 {"execute": "job-pause", "arguments": {"id": "commit"}}
 {"return": {}}