[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 29/30] qemu-iotests: map underscore to dash in QMP a
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 29/30] qemu-iotests: map underscore to dash in QMP argument names |
Date: |
Fri, 28 Sep 2012 19:57:12 +0200 |
From: Paolo Bonzini <address@hidden>
iotests.py provides a convenience function that uses Python keyword
arguments to represent QMP command arguments. However, almost all
QMP commands use dashes for argument names (the sole exception is
block_set_io_throttle), and dashes are not allowed in a keyword
argument name. Hence provide automatic conversion of underscores
to dashes.
Signed-off-by: Paolo Bonzini <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
tests/qemu-iotests/iotests.py | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index e05b1d6..a94ea75 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -19,6 +19,7 @@
import os
import re
import subprocess
+import string
import unittest
import sys; sys.path.append(os.path.join(os.path.dirname(__file__), '..',
'..', 'QMP'))
import qmp
@@ -96,9 +97,14 @@ class VM(object):
os.remove(self._qemu_log_path)
self._popen = None
+ underscore_to_dash = string.maketrans('_', '-')
def qmp(self, cmd, **args):
'''Invoke a QMP command and return the result dict'''
- return self._qmp.cmd(cmd, args=args)
+ qmp_args = dict()
+ for k in args.keys():
+ qmp_args[k.translate(self.underscore_to_dash)] = args[k]
+
+ return self._qmp.cmd(cmd, args=qmp_args)
def get_qmp_events(self, wait=False):
'''Poll for queued QMP events and return a list of dicts'''
--
1.7.6.5
- [Qemu-devel] [PATCH 19/30] block: add support for job pause/resume, (continued)
- [Qemu-devel] [PATCH 19/30] block: add support for job pause/resume, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 20/30] qmp: add block-job-pause and block-job-resume, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 21/30] qemu-iotests: add test for pausing a streaming operation, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 30/30] qemu-iotests: add tests for streaming error handling, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 26/30] block: introduce block job error, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 27/30] stream: add on-error argument, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 24/30] iostatus: change is_read to a bool, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 28/30] blkdebug: process all set_state rules in the old state, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 22/30] iostatus: rename BlockErrorAction, BlockQMPEventAction, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 23/30] iostatus: move BlockdevOnError declaration to QAPI, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 29/30] qemu-iotests: map underscore to dash in QMP argument names,
Kevin Wolf <=
- [Qemu-devel] [PATCH 25/30] iostatus: reorganize io error code, Kevin Wolf, 2012/09/28