[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 03/21] iotests: Add _filter_json_filename
From: |
Max Reitz |
Subject: |
[PATCH v2 03/21] iotests: Add _filter_json_filename |
Date: |
Tue, 15 Oct 2019 16:27:11 +0200 |
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/common.filter | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index 9f418b4881..63bc6f6f26 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -227,5 +227,29 @@ _filter_qmp_empty_return()
grep -v '{"return": {}}'
}
+_filter_json_filename()
+{
+ $PYTHON -c 'import sys
+result, *fnames = sys.stdin.read().split("json:{")
+depth = 0
+for fname in fnames:
+ depth += 1 # For the opening brace in the split separator
+ for chr_i, chr in enumerate(fname):
+ if chr == "{":
+ depth += 1
+ elif chr == "}":
+ depth -= 1
+ if depth == 0:
+ break
+
+ # json:{} filenames may be nested; filter out everything from
+ # inside the outermost one
+ if depth == 0:
+ chr_i += 1 # First character past the filename
+ result += "json:{ /* filtered */ }" + fname[chr_i:]
+
+sys.stdout.write(result)'
+}
+
# make sure this script returns success
true
--
2.21.0
- [PATCH v2 00/21] iotests: Allow ./check -o data_file, Max Reitz, 2019/10/15
- [PATCH v2 01/21] iotests/qcow2.py: Add dump-header-exts, Max Reitz, 2019/10/15
- [PATCH v2 03/21] iotests: Add _filter_json_filename,
Max Reitz <=
- [PATCH v2 02/21] iotests/qcow2.py: Split feature fields into bits, Max Reitz, 2019/10/15
- [PATCH v2 04/21] iotests: Filter refcount_order in 036, Max Reitz, 2019/10/15
- [PATCH v2 05/21] iotests: Replace IMGOPTS by _unsupported_imgopts, Max Reitz, 2019/10/15
- [PATCH v2 06/21] iotests: Drop compat=1.1 in 050, Max Reitz, 2019/10/15
- [PATCH v2 07/21] iotests: Let _make_test_img parse its parameters, Max Reitz, 2019/10/15
- [PATCH v2 08/21] iotests: Add -o and --no-opts to _make_test_img, Max Reitz, 2019/10/15
- [PATCH v2 09/21] iotests: Inject space into -ocompat=0.10 in 051, Max Reitz, 2019/10/15
- [PATCH v2 12/21] iotests: Drop IMGOPTS use in 267, Max Reitz, 2019/10/15
- [PATCH v2 11/21] iotests: Replace IMGOPTS='' by --no-opts, Max Reitz, 2019/10/15
- [PATCH v2 13/21] iotests: Avoid qemu-img create, Max Reitz, 2019/10/15