Received: from eggs.gnu.org ([2001:4830:134:3::10]:40584) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ba4AN-00058l-Sb for qemu-devel@nongnu.org; Wed, 17 Aug 2016 12:58:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ba4AH-0002MC-G2 for qemu-devel@nongnu.org; Wed, 17 Aug 2016 12:58:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43126) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ba4AH-0002M8-7y for qemu-devel@nongnu.org; Wed, 17 Aug 2016 12:58:05 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C1EE14E4C8 for ; Wed, 17 Aug 2016 16:58:04 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 17 Aug 2016 20:57:38 +0400 Message-Id: <20160817165757.23486-2-marcandre.lureau@redhat.com> In-Reply-To: <20160817165757.23486-1-marcandre.lureau@redhat.com> References: <20160817165757.23486-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v5 01/20] tests: do qmp introspect validation per target List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: eblake@redhat.com, armbru@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= The following commits will move the qmp schema to be per target, and can't be linked. Instead of validating it directly, query it from the target via qmp. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qmp-introspect-test.c | 50 +++++++++++++++++++++++++++++++++++++= ++++++ tests/test-qmp-input-strict.c | 2 -- tests/Makefile.include | 2 ++ 3 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 tests/qmp-introspect-test.c diff --git a/tests/qmp-introspect-test.c b/tests/qmp-introspect-test.c new file mode 100644 index 0000000..cafb311 --- /dev/null +++ b/tests/qmp-introspect-test.c @@ -0,0 +1,50 @@ +/* + * Per-target QAPI introspection test cases + * + * Copyright (c) 2016 Red Hat Inc. + * + * Authors: + * Marc-Andr=C3=A9 Lureau , + * + * This work is licensed under the terms of the GNU GPL, version 2 or la= ter. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "qemu-common.h" +#include "qapi/qmp/qstring.h" +#include "qapi/qmp-input-visitor.h" +#include "qapi/error.h" +#include "qapi-visit.h" +#include "libqtest.h" + +const char common_args[] =3D "-nodefaults -machine none"; + +static void test_qmp_introspect_validate(void) +{ + SchemaInfoList *schema; + QDict *resp; + Visitor *v; + + qtest_start(common_args); + + resp =3D qmp("{'execute': 'query-qmp-schema'}"); + v =3D qmp_input_visitor_new(qdict_get(resp, "return"), true); + visit_type_SchemaInfoList(v, NULL, &schema, &error_abort); + g_assert(schema); + + qapi_free_SchemaInfoList(schema); + visit_free(v); + QDECREF(resp); + + qtest_end(); +} + +int main(int argc, char **argv) +{ + g_test_init(&argc, &argv, NULL); + + qtest_add_func("qmp-introspect/validate", test_qmp_introspect_valida= te); + + return g_test_run(); +} diff --git a/tests/test-qmp-input-strict.c b/tests/test-qmp-input-strict.= c index 814550a..003a90e 100644 --- a/tests/test-qmp-input-strict.c +++ b/tests/test-qmp-input-strict.c @@ -21,7 +21,6 @@ #include "qapi/qmp/types.h" #include "qapi/qmp/qjson.h" #include "test-qmp-introspect.h" -#include "qmp-introspect.h" #include "qapi-visit.h" =20 typedef struct TestInputVisitorData { @@ -283,7 +282,6 @@ static void test_validate_qmp_introspect(TestInputVis= itorData *data, const void *unused) { do_test_validate_qmp_introspect(data, test_qmp_schema_json); - do_test_validate_qmp_introspect(data, qmp_schema_json); } =20 static void validate_test_add(const char *testpath, diff --git a/tests/Makefile.include b/tests/Makefile.include index 14be491..983b5b4 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -119,6 +119,7 @@ check-block-$(CONFIG_POSIX) +=3D tests/qemu-iotests-q= uick.sh # really in libqtest, not in the testcases themselves. =20 check-qtest-generic-y =3D tests/device-introspect-test$(EXESUF) +check-qtest-generic-y =3D tests/qmp-introspect-test$(EXESUF) gcov-files-generic-y =3D qdev-monitor.c qmp.c =20 gcov-files-ipack-y +=3D hw/ipack/ipack.c @@ -565,6 +566,7 @@ libqos-imx-obj-y =3D $(libqos-obj-y) tests/libqos/i2c= -imx.o libqos-usb-obj-y =3D $(libqos-pc-obj-y) tests/libqos/usb.o libqos-virtio-obj-y =3D $(libqos-pc-obj-y) tests/libqos/virtio.o tests/l= ibqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/libqos/malloc-generic= .o =20 +tests/qmp-introspect-test$(EXESUF): tests/qmp-introspect-test.o tests/device-introspect-test$(EXESUF): tests/device-introspect-test.o tests/rtc-test$(EXESUF): tests/rtc-test.o tests/m48t59-test$(EXESUF): tests/m48t59-test.o --=20 2.9.0