qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [PATCH 11/39] meson: build qapi tests library
Date: Wed,  2 Sep 2020 08:58:49 -0400	[thread overview]
Message-ID: <20200902125917.26021-12-pbonzini@redhat.com> (raw)
In-Reply-To: <20200902125917.26021-1-pbonzini@redhat.com>

From: Marc-André Lureau <marcandre.lureau@redhat.com>

- builds QAPI builtins types/visitor to fix a linking issue with
  unresolved symbols in the static library.

- work around a meson limitation on generated file output directories.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20200828110734.1638685-2-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/Makefile.include    | 79 +--------------------------------------
 tests/include/meson.build | 16 ++++++++
 tests/meson.build         | 45 ++++++++++++++++++++++
 3 files changed, 62 insertions(+), 78 deletions(-)
 create mode 100644 tests/include/meson.build

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 45cc71c737..1451f64df7 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -34,23 +34,6 @@ endif
 ifneq ($(wildcard config-host.mak),)
 export SRC_PATH
 
-# TODO don't duplicate $(SRC_PATH)/Makefile's qapi-py here
-qapi-py = $(SRC_PATH)/scripts/qapi/__init__.py \
-$(SRC_PATH)/scripts/qapi/commands.py \
-$(SRC_PATH)/scripts/qapi/common.py \
-$(SRC_PATH)/scripts/qapi/doc.py \
-$(SRC_PATH)/scripts/qapi/error.py \
-$(SRC_PATH)/scripts/qapi/events.py \
-$(SRC_PATH)/scripts/qapi/expr.py \
-$(SRC_PATH)/scripts/qapi/gen.py \
-$(SRC_PATH)/scripts/qapi/introspect.py \
-$(SRC_PATH)/scripts/qapi/parser.py \
-$(SRC_PATH)/scripts/qapi/schema.py \
-$(SRC_PATH)/scripts/qapi/source.py \
-$(SRC_PATH)/scripts/qapi/types.py \
-$(SRC_PATH)/scripts/qapi/visit.py \
-$(SRC_PATH)/scripts/qapi-gen.py
-
 # Get the list of all supported sysemu targets
 SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
    $(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
@@ -164,36 +147,13 @@ ifeq ($(CONFIG_BLOCK)$(CONFIG_REPLICATION)$(CONFIG_POSIX),yyy)
 check-unit-y += tests/test-replication$(EXESUF)
 endif
 
-generated-files-y += tests/test-qapi-types.h
-generated-files-y += tests/include/test-qapi-types-sub-module.h
-generated-files-y += tests/test-qapi-types-sub-sub-module.h
-generated-files-y += tests/test-qapi-visit.h
-generated-files-y += tests/include/test-qapi-visit-sub-module.h
-generated-files-y += tests/test-qapi-visit-sub-sub-module.h
-generated-files-y += tests/test-qapi-commands.h
-generated-files-y += tests/test-qapi-init-commands.h
-generated-files-y += tests/include/test-qapi-commands-sub-module.h
-generated-files-y += tests/test-qapi-commands-sub-sub-module.h
-generated-files-y += tests/test-qapi-emit-events.h
-generated-files-y += tests/test-qapi-events.h
-generated-files-y += tests/include/test-qapi-events-sub-module.h
-generated-files-y += tests/test-qapi-events-sub-sub-module.h
-generated-files-y += tests/test-qapi-introspect.h
-
 QEMU_CFLAGS += -I$(SRC_PATH)/tests -I$(SRC_PATH)/tests/qtest
 
 
 # Deps that are common to various different sets of tests below
 test-util-obj-y = libqemuutil.a
 test-qom-obj-y = $(qom-obj-y) $(test-util-obj-y)
-test-qapi-obj-y = tests/test-qapi-types.o \
-	tests/include/test-qapi-types-sub-module.o \
-	tests/test-qapi-types-sub-sub-module.o \
-	tests/test-qapi-visit.o \
-	tests/include/test-qapi-visit-sub-module.o \
-	tests/test-qapi-visit-sub-sub-module.o \
-	tests/test-qapi-introspect.o \
-	$(test-qom-obj-y)
+test-qapi-obj-y = $(test-qom-obj-y) tests/libtestqapi.a
 benchmark-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
 test-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
 test-io-obj-$(CONFIG_BLOCK) = $(io-obj-y) $(test-crypto-obj-y)
@@ -264,42 +224,6 @@ tests/test-logging$(EXESUF): tests/test-logging.o $(test-util-obj-y)
 tests/test-replication$(EXESUF): tests/test-replication.o $(test-util-obj-y) \
 	$(test-block-obj-y)
 
-tests/test-qapi-types.c tests/test-qapi-types.h \
-tests/include/test-qapi-types-sub-module.c \
-tests/include/test-qapi-types-sub-module.h \
-tests/test-qapi-types-sub-sub-module.c \
-tests/test-qapi-types-sub-sub-module.h \
-tests/test-qapi-visit.c tests/test-qapi-visit.h \
-tests/include/test-qapi-visit-sub-module.c \
-tests/include/test-qapi-visit-sub-module.h \
-tests/test-qapi-visit-sub-sub-module.c \
-tests/test-qapi-visit-sub-sub-module.h \
-tests/test-qapi-commands.h tests/test-qapi-commands.c \
-tests/include/test-qapi-commands-sub-module.h \
-tests/include/test-qapi-commands-sub-module.c \
-tests/test-qapi-commands-sub-sub-module.h \
-tests/test-qapi-commands-sub-sub-module.c \
-tests/test-qapi-emit-events.c tests/test-qapi-emit-events.h \
-tests/test-qapi-events.c tests/test-qapi-events.h \
-tests/test-qapi-init-commands.c \
-tests/test-qapi-init-commands.h \
-tests/include/test-qapi-events-sub-module.c \
-tests/include/test-qapi-events-sub-module.h \
-tests/test-qapi-events-sub-sub-module.c \
-tests/test-qapi-events-sub-sub-module.h \
-tests/test-qapi-introspect.c tests/test-qapi-introspect.h: \
-tests/test-qapi-gen-timestamp ;
-tests/test-qapi-gen-timestamp: \
-		$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json \
-		$(SRC_PATH)/tests/qapi-schema/include/sub-module.json \
-		$(SRC_PATH)/tests/qapi-schema/sub-sub-module.json \
-		$(qapi-py)
-	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
-		-o tests -p "test-" $<, \
-		"GEN","$(@:%-timestamp=%)")
-	@rm -f tests/test-qapi-doc.texi
-	@>$@
-
 tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y)
 tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y)
 tests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y) tests/test-qapi-emit-events.o tests/test-qapi-events.o
@@ -541,7 +465,6 @@ check-build: build-unit $(QEMU_IOTESTS_HELPERS-y)
 
 check-clean:
 	rm -rf $(check-unit-y) tests/*.o tests/*/*.o $(QEMU_IOTESTS_HELPERS-y)
-	rm -f tests/test-qapi-gen-timestamp
 	rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR)
 
 check: check-unit
diff --git a/tests/include/meson.build b/tests/include/meson.build
new file mode 100644
index 0000000000..fea3a6342f
--- /dev/null
+++ b/tests/include/meson.build
@@ -0,0 +1,16 @@
+# an extra target to workaround meson limitation on output files location
+test_qapi_outputs_extra = [
+  'test-qapi-commands-sub-module.c',
+  'test-qapi-commands-sub-module.h',
+  'test-qapi-events-sub-module.c',
+  'test-qapi-events-sub-module.h',
+  'test-qapi-types-sub-module.c',
+  'test-qapi-types-sub-module.h',
+  'test-qapi-visit-sub-module.c',
+  'test-qapi-visit-sub-module.h',
+]
+
+test_qapi_outputs_extra = custom_target('QAPI test (include)',
+                                        output: test_qapi_outputs_extra,
+                                        input: test_qapi_files,
+                                        command: 'true')
diff --git a/tests/meson.build b/tests/meson.build
index fe2c6d8e6b..ab09a8d845 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,3 +1,48 @@
+test_qapi_outputs = [
+  'qapi-builtin-types.c',
+  'qapi-builtin-types.h',
+  'qapi-builtin-visit.c',
+  'qapi-builtin-visit.h',
+  'test-qapi-commands-sub-sub-module.c',
+  'test-qapi-commands-sub-sub-module.h',
+  'test-qapi-commands.c',
+  'test-qapi-commands.h',
+  'test-qapi-emit-events.c',
+  'test-qapi-emit-events.h',
+  'test-qapi-events-sub-sub-module.c',
+  'test-qapi-events-sub-sub-module.h',
+  'test-qapi-events.c',
+  'test-qapi-events.h',
+  'test-qapi-init-commands.c',
+  'test-qapi-init-commands.h',
+  'test-qapi-introspect.c',
+  'test-qapi-introspect.h',
+  'test-qapi-types-sub-sub-module.c',
+  'test-qapi-types-sub-sub-module.h',
+  'test-qapi-types.c',
+  'test-qapi-types.h',
+  'test-qapi-visit-sub-sub-module.c',
+  'test-qapi-visit-sub-sub-module.h',
+  'test-qapi-visit.c',
+  'test-qapi-visit.h',
+]
+
+test_qapi_files = custom_target('Test QAPI files',
+                                output: test_qapi_outputs,
+                                input: files('qapi-schema/qapi-schema-test.json',
+                                             'qapi-schema/include/sub-module.json',
+                                             'qapi-schema/sub-sub-module.json'),
+                                command: [ qapi_gen, '-o', meson.current_build_dir(),
+                                           '-b', '-p', 'test-', '@INPUT0@' ],
+                                depend_files: qapi_gen_depends)
+
+# meson doesn't like generated output in other directories
+# perhaps change qapi_gen to replace / with _, like Meson itself does?
+subdir('include')
+
+libtestqapi = static_library('testqapi', sources: [test_qapi_files, test_qapi_outputs_extra])
+testqapi = declare_dependency(link_with: libtestqapi)
+
 if have_system and 'CONFIG_POSIX' in config_host
   subdir('qemu-iotests')
 endif
-- 
2.26.2




  parent reply	other threads:[~2020-09-02 13:01 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-02 12:58 [PATCH 00/39] Next round of Meson fixes and cleanups Paolo Bonzini
2020-09-02 12:58 ` [PATCH 01/39] configure: Add system = 'linux' for meson when cross-compiling Paolo Bonzini
2020-09-02 14:47   ` Alex Bennée
2020-09-02 12:58 ` [PATCH 02/39] mtest2make: split environment from test command Paolo Bonzini
2020-09-02 12:58 ` [PATCH 03/39] mtest2make: split working directory " Paolo Bonzini
2020-09-02 12:58 ` [PATCH 04/39] mtest2make: hide output of successful tests Paolo Bonzini
2020-09-02 12:58 ` [PATCH 05/39] mtest2make: unify tests that appear in multiple suites Paolo Bonzini
2020-09-02 12:58 ` [PATCH 06/39] meson: remove b_lundef option Paolo Bonzini
2020-09-02 12:58 ` [PATCH 07/39] configure: do not include absolute paths in -I and -L paths Paolo Bonzini
2020-09-02 12:58 ` [PATCH 08/39] configure: include cross sdl2-config in meson cross file Paolo Bonzini
2020-09-02 12:58 ` [PATCH 09/39] ninjatool: use constant names for stamp files Paolo Bonzini
2020-09-02 12:58 ` [PATCH 10/39] meson: fix libqos linking Paolo Bonzini
2020-09-02 12:58 ` Paolo Bonzini [this message]
2020-09-02 12:58 ` [PATCH 12/39] meson: declare tasn1 dependency Paolo Bonzini
2020-09-02 12:58 ` [PATCH 13/39] meson: declare keyutils dependency Paolo Bonzini
2020-09-02 12:58 ` [PATCH 14/39] meson: convert qht-bench Paolo Bonzini
2020-09-02 12:58 ` [PATCH 15/39] tests: qga has virtio-serial by default when host has it Paolo Bonzini
2020-09-02 12:58 ` [PATCH 16/39] meson: convert the unit tests Paolo Bonzini
2020-09-02 12:58 ` [PATCH 17/39] meson: move keyutils dependency check Paolo Bonzini
2020-09-02 12:58 ` [PATCH 18/39] meson: remove old socket_scm_helper rule Paolo Bonzini
2020-09-02 12:58 ` [PATCH 19/39] meson: convert vhost-user-bridge Paolo Bonzini
2020-09-02 12:58 ` [PATCH 20/39] meson: convert atomic*-bench Paolo Bonzini
2020-09-02 12:58 ` [PATCH 21/39] tests: do not print benchmark output to stdout Paolo Bonzini
2020-09-02 12:59 ` [PATCH 22/39] meson: convert the speed tests Paolo Bonzini
2020-09-02 12:59 ` [PATCH 23/39] tests/migration/stress: remove unused exit_success Paolo Bonzini
2020-09-02 12:59 ` [PATCH 24/39] meson: fix migration/stress compilation with glibc>=2.30 Paolo Bonzini
2020-09-02 12:59 ` [PATCH 25/39] meson: convert migration/initrd-stress Paolo Bonzini
2020-09-02 12:59 ` [PATCH 26/39] configure: remove dead code for in-tree builds Paolo Bonzini
2020-09-02 12:59 ` [PATCH 27/39] meson: compute config_all_devices directly Paolo Bonzini
2020-09-02 12:59 ` [PATCH 28/39] Makefile: remove dead variables and includes Paolo Bonzini
2020-09-02 12:59 ` [PATCH 29/39] Makefile: inline the relevant parts of rules.mak Paolo Bonzini
2020-09-02 12:59 ` [PATCH 30/39] configure: move disassembler configuration to meson Paolo Bonzini
2020-09-02 12:59 ` [PATCH 31/39] configure: move C++ compiler handling " Paolo Bonzini
2020-09-02 12:59 ` [PATCH 32/39] meson: keep all compiler flags detection together Paolo Bonzini
2020-09-02 12:59 ` [PATCH 33/39] configure: move -ldl test to meson Paolo Bonzini
2020-09-02 12:59 ` [PATCH 34/39] configure: remove unnecessary libm test Paolo Bonzini
2020-09-02 12:59 ` [PATCH 35/39] configure: do not look for install(1) Paolo Bonzini
2020-09-02 12:59 ` [PATCH 36/39] meson: get glib compilation flags from GLIB_CFLAGS Paolo Bonzini
2020-09-02 12:59 ` [PATCH 37/39] configure: do not include dependency flags in QEMU_CFLAGS and LIBS Paolo Bonzini
2020-09-02 12:59 ` [PATCH 38/39] configure: drop dead variables Paolo Bonzini
2020-09-02 12:59 ` [PATCH 39/39] docs: suggest Meson replacements for various configure functions Paolo Bonzini
2020-09-02 13:14 ` [PATCH 00/39] Next round of Meson fixes and cleanups Marc-André Lureau
2020-09-02 13:46   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200902125917.26021-12-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).