[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 05/11] tests: add output filter to python I/O tes
From: |
Daniel P. Berrange |
Subject: |
[Qemu-devel] [PATCH v6 05/11] tests: add output filter to python I/O tests helper |
Date: |
Mon, 21 Mar 2016 14:11:46 +0000 |
Add a 'log' method to iotests.py which prints messages to
stdout, with optional filtering of data. Port over some
standard filters already present in the shell common.filter
code to be usable in python too.
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Daniel P. Berrange <address@hidden>
---
tests/qemu-iotests/iotests.py | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 51e53bb..8499e1b 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -30,7 +30,8 @@ import struct
__all__ = ['imgfmt', 'imgproto', 'test_dir' 'qemu_img', 'qemu_io',
'VM', 'QMPTestCase', 'notrun', 'main', 'verify_image_format',
- 'verify_platform']
+ 'verify_platform', 'filter_test_dir', 'filter_win32',
+ 'filter_qemu_io', 'filter_chown', 'log']
# This will not work if arguments contain spaces but is necessary if we
# want to support the override options that ./check supports.
@@ -105,6 +106,28 @@ def create_image(name, size):
i = i + 512
file.close()
+test_dir_re = re.compile(r"%s" % test_dir)
+def filter_test_dir(msg):
+ return test_dir_re.sub("TEST_DIR", msg)
+
+win32_re = re.compile(r"\r")
+def filter_win32(msg):
+ return win32_re.sub("", msg)
+
+qemu_io_re = re.compile(r"[0-9]* ops; [0-9\/:. sec]* \([0-9\/.inf]*
[EPTGMKiBbytes]*\/sec and [0-9\/.inf]* ops\/sec\)")
+def filter_qemu_io(msg):
+ msg = filter_win32(msg)
+ return qemu_io_re.sub("X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)",
msg)
+
+chown_re = re.compile(r"chown [0-9]+:[0-9]+")
+def filter_chown(msg):
+ return chown_re.sub("chown UID:GID", msg)
+
+def log(msg, filters=[]):
+ for flt in filters:
+ msg = flt(msg)
+ print msg
+
# Test if 'match' is a recursive subset of 'event'
def event_match(event, match=None):
if match is None:
--
2.5.0
- [Qemu-devel] [PATCH v6 00/11] Add new LUKS block driver (for 2.6), Daniel P. Berrange, 2016/03/21
- [Qemu-devel] [PATCH v6 04/11] tests: refactor python I/O tests helper main method, Daniel P. Berrange, 2016/03/21
- [Qemu-devel] [PATCH v6 03/11] tests: redirect stderr to stdout for iotests, Daniel P. Berrange, 2016/03/21
- [Qemu-devel] [PATCH v6 05/11] tests: add output filter to python I/O tests helper,
Daniel P. Berrange <=
- [Qemu-devel] [PATCH v6 01/11] block: add flag to indicate that no I/O will be performed, Daniel P. Berrange, 2016/03/21
- [Qemu-devel] [PATCH v6 02/11] qemu-img/qemu-io: don't prompt for passwords if not required, Daniel P. Berrange, 2016/03/21
- [Qemu-devel] [PATCH v6 08/11] block: add support for --image-opts in block I/O tests, Daniel P. Berrange, 2016/03/21
- [Qemu-devel] [PATCH v6 06/11] block: add generic full disk encryption driver, Daniel P. Berrange, 2016/03/21
- [Qemu-devel] [PATCH v6 07/11] block: move encryption deprecation warning into qcow code, Daniel P. Berrange, 2016/03/21
- [Qemu-devel] [PATCH v6 09/11] block: add support for encryption secrets in block I/O tests, Daniel P. Berrange, 2016/03/21