[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 01/20] tests: do qmp introspect validation per ta
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v5 01/20] tests: do qmp introspect validation per target |
Date: |
Wed, 17 Aug 2016 20:57:38 +0400 |
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é Lureau <address@hidden>
---
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é Lureau <address@hidden>,
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * 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[] = "-nodefaults -machine none";
+
+static void test_qmp_introspect_validate(void)
+{
+ SchemaInfoList *schema;
+ QDict *resp;
+ Visitor *v;
+
+ qtest_start(common_args);
+
+ resp = qmp("{'execute': 'query-qmp-schema'}");
+ v = 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_validate);
+
+ 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"
typedef struct TestInputVisitorData {
@@ -283,7 +282,6 @@ static void
test_validate_qmp_introspect(TestInputVisitorData *data,
const void *unused)
{
do_test_validate_qmp_introspect(data, test_qmp_schema_json);
- do_test_validate_qmp_introspect(data, qmp_schema_json);
}
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) += tests/qemu-iotests-quick.sh
# really in libqtest, not in the testcases themselves.
check-qtest-generic-y = tests/device-introspect-test$(EXESUF)
+check-qtest-generic-y = tests/qmp-introspect-test$(EXESUF)
gcov-files-generic-y = qdev-monitor.c qmp.c
gcov-files-ipack-y += hw/ipack/ipack.c
@@ -565,6 +566,7 @@ libqos-imx-obj-y = $(libqos-obj-y) tests/libqos/i2c-imx.o
libqos-usb-obj-y = $(libqos-pc-obj-y) tests/libqos/usb.o
libqos-virtio-obj-y = $(libqos-pc-obj-y) tests/libqos/virtio.o
tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o
tests/libqos/malloc-generic.o
+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
--
2.9.0
- [Qemu-devel] [PATCH v5 00/20] qapi: remove the 'middle' mode, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 02/20] qapi.py: add a simple #ifdef conditional, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 01/20] tests: do qmp introspect validation per target,
Marc-André Lureau <=
- [Qemu-devel] [PATCH v5 03/20] build-sys: make qemu qapi per-target, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 05/20] qapi: configure the schema, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 04/20] build-sys: use config headers to generate qapi, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 06/20] build-sys: define QEMU_VERSION_{MAJOR, MINOR, MICRO}, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 08/20] qapi-schema: add 'device_add', Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 07/20] qapi-schema: use generated marshaller for 'qmp_capabilities', Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 09/20] monitor: simplify invalid_qmp_mode(), Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 11/20] qapi: export the marshallers, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 10/20] monitor: register gen:false commands manually, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 13/20] monitor: implement 'qmp_query_commands' without qmp_cmds, Marc-André Lureau, 2016/08/17