From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbUXn-0003Vh-JS for qemu-devel@nongnu.org; Wed, 30 Oct 2013 08:06:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbUXh-000628-Db for qemu-devel@nongnu.org; Wed, 30 Oct 2013 08:06:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54194) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbUXh-00061z-5P for qemu-devel@nongnu.org; Wed, 30 Oct 2013 08:06:33 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9UC6WGv007249 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 30 Oct 2013 08:06:32 -0400 Date: Wed, 30 Oct 2013 13:06:29 +0100 From: Kevin Wolf Message-ID: <20131030120629.GH2807@dhcp-200-207.str.redhat.com> References: <1382978620-16641-1-git-send-email-pbonzini@redhat.com> <1382978620-16641-3-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1382978620-16641-3-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH 02/24] libqtest: return progress from qmp/qmpv List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, stefanha@redhat.com, mst@redhat.com Am 28.10.2013 um 17:43 hat Paolo Bonzini geschrieben: > Signed-off-by: Paolo Bonzini > --- > tests/libqtest.c | 10 +++++++--- > tests/libqtest.h | 17 +++++++++++------ > 2 files changed, 18 insertions(+), 9 deletions(-) > > diff --git a/tests/libqtest.c b/tests/libqtest.c > index bb82069..5205a43 100644 > --- a/tests/libqtest.c > +++ b/tests/libqtest.c > @@ -291,7 +291,7 @@ redo: > return words; > } > > -void qtest_qmpv(QTestState *s, const char *fmt, va_list ap) > +bool qtest_qmpv(QTestState *s, const char *fmt, va_list ap) > { > bool has_reply = false; > int nesting = 0; > @@ -324,15 +324,19 @@ void qtest_qmpv(QTestState *s, const char *fmt, va_list ap) > break; > } > } > + return has_reply; > } > > -void qtest_qmp(QTestState *s, const char *fmt, ...) > +bool qtest_qmp(QTestState *s, const char *fmt, ...) > { > va_list ap; > + bool has_reply; > > va_start(ap, fmt); > - qtest_qmpv(s, fmt, ap); > + has_reply = qtest_qmpv(s, fmt, ap); > va_end(ap); > + > + return has_reply; > } > > const char *qtest_get_arch(void) > diff --git a/tests/libqtest.h b/tests/libqtest.h > index a6e99bd..e8a4e34 100644 > --- a/tests/libqtest.h > +++ b/tests/libqtest.h > @@ -48,9 +48,10 @@ void qtest_quit(QTestState *s); > * @s: #QTestState instance to operate on. > * @fmt...: QMP message to send to qemu > * > - * Sends a QMP message to QEMU > + * Sends a QMP message to QEMU. Returns true if there > + * was a reply. > */ > -void qtest_qmp(QTestState *s, const char *fmt, ...); > +bool qtest_qmp(QTestState *s, const char *fmt, ...); > > /** > * qtest_qmpv: > @@ -58,9 +59,10 @@ void qtest_qmp(QTestState *s, const char *fmt, ...); > * @fmt: QMP message to send to QEMU > * @ap: QMP message arguments > * > - * Sends a QMP message to QEMU. > + * Sends a QMP message to QEMU. Returns true if there > + * was a reply. > */ > -void qtest_qmpv(QTestState *s, const char *fmt, va_list ap); > +bool qtest_qmpv(QTestState *s, const char *fmt, va_list ap); > > /** > * qtest_get_irq: > @@ -336,13 +338,16 @@ static inline void qtest_end(void) > * > * Sends a QMP message to QEMU > */ > -static inline void qmp(const char *fmt, ...) > +static inline bool qmp(const char *fmt, ...) > { > va_list ap; > + bool has_reply; > > va_start(ap, fmt); > - qtest_qmpv(global_qtest, fmt, ap); > + has_reply = qtest_qmpv(global_qtest, fmt, ap); > va_end(ap); > + > + return has_reply; > } Can this ever return false? If there isn't a reply, doesn't it wait until it receives one? Anyway, I think Stefan had some patches to actually get the reply in a usable way. They probably conflict with this. Perhaps just applying Stefan's patches already gives you what you need here? Kevin