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 <marcandre.lur...@redhat.com> --- 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 <marcandre.lur...@redhat.com>, + * + * 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