Re: [Qemu-devel] [PATCH v3 3/3] tests: start generic qemu-qmp tests

2016-09-22 Thread Eric Blake
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 
> Reviewed-by: Daniel P. Berrange 
> ---
>  tests/test-qemu-qmp.c  | 61 
> ++
>  tests/Makefile.include |  2 ++
>  2 files changed, 63 insertions(+)
>  create mode 100644 tests/test-qemu-qmp.c

Please also update tests/.gitignore to ignore the new executable.

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



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH v3 3/3] tests: start generic qemu-qmp tests

2016-09-22 Thread Eric Blake
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 
> Reviewed-by: Daniel P. Berrange 
> ---
>  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 000..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 

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



signature.asc
Description: OpenPGP digital signature