qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH 02/24] libqtest: return progress from qmp/qmpv
Date: Wed, 30 Oct 2013 13:06:29 +0100	[thread overview]
Message-ID: <20131030120629.GH2807@dhcp-200-207.str.redhat.com> (raw)
In-Reply-To: <1382978620-16641-3-git-send-email-pbonzini@redhat.com>

Am 28.10.2013 um 17:43 hat Paolo Bonzini geschrieben:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  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

  reply	other threads:[~2013-10-30 12:06 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28 16:43 [Qemu-devel] [WIP PATCH 00/24] IDE cleanups, initial work on AHCI rerror/werror=stop Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 01/24] blkdebug: report errors on flush too Paolo Bonzini
2013-10-30 12:01   ` Kevin Wolf
2013-10-28 16:43 ` [Qemu-devel] [PATCH 02/24] libqtest: return progress from qmp/qmpv Paolo Bonzini
2013-10-30 12:06   ` Kevin Wolf [this message]
2013-10-30 12:10     ` Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 03/24] libqtest: add QTEST_LOG for debugging qtest testcases Paolo Bonzini
2013-10-30 12:08   ` Kevin Wolf
2013-10-28 16:43 ` [Qemu-devel] [PATCH 04/24] ide-test: add test for werror=stop Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 05/24] ide: simplify reset callbacks Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 06/24] ide: simplify set_inactive callbacks Paolo Bonzini
2013-10-30 12:20   ` Kevin Wolf
2013-10-28 16:43 ` [Qemu-devel] [PATCH 07/24] ide: simplify async_cmd_done callbacks Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 08/24] ide: simplify start_transfer callbacks Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 09/24] ide: wrap start_dma callback Paolo Bonzini
2013-10-30 12:29   ` Kevin Wolf
2013-10-30 12:44     ` Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 10/24] ide: add trigger_irq callback Paolo Bonzini
2013-10-30 12:47   ` Kevin Wolf
2013-10-30 13:16     ` Paolo Bonzini
2013-10-30 13:34       ` Kevin Wolf
2013-10-30 14:33         ` Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 11/24] ide: fold add_status callback into set_inactive Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 12/24] ide: move BM_STATUS bits to pci.[ch] Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 13/24] ide: move retry constants out of BM_STATUS_* namespace Paolo Bonzini
2013-10-30 12:55   ` Kevin Wolf
2013-10-28 16:43 ` [Qemu-devel] [PATCH 14/24] ide: start extracting ide_restart_dma out of bmdma_restart_dma Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 15/24] ide: prepare to move restart to common code Paolo Bonzini
2013-10-30 12:14   ` Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 16/24] ide: introduce ide_register_restart_cb Paolo Bonzini
2013-10-30 13:13   ` Kevin Wolf
2013-10-30 13:19     ` Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 17/24] ide: do not use BMDMA in restart callback Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 18/24] ide: pass IDEBus to the restart_cb Paolo Bonzini
2013-10-30 12:19   ` Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 19/24] ide: move restart callback to common code Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 20/24] ide: remove restart_cb callback Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 21/24] ide: replace set_unit callback with more IDEBus state Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 22/24] ide: place initial state of the current request to IDEBus Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 23/24] ide: migrate initial request state via IDEBus Paolo Bonzini
2013-10-28 16:43 ` [Qemu-devel] [PATCH 24/24] ide: commonize io_buffer_index initialization Paolo Bonzini
2013-10-28 17:16 ` [Qemu-devel] [WIP PATCH 00/24] IDE cleanups, initial work on AHCI rerror/werror=stop Michael S. Tsirkin
2013-10-28 17:26   ` Paolo Bonzini
2013-10-28 18:00     ` Michael S. Tsirkin
2013-10-28 18:36       ` Paolo Bonzini
2013-10-28 18:42         ` Michael S. Tsirkin
2013-10-29  9:10           ` Paolo Bonzini
2013-10-29 18:30 ` Kevin Wolf
2013-10-30 16:56   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131030120629.GH2807@dhcp-200-207.str.redhat.com \
    --to=kwolf@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).