[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/6] iotests: add hmp helper with logging
From: |
John Snow |
Subject: |
[PATCH 4/6] iotests: add hmp helper with logging |
Date: |
Mon, 24 Feb 2020 19:56:39 -0500 |
Just a mild cleanup while I was here.
Signed-off-by: John Snow <address@hidden>
---
tests/qemu-iotests/iotests.py | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 8815052eb5..5d2990a0e4 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -525,23 +525,27 @@ def add_incoming(self, addr):
self._args.append(addr)
return self
+ def hmp(self, command_line, log=False):
+ cmd = 'human-monitor-command'
+ kwargs = { 'command-line': command_line }
+ if log:
+ return self.qmp_log(cmd, **kwargs)
+ return self.qmp(cmd, **kwargs)
+
def pause_drive(self, drive, event=None):
'''Pause drive r/w operations'''
if not event:
self.pause_drive(drive, "read_aio")
self.pause_drive(drive, "write_aio")
return
- self.qmp('human-monitor-command',
- command_line='qemu-io %s "break %s bp_%s"' % (drive,
event, drive))
+ self.hmp('qemu-io %s "break %s bp_%s"' % (drive, event, drive))
def resume_drive(self, drive):
- self.qmp('human-monitor-command',
- command_line='qemu-io %s "remove_break bp_%s"' % (drive,
drive))
+ self.hmp('qemu-io %s "remove_break bp_%s"' % (drive, drive))
- def hmp_qemu_io(self, drive, cmd):
+ def hmp_qemu_io(self, drive, cmd, log=False):
'''Write to a given drive using an HMP command'''
- return self.qmp('human-monitor-command',
- command_line='qemu-io %s "%s"' % (drive, cmd))
+ return self.hmp('qemu-io %s "%s"' % (drive, cmd), log=log)
def flatten_qmp_object(self, obj, output=None, basestr=''):
if output is None:
--
2.21.1
[PATCH 5/6] qmp.py: change event_wait to use a dict, John Snow, 2020/02/24
[PATCH 3/6] iotests: move bitmap helpers into their own file, John Snow, 2020/02/24