aboutsummaryrefslogtreecommitdiff
path: root/tests/qtest
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-10-06 08:44:00 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-10-12 11:50:23 -0400
commitda00d067eaf24968cc5bf7c8065c7b8b1070e16c (patch)
treec8b448cabbc95b8bc50773ea16409bc9a5fbc418 /tests/qtest
parent51c778edd347452ce22146bd004bc7adab5f3a1a (diff)
downloadqemu-da00d067eaf24968cc5bf7c8065c7b8b1070e16c.zip
qemu-da00d067eaf24968cc5bf7c8065c7b8b1070e16c.tar.gz
qemu-da00d067eaf24968cc5bf7c8065c7b8b1070e16c.tar.bz2
qtest: unify extra_qtest_srcs and extra_qtest_deps
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>
Diffstat (limited to 'tests/qtest')
-rw-r--r--tests/qtest/meson.build55
1 files changed, 26 insertions, 29 deletions
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 0f32ca0..28bafc0 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -193,35 +193,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')
@@ -230,7 +220,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()
@@ -241,14 +231,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