Received: from eggs.gnu.org ([2001:4830:134:3::10]:35236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9cPu-0005Ox-Ae for qemu-devel@nongnu.org; Sat, 01 Feb 2014 10:23:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W9cPo-0005Mn-UY for qemu-devel@nongnu.org; Sat, 01 Feb 2014 10:23:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34238) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9cPo-0005Mc-Mk for qemu-devel@nongnu.org; Sat, 01 Feb 2014 10:23:28 -0500 Date: Sat, 1 Feb 2014 23:23:27 +0800 From: Fam Zheng Message-ID: <20140201152327.GB6756@T430.redhat.com> References: <1390984843-2101-1-git-send-email-famz@redhat.com> <1390984843-2101-3-git-send-email-famz@redhat.com> <20140129142209.GE23531@stefanha-thinkpad.muc.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140129142209.GE23531@stefanha-thinkpad.muc.redhat.com> Subject: Re: [Qemu-devel] [PATCH 2/4] qemu-iotests: Add VM method qtest_cmd() to iotests.py List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , =?iso-8859-1?Q?Beno=EEt?= Canet , qemu-devel@nongnu.org On Wed, 01/29 15:22, Stefan Hajnoczi wrote: > 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 > > --- > > 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. > OK, good idea, I'll respin for a better qtest support. Fam