[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-stable] [PATCH v3 3/3] tests: start generic qemu-qmp tests
From: |
Eric Blake |
Subject: |
Re: [Qemu-stable] [PATCH v3 3/3] tests: start generic qemu-qmp tests |
Date: |
Thu, 22 Sep 2016 14:13:06 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
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 <address@hidden>
> Reviewed-by: Daniel P. Berrange <address@hidden>
> ---
> 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 <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature