From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PATCH 1/2] qtest: unify extra_qtest_srcs and extra_qtest_deps
Date: Wed, 7 Oct 2020 04:03:11 -0400 [thread overview]
Message-ID: <20201007080312.566464-2-pbonzini@redhat.com> (raw)
In-Reply-To: <20201007080312.566464-1-pbonzini@redhat.com>
Currently the extra sources and extra dependencies of qtests are held
in two separate dictionaries. Use the same trick as tests/meson.build
to combine them into one. This will make it easier to update the
documentation for unit tests and qtests.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tests/qtest/meson.build | 55 +++++++++++++++++++----------------------
1 file changed, 26 insertions(+), 29 deletions(-)
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index ad33ac311d..550a0b51a6 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -192,35 +192,25 @@ qos_test_ss.add(
qos_test_ss.add(when: 'CONFIG_VIRTFS', if_true: files('virtio-9p-test.c'))
qos_test_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user-test.c'))
-extra_qtest_deps = {
- 'bios-tables-test': [io],
- 'ivshmem-test': [rt],
- 'qos-test': [chardev, io],
- 'tpm-crb-swtpm-test': [io],
- 'tpm-crb-test': [io],
- 'tpm-tis-swtpm-test': [io],
- 'tpm-tis-test': [io],
- 'tpm-tis-device-swtpm-test': [io],
- 'tpm-tis-device-test': [io],
-}
-extra_qtest_srcs = {
- 'bios-tables-test': files('boot-sector.c', 'acpi-utils.c', 'tpm-emu.c'),
- 'pxe-test': files('boot-sector.c'),
+tpmemu_files = ['tpm-emu.c', 'tpm-util.c', 'tpm-tests.c']
+
+qtests = {
+ 'bios-tables-test': [io, 'boot-sector.c', 'acpi-utils.c', 'tpm-emu.c'],
'cdrom-test': files('boot-sector.c'),
- 'migration-test': files('migration-helpers.c'),
- 'ivshmem-test': files('../../contrib/ivshmem-server/ivshmem-server.c'),
'dbus-vmstate-test': files('migration-helpers.c') + dbus_vmstate1,
+ 'ivshmem-test': [rt, '../../contrib/ivshmem-server/ivshmem-server.c'],
+ 'migration-test': files('migration-helpers.c'),
+ 'pxe-test': files('boot-sector.c'),
+ 'qos-test': [chardev, io, qos_test_ss.apply(config_host, strict: false).sources()],
+ 'tpm-crb-swtpm-test': [io, tpmemu_files],
+ 'tpm-crb-test': [io, tpmemu_files],
+ 'tpm-tis-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'],
+ 'tpm-tis-test': [io, tpmemu_files, 'tpm-tis-util.c'],
+ 'tpm-tis-device-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'],
+ 'tpm-tis-device-test': [io, tpmemu_files, 'tpm-tis-util.c'],
'vmgenid-test': files('boot-sector.c', 'acpi-utils.c'),
- 'tpm-crb-swtpm-test': files('tpm-emu.c', 'tpm-util.c', 'tpm-tests.c'),
- 'tpm-crb-test': files('tpm-emu.c', 'tpm-util.c', 'tpm-tests.c'),
- 'tpm-tis-device-swtpm-test': files('tpm-emu.c', 'tpm-util.c', 'tpm-tis-util.c', 'tpm-tests.c'),
- 'tpm-tis-device-test': files('tpm-emu.c', 'tpm-util.c', 'tpm-tis-util.c', 'tpm-tests.c'),
- 'tpm-tis-swtpm-test': files('tpm-emu.c', 'tpm-util.c', 'tpm-tis-util.c', 'tpm-tests.c'),
- 'tpm-tis-test': files('tpm-emu.c', 'tpm-util.c', 'tpm-tis-util.c', 'tpm-tests.c'),
- 'qos-test': qos_test_ss.apply(config_host, strict: false).sources()
}
-
qtest_executables = {}
foreach dir : target_dirs
if not dir.endswith('-softmmu')
@@ -229,7 +219,7 @@ foreach dir : target_dirs
target_base = dir.split('-')[0]
qtest_emulator = emulators['qemu-system-' + target_base]
- qtests = get_variable('qtests_' + target_base, []) + qtests_generic
+ target_qtests = get_variable('qtests_' + target_base, []) + qtests_generic
test_deps = []
qtest_env = environment()
@@ -240,14 +230,21 @@ foreach dir : target_dirs
qtest_env.set('G_TEST_DBUS_DAEMON', meson.source_root() / 'tests/dbus-vmstate-daemon.sh')
qtest_env.set('QTEST_QEMU_BINARY', './qemu-system-' + target_base)
- foreach test : qtests
+ foreach test : target_qtests
# Executables are shared across targets, declare them only the first time we
# encounter them
if not qtest_executables.has_key(test)
+ src = [test + '.c']
+ deps = [qemuutil, qos]
+ if test in qtests
+ # use a sourceset to quickly separate sources and deps
+ test_ss = ss.source_set()
+ test_ss.add(qtests[test])
+ src += test_ss.all_sources()
+ deps += test_ss.all_dependencies()
+ endif
qtest_executables += {
- test: executable(test,
- files(test + '.c') + extra_qtest_srcs.get(test, []),
- dependencies: [qemuutil, qos] + extra_qtest_deps.get(test, []))
+ test: executable(test, src, dependencies: deps)
}
endif
# FIXME: missing dependency on the emulator binary and qemu-img
--
2.26.2
next prev parent reply other threads:[~2020-10-07 8:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-07 8:03 [PATCH 0/2] simplify tests/qtest/meson.build and update docs Paolo Bonzini
2020-10-07 8:03 ` Paolo Bonzini [this message]
2020-10-07 8:03 ` [PATCH 2/2] docs/devel: update instruction on how to add new unit tests 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=20201007080312.566464-2-pbonzini@redhat.com \
--to=pbonzini@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).