qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Thomas Huth <thuth@redhat.com>,
	Laurent Vivier <lvivier@redhat.com>,
	qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 5/6] tests/libqtest: Move global_test wrapper function into a separate header
Date: Wed, 4 Sep 2019 09:23:22 -0500	[thread overview]
Message-ID: <f374e357-8822-52c4-ff8d-44f9790565c7@redhat.com> (raw)
In-Reply-To: <20190904130047.25808-6-thuth@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 2463 bytes --]

On 9/4/19 8:00 AM, Thomas Huth wrote:
> We want libqtest.h to become completely independen from global_qtest

independent

> (so that the wrapper functions are not used by accident anymore). As
> a first step, move the wrapper functions into a separate header file.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  MAINTAINERS             |   2 +-
>  tests/libqtest-single.h | 311 ++++++++++++++++++++++++++++++++++++++++
>  tests/libqtest.c        |  11 --
>  tests/libqtest.h        | 287 +-----------------------------------
>  4 files changed, 313 insertions(+), 298 deletions(-)
>  create mode 100644 tests/libqtest-single.h
> 

> +/**
> + * qmp:
> + * @fmt...: QMP message to send to qemu, formatted like
> + * qobject_from_jsonf_nofail().  See parse_escape() for what's
> + * supported after '%'.
> + *
> + * Sends a QMP message to QEMU and returns the response.
> + */
> +GCC_FMT_ATTR(1, 2)
> +static inline QDict *qmp(const char *fmt, ...)
> +{

I'm a bit surprised gcc doesn't complain about inlining a va_arg
function, but since it works, I'm fine with the approach.

> +++ b/tests/libqtest.c
> @@ -1106,17 +1106,6 @@ void qtest_memset(QTestState *s, uint64_t addr, uint8_t pattern, size_t size)
>      qtest_rsp(s, 0);
>  }
>  
> -QDict *qmp(const char *fmt, ...)
> -{
> -    va_list ap;
> -    QDict *response;
> -
> -    va_start(ap, fmt);
> -    response = qtest_vqmp(global_qtest, fmt, ap);
> -    va_end(ap);
> -    return response;
> -}
> -

Nice - we've reduced the use of global_qtest to just a single optional
header!

> +++ b/tests/libqtest.h

> -/**
> - * clock_step:
> - * @step: Number of nanoseconds to advance the clock by.
> - *
> - * Advance the QEMU_CLOCK_VIRTUAL by @step nanoseconds.
> - *
> - * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
> - */
> -static inline int64_t clock_step(int64_t step)
> -{
> -    return qtest_clock_step(global_qtest, step);
> -}
> +#include "libqtest-single.h"

Well, almost.  I guess this commit is the code motion, and the next one
actually fixes clients to track the rename, so this #include is
temporary (I hope).  It's just churn to put a TODO comment in this
commit that would get removed in the next.  So,

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-09-04 14:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04 13:00 [Qemu-devel] [PATCH v2 0/6] Make the core libqtest library independe from global_qtest Thomas Huth
2019-09-04 13:00 ` [Qemu-devel] [PATCH v2 1/6] tests/migration: Do not use functions anymore that rely on global_qtest Thomas Huth
2019-09-04 18:52   ` Stefan Hajnoczi
2019-09-04 13:00 ` [Qemu-devel] [PATCH v2 2/6] tests/libqos/e1000e: Make e1000e libqos functions independent from global_qtest Thomas Huth
2019-09-04 18:52   ` Stefan Hajnoczi
2019-09-04 13:00 ` [Qemu-devel] [PATCH v2 3/6] tests/libqos: Replace clock_step with qtest_clock_step in virtio code Thomas Huth
2019-09-04 14:17   ` Eric Blake
2019-09-04 18:52   ` Stefan Hajnoczi
2019-09-04 13:00 ` [Qemu-devel] [PATCH v2 4/6] tests: Remove unnecessary global_qtest references Thomas Huth
2019-09-04 14:18   ` Eric Blake
2019-09-04 18:52   ` Stefan Hajnoczi
2019-09-04 13:00 ` [Qemu-devel] [PATCH v2 5/6] tests/libqtest: Move global_test wrapper function into a separate header Thomas Huth
2019-09-04 14:23   ` Eric Blake [this message]
2019-09-04 18:51   ` Stefan Hajnoczi
2019-09-04 19:09     ` Eric Blake
2019-09-05  7:06       ` Thomas Huth
2019-09-04 13:00 ` [Qemu-devel] [PATCH v2 6/6] tests/libqtest: Use libqtest-single.h in tests that require global_qtest Thomas Huth
2019-09-04 14:25   ` Eric Blake
2019-09-04 18:52   ` Stefan Hajnoczi
2019-09-04 18:52 ` [Qemu-devel] [PATCH v2 0/6] Make the core libqtest library independe from global_qtest Stefan Hajnoczi

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=f374e357-8822-52c4-ff8d-44f9790565c7@redhat.com \
    --to=eblake@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@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).