qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>, qemu-devel@nongnu.org
Cc: paolo.bonzini@gmail.com, berrange@redhat.com,
	qemu-stable@nongnu.org, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 3/3] tests: start generic qemu-qmp tests
Date: Thu, 22 Sep 2016 14:13:06 -0500	[thread overview]
Message-ID: <672b17db-a022-4bae-1ed4-6d497540ee72@redhat.com> (raw)
In-Reply-To: <20160922184849.30524-4-marcandre.lureau@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1808 bytes --]

On 09/22/2016 01:48 PM, Marc-André Lureau wrote:
> These 2 tests exhibit two qmp bugs fixed by the previous patches.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
> ---
>  tests/test-qemu-qmp.c  | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/Makefile.include |  2 ++
>  2 files changed, 63 insertions(+)
>  create mode 100644 tests/test-qemu-qmp.c
> 
> diff --git a/tests/test-qemu-qmp.c b/tests/test-qemu-qmp.c
> new file mode 100644
> index 0000000..3cdee59
> --- /dev/null
> +++ b/tests/test-qemu-qmp.c
> @@ -0,0 +1,61 @@
> +#include "qemu/osdep.h"
> +#include "libqtest.h"
> +

No copyright blurb? The default GPLv2+ is fine, but being explicit never
hurts.

> +
> +static void test_object_add_without_props(void)
> +{
> +    QDict *ret, *error;
> +    const gchar *class, *desc;
> +
> +    ret = qmp("{'execute': 'object-add',"
> +              " 'arguments': { 'qom-type': 'memory-backend-ram', 'id': 'ram1' } }");
> +    g_assert_nonnull(ret);
> +
> +    error = qdict_get_qdict(ret, "error");
> +    class = qdict_get_try_str(error, "class");

This variable won't compile with C++; should you rename it to 'klass'
just in case, since we already have part of qemu being built by C++ for
the sake of qga on Windows?

> +    desc = qdict_get_try_str(error, "desc");
> +
> +    g_assert_cmpstr(class, ==, "GenericError");
> +    g_assert_cmpstr(desc, ==, "can't create backend with size 0");

A little bit fragile to be parsing for a particular error message
wording, but I guess I can live with it.

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

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


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

  reply	other threads:[~2016-09-22 19:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22 18:48 [Qemu-devel] [PATCH v3 0/3] Fix some qapi assert() Marc-André Lureau
2016-09-22 18:48 ` [Qemu-devel] [PATCH v3 1/3] qmp: fix object-add assert() without props Marc-André Lureau
2016-09-22 18:48 ` [Qemu-devel] [PATCH v3 2/3] qapi: fix crash when a parameter is missing Marc-André Lureau
2016-09-22 18:48 ` [Qemu-devel] [PATCH v3 3/3] tests: start generic qemu-qmp tests Marc-André Lureau
2016-09-22 19:13   ` Eric Blake [this message]
2016-09-22 19:23   ` Eric Blake

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=672b17db-a022-4bae-1ed4-6d497540ee72@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=paolo.bonzini@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /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).