qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/4] qemu-iotests: Add VM method qtest_cmd() to iote


From: Fam Zheng
Subject: [Qemu-devel] [PATCH 2/4] qemu-iotests: Add VM method qtest_cmd() to iotests.py
Date: Wed, 29 Jan 2014 16:40:41 +0800

This will allow test case to run command in qtest protocol. It's
write-only for now.

Signed-off-by: Fam Zheng <address@hidden>
---
 tests/qemu-iotests/iotests.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index e4fa9af..ca79d09 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -153,13 +153,16 @@ class VM(object):
                              stderr=sys.stderr)
         return p.wait()
 
+    def qtest_cmd(self, cmd):
+        self._popen.stdin.write(cmd + "\n")
+
     def launch(self):
         '''Launch the VM and establish a QMP connection'''
-        devnull = open('/dev/null', 'rb')
         qemulog = open(self._qemu_log_path, 'wb')
         try:
             self._qmp = qmp.QEMUMonitorProtocol(self._monitor_path, 
server=True)
-            self._popen = subprocess.Popen(self._args, stdin=devnull, 
stdout=qemulog,
+            self._popen = subprocess.Popen(self._args, stdin=subprocess.PIPE,
+                                           stdout=qemulog,
                                            stderr=subprocess.STDOUT)
             self._qmp.accept()
         except:
-- 
1.8.5.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]