|
|
357786 |
From d44774708b8db31c5e2658ea64ee930ffdae39be Mon Sep 17 00:00:00 2001
|
|
|
357786 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
357786 |
Date: Tue, 26 Jun 2018 09:48:42 +0200
|
|
|
357786 |
Subject: [PATCH 73/89] qemu-iotests: Add VM.qmp_log()
|
|
|
357786 |
|
|
|
357786 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
357786 |
Message-id: <20180626094856.6924-60-kwolf@redhat.com>
|
|
|
357786 |
Patchwork-id: 81067
|
|
|
357786 |
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH v2 59/73] qemu-iotests: Add VM.qmp_log()
|
|
|
357786 |
Bugzilla: 1513543
|
|
|
357786 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
357786 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
357786 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
357786 |
|
|
|
357786 |
This adds a helper function that logs both the QMP request and the
|
|
|
357786 |
received response before returning it.
|
|
|
357786 |
|
|
|
357786 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
357786 |
Reviewed-by: Jeff Cody <jcody@redhat.com>
|
|
|
357786 |
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
|
|
357786 |
(cherry picked from commit e234398a8e142fd0cfe571f7efb0e6a2f34fe73d)
|
|
|
357786 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
357786 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
357786 |
---
|
|
|
357786 |
tests/qemu-iotests/iotests.py | 11 +++++++++++
|
|
|
357786 |
1 file changed, 11 insertions(+)
|
|
|
357786 |
|
|
|
357786 |
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
|
|
|
357786 |
index 7e311ed..bc5731a 100644
|
|
|
357786 |
--- a/tests/qemu-iotests/iotests.py
|
|
|
357786 |
+++ b/tests/qemu-iotests/iotests.py
|
|
|
357786 |
@@ -215,6 +215,10 @@ def filter_qmp_event(event):
|
|
|
357786 |
event['timestamp']['microseconds'] = 'USECS'
|
|
|
357786 |
return event
|
|
|
357786 |
|
|
|
357786 |
+def filter_testfiles(msg):
|
|
|
357786 |
+ prefix = os.path.join(test_dir, "%s-" % (os.getpid()))
|
|
|
357786 |
+ return msg.replace(prefix, 'TEST_DIR/PID-')
|
|
|
357786 |
+
|
|
|
357786 |
def log(msg, filters=[]):
|
|
|
357786 |
for flt in filters:
|
|
|
357786 |
msg = flt(msg)
|
|
|
357786 |
@@ -398,6 +402,13 @@ class VM(qtest.QEMUQtestMachine):
|
|
|
357786 |
result.append(filter_qmp_event(ev))
|
|
|
357786 |
return result
|
|
|
357786 |
|
|
|
357786 |
+ def qmp_log(self, cmd, filters=[filter_testfiles], **kwargs):
|
|
|
357786 |
+ logmsg = "{'execute': '%s', 'arguments': %s}" % (cmd, kwargs)
|
|
|
357786 |
+ log(logmsg, filters)
|
|
|
357786 |
+ result = self.qmp(cmd, **kwargs)
|
|
|
357786 |
+ log(str(result), filters)
|
|
|
357786 |
+ return result
|
|
|
357786 |
+
|
|
|
357786 |
|
|
|
357786 |
index_re = re.compile(r'([^\[]+)\[([^\]]+)\]')
|
|
|
357786 |
|
|
|
357786 |
--
|
|
|
357786 |
1.8.3.1
|
|
|
357786 |
|