[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 01/25] tests: start generic qemu-qmp tests
From: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [PATCH v2 01/25] tests: start generic qemu-qmp tests |
Date: |
Wed, 18 Jan 2017 11:14:25 -0500 (EST) |
----- Original Message -----
> These 2 tests exhibited two qmp bugs that were fixed in 2.7
> (series from commit e64c75a9752c5d0fd64eb2e684c656a5ea7d03c6 to
> commit 1382d4abdf9619985e4078e37e49e487cea9935e)
Sorry, it was actually in 2.8
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> Reviewed-by: Daniel P. Berrange <address@hidden>
> Reviewed-by: Eric Blake <address@hidden>
> Reviewed-by: Markus Armbruster <address@hidden>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> tests/qmp-test.c | 79
> ++++++++++++++++++++++++++++++++++++++++++++++++++
> MAINTAINERS | 1 +
> tests/Makefile.include | 2 ++
> 3 files changed, 82 insertions(+)
> create mode 100644 tests/qmp-test.c
>
> diff --git a/tests/qmp-test.c b/tests/qmp-test.c
> new file mode 100644
> index 0000000000..480ff28339
> --- /dev/null
> +++ b/tests/qmp-test.c
> @@ -0,0 +1,79 @@
> +/*
> + * QTest testcase for QMP
> + *
> + * Copyright (c) 2016 Red Hat, Inc.
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +/*
> + * This program tests QMP commands maintained with the QMP core.
> + * These are defined in qmp.c. Tests for QMP commands defined in
> + * another subsystem should go into a test program maintained with
> + * that subsystem.
> + *
> + * TODO Actually cover the commands. The tests we got so far only
> + * demonstrate specific bugs we've fixed.
> + */
> +
> +#include "qemu/osdep.h"
> +#include "libqtest.h"
> +
> +static void test_object_add_without_props(void)
> +{
> + QDict *ret, *error;
> + const gchar *klass, *desc;
> +
> + ret = qmp("{'execute': 'object-add',"
> + " 'arguments': { 'qom-type': 'memory-backend-ram', 'id':
> 'ram1' } }");
> + g_assert_nonnull(ret);
> +
> + error = qdict_get_qdict(ret, "error");
> + klass = qdict_get_try_str(error, "class");
> + desc = qdict_get_try_str(error, "desc");
> +
> + g_assert_cmpstr(klass, ==, "GenericError");
> + g_assert_cmpstr(desc, ==, "can't create backend with size 0");
> +
> + QDECREF(ret);
> +}
> +
> +static void test_qom_set_without_value(void)
> +{
> + QDict *ret, *error;
> + const gchar *klass, *desc;
> +
> + ret = qmp("{'execute': 'qom-set',"
> + " 'arguments': { 'path': '/machine', 'property': 'rtc-time' }
> }");
> + g_assert_nonnull(ret);
> +
> + error = qdict_get_qdict(ret, "error");
> + klass = qdict_get_try_str(error, "class");
> + desc = qdict_get_try_str(error, "desc");
> +
> + g_assert_cmpstr(klass, ==, "GenericError");
> + g_assert_cmpstr(desc, ==, "Parameter 'value' is missing");
> +
> + QDECREF(ret);
> +}
> +
> +int main(int argc, char **argv)
> +{
> + int ret;
> +
> + g_test_init(&argc, &argv, NULL);
> +
> + qtest_start("-machine none");
> +
> + qtest_add_func("/qemu-qmp/object-add-without-props",
> + test_object_add_without_props);
> + qtest_add_func("/qemu-qmp/qom-set-without-value",
> + test_qom_set_without_value);
> +
> + ret = g_test_run();
> +
> + qtest_end();
> +
> + return ret;
> +}
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 1444b26dc0..0c94a1ce27 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1368,6 +1368,7 @@ F: qmp.c
> F: monitor.c
> F: docs/*qmp-*
> F: scripts/qmp/
> +F: tests/qmp-test.c
> T: git git://repo.or.cz/qemu/armbru.git qapi-next
>
> Register API
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index 96f59703a1..152655d086 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -316,6 +316,7 @@ check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
> check-qtest-s390x-y = tests/boot-serial-test$(EXESUF)
>
> check-qtest-generic-y += tests/qom-test$(EXESUF)
> +check-qtest-generic-y += tests/qmp-test$(EXESUF)
>
> qapi-schema += alternate-any.json
> qapi-schema += alternate-array.json
> @@ -687,6 +688,7 @@ tests/tpci200-test$(EXESUF): tests/tpci200-test.o
> tests/display-vga-test$(EXESUF): tests/display-vga-test.o
> tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
> tests/qom-test$(EXESUF): tests/qom-test.o
> +tests/qmp-test$(EXESUF): tests/qmp-test.o
> tests/drive_del-test$(EXESUF): tests/drive_del-test.o $(libqos-pc-obj-y)
> tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o
> $(libqos-pc-obj-y)
> tests/nvme-test$(EXESUF): tests/nvme-test.o
> --
> 2.11.0.295.gd7dffce1c
>
>
- [Qemu-devel] [PATCH v2 00/25] qmp: add async command type, Marc-André Lureau, 2017/01/18
- [Qemu-devel] [PATCH v2 01/25] tests: start generic qemu-qmp tests, Marc-André Lureau, 2017/01/18
- Re: [Qemu-devel] [PATCH v2 01/25] tests: start generic qemu-qmp tests,
Marc-André Lureau <=
- [Qemu-devel] [PATCH v2 02/25] tests: change /0.15/* tests to /qmp/*, Marc-André Lureau, 2017/01/18
- [Qemu-devel] [PATCH v2 03/25] qmp: teach qmp_dispatch() to take a pre-filled QDict, Marc-André Lureau, 2017/01/18
- [Qemu-devel] [PATCH v2 04/25] qmp: use a return callback for the command reply, Marc-André Lureau, 2017/01/18
- [Qemu-devel] [PATCH v2 05/25] qmp: add QmpClient, Marc-André Lureau, 2017/01/18
- [Qemu-devel] [PATCH v2 06/25] qmp: add qmp_return_is_cancelled(), Marc-André Lureau, 2017/01/18
- [Qemu-devel] [PATCH v2 08/25] qapi: ignore top-level 'id' field, Marc-André Lureau, 2017/01/18
- [Qemu-devel] [PATCH v2 07/25] qmp: introduce async command type, Marc-André Lureau, 2017/01/18
- [Qemu-devel] [PATCH v2 09/25] qmp: take 'id' from request, Marc-André Lureau, 2017/01/18
- [Qemu-devel] [PATCH v2 10/25] qmp: check that async command have an 'id', Marc-André Lureau, 2017/01/18
- [Qemu-devel] [PATCH v2 11/25] scripts: learn 'async' qapi commands, Marc-André Lureau, 2017/01/18