[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/4] qemu-iotests: Add VM method qtest_cmd() to
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 2/4] qemu-iotests: Add VM method qtest_cmd() to iotests.py |
Date: |
Wed, 29 Jan 2014 15:22:09 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Wed, Jan 29, 2014 at 04:40:41PM +0800, Fam Zheng wrote:
> 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)
Commit 0fd05e8dd1ee7ae143fba3d6bcc6abe3fbeaeb34 ("qemu-iotests: start
vms in qtest mode") put qtest on stdio. I think that was a mistake and
it should be fixed if you want to drive qtest.
Let's not mix qtest output with QEMU stderr. If you need to drive
qtest, put it on a dedicated UNIX domain socket
(just like QMP).
Implement the qtest protocol as documented in qtest.c:
* Line based protocol, request/response based. Server can send async messages
* so clients should always handle many async messages before the response
* comes in.
Stefan