]> git.proxmox.com Git - mirror_qemu.git/blob - tests/qtest/meson.build
Merge tag 'for_upstream' of git://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging
[mirror_qemu.git] / tests / qtest / meson.build
1 # All QTests for now are POSIX-only, but the dependencies are
2 # really in libqtest, not in the testcases themselves.
3 if not config_host.has_key('CONFIG_POSIX')
4 subdir_done()
5 endif
6
7 slow_qtests = {
8 'ahci-test' : 60,
9 'bios-tables-test' : 120,
10 'boot-serial-test' : 60,
11 'migration-test' : 150,
12 'npcm7xx_pwm-test': 150,
13 'prom-env-test' : 60,
14 'pxe-test' : 60,
15 'qos-test' : 60,
16 'qom-test' : 300,
17 'test-hmp' : 120,
18 }
19
20 qtests_generic = [
21 'cdrom-test',
22 'device-introspect-test',
23 'machine-none-test',
24 'qmp-test',
25 'qmp-cmd-test',
26 'qom-test',
27 'test-hmp',
28 'qos-test',
29 ]
30 if config_host.has_key('CONFIG_MODULES')
31 qtests_generic += [ 'modules-test' ]
32 endif
33
34 qtests_pci = \
35 (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) + \
36 (config_all_devices.has_key('CONFIG_IVSHMEM_DEVICE') ? ['ivshmem-test'] : [])
37
38 qtests_cxl = \
39 (config_all_devices.has_key('CONFIG_CXL') ? ['cxl-test'] : [])
40
41 qtests_i386 = \
42 (slirp.found() ? ['pxe-test', 'test-netfilter'] : []) + \
43 (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \
44 (have_tools ? ['ahci-test'] : []) + \
45 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \
46 (config_all_devices.has_key('CONFIG_SGA') ? ['boot-serial-test'] : []) + \
47 (config_all_devices.has_key('CONFIG_ISA_IPMI_KCS') ? ['ipmi-kcs-test'] : []) + \
48 (config_host.has_key('CONFIG_LINUX') and \
49 config_all_devices.has_key('CONFIG_ISA_IPMI_BT') ? ['ipmi-bt-test'] : []) + \
50 (config_all_devices.has_key('CONFIG_WDT_IB700') ? ['wdt_ib700-test'] : []) + \
51 (config_all_devices.has_key('CONFIG_PVPANIC_ISA') ? ['pvpanic-test'] : []) + \
52 (config_all_devices.has_key('CONFIG_PVPANIC_PCI') ? ['pvpanic-pci-test'] : []) + \
53 (config_all_devices.has_key('CONFIG_HDA') ? ['intel-hda-test'] : []) + \
54 (config_all_devices.has_key('CONFIG_I82801B11') ? ['i82801b11-test'] : []) + \
55 (config_all_devices.has_key('CONFIG_IOH3420') ? ['ioh3420-test'] : []) + \
56 (config_all_devices.has_key('CONFIG_LPC_ICH9') ? ['lpc-ich9-test'] : []) + \
57 (config_all_devices.has_key('CONFIG_USB_UHCI') ? ['usb-hcd-uhci-test'] : []) + \
58 (config_all_devices.has_key('CONFIG_USB_UHCI') and \
59 config_all_devices.has_key('CONFIG_USB_EHCI') ? ['usb-hcd-ehci-test'] : []) + \
60 (config_all_devices.has_key('CONFIG_USB_XHCI_NEC') ? ['usb-hcd-xhci-test'] : []) + \
61 (config_all_devices.has_key('CONFIG_TPM_CRB') ? ['tpm-crb-test'] : []) + \
62 (config_all_devices.has_key('CONFIG_TPM_CRB') ? ['tpm-crb-swtpm-test'] : []) + \
63 (config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ? ['tpm-tis-test'] : []) + \
64 (config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ? ['tpm-tis-swtpm-test'] : []) + \
65 (config_all_devices.has_key('CONFIG_RTL8139_PCI') ? ['rtl8139-test'] : []) + \
66 (config_all_devices.has_key('CONFIG_E1000E_PCI_EXPRESS') ? ['fuzz-e1000e-test'] : []) + \
67 (config_all_devices.has_key('CONFIG_MEGASAS_SCSI_PCI') ? ['fuzz-megasas-test'] : []) + \
68 (config_all_devices.has_key('CONFIG_LSI_SCSI_PCI') ? ['fuzz-lsi53c895a-test'] : []) + \
69 (config_all_devices.has_key('CONFIG_VIRTIO_SCSI') ? ['fuzz-virtio-scsi-test'] : []) + \
70 (config_all_devices.has_key('CONFIG_SB16') ? ['fuzz-sb16-test'] : []) + \
71 (config_all_devices.has_key('CONFIG_SDHCI_PCI') ? ['fuzz-sdcard-test'] : []) + \
72 (config_all_devices.has_key('CONFIG_ESP_PCI') ? ['am53c974-test'] : []) + \
73 (config_all_devices.has_key('CONFIG_ACPI_ERST') ? ['erst-test'] : []) + \
74 (config_all_devices.has_key('CONFIG_VIRTIO_NET') and \
75 config_all_devices.has_key('CONFIG_Q35') and \
76 config_all_devices.has_key('CONFIG_VIRTIO_PCI') and \
77 slirp.found() ? ['virtio-net-failover'] : []) + \
78 (unpack_edk2_blobs ? ['bios-tables-test'] : []) + \
79 qtests_pci + \
80 qtests_cxl + \
81 ['fdc-test',
82 'ide-test',
83 'hd-geo-test',
84 'boot-order-test',
85 'rtc-test',
86 'i440fx-test',
87 'fw_cfg-test',
88 'device-plug-test',
89 'drive_del-test',
90 'tco-test',
91 'cpu-plug-test',
92 'q35-test',
93 'vmgenid-test',
94 'migration-test',
95 'test-x86-cpuid-compat',
96 'numa-test',
97 'test-filter-redirector'
98 ]
99
100 if dbus_display
101 qtests_i386 += ['dbus-display-test']
102 endif
103
104 dbus_daemon = find_program('dbus-daemon', required: false)
105 if dbus_daemon.found() and gdbus_codegen.found()
106 # Temporarily disabled due to Patchew failures:
107 #qtests_i386 += ['dbus-vmstate-test']
108 dbus_vmstate1 = custom_target('dbus-vmstate description',
109 output: ['dbus-vmstate1.h', 'dbus-vmstate1.c'],
110 input: meson.project_source_root() / 'backends/dbus-vmstate1.xml',
111 command: [gdbus_codegen, '@INPUT@',
112 '--interface-prefix', 'org.qemu',
113 '--generate-c-code', '@BASENAME@']).to_list()
114 else
115 dbus_vmstate1 = []
116 endif
117
118 qtests_x86_64 = qtests_i386
119
120 qtests_alpha = ['boot-serial-test'] + \
121 ['test-filter-mirror', 'test-filter-redirector'] + \
122 (slirp.found() ? ['test-netfilter'] : []) + \
123 (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : [])
124
125 qtests_avr = [ 'boot-serial-test' ]
126
127 qtests_hppa = ['boot-serial-test'] + \
128 ['test-filter-mirror', 'test-filter-redirector'] + \
129 (slirp.found() ? ['test-netfilter'] : []) + \
130 (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : [])
131
132 qtests_m68k = ['boot-serial-test'] + \
133 ['test-filter-mirror', 'test-filter-redirector'] + \
134 (slirp.found() ? ['test-netfilter'] : [])
135
136 qtests_microblaze = ['boot-serial-test'] + \
137 ['test-filter-mirror', 'test-filter-redirector'] + \
138 (slirp.found() ? ['test-netfilter'] : [])
139
140 qtests_microblazeel = qtests_microblaze
141
142 qtests_mips = \
143 ['test-filter-mirror', 'test-filter-redirector'] + \
144 (slirp.found() ? ['test-netfilter'] : []) + \
145 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \
146 (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : [])
147
148 qtests_mipsel = qtests_mips
149 qtests_mips64 = qtests_mips
150 qtests_mips64el = qtests_mips
151
152 qtests_ppc = \
153 ['test-filter-mirror', 'test-filter-redirector'] + \
154 (slirp.found() ? ['test-netfilter'] : []) + \
155 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \
156 (config_all_devices.has_key('CONFIG_M48T59') ? ['m48t59-test'] : []) + \
157 (config_all_devices.has_key('CONFIG_TCG') ? ['prom-env-test'] : []) + \
158 (config_all_devices.has_key('CONFIG_TCG') ? ['boot-serial-test'] : []) + \
159 ['boot-order-test']
160
161 qtests_ppc64 = \
162 qtests_ppc + \
163 (config_all_devices.has_key('CONFIG_PSERIES') ? ['device-plug-test'] : []) + \
164 (config_all_devices.has_key('CONFIG_POWERNV') ? ['pnv-xscom-test'] : []) + \
165 (config_all_devices.has_key('CONFIG_PSERIES') ? ['rtas-test'] : []) + \
166 (slirp.found() ? ['pxe-test'] : []) + \
167 (config_all_devices.has_key('CONFIG_USB_UHCI') ? ['usb-hcd-uhci-test'] : []) + \
168 (config_all_devices.has_key('CONFIG_USB_XHCI_NEC') ? ['usb-hcd-xhci-test'] : []) + \
169 qtests_pci + ['migration-test', 'numa-test', 'cpu-plug-test', 'drive_del-test']
170
171 qtests_sh4 = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : [])
172 qtests_sh4eb = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : [])
173
174 qtests_sparc = ['prom-env-test', 'm48t59-test', 'boot-serial-test'] + \
175 ['test-filter-mirror', 'test-filter-redirector'] + \
176 (slirp.found() ? ['test-netfilter'] : [])
177
178 qtests_sparc64 = \
179 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \
180 (slirp.found() ? ['test-netfilter'] : []) + \
181 ['test-filter-mirror', 'test-filter-redirector'] + \
182 ['prom-env-test', 'boot-serial-test']
183
184 qtests_npcm7xx = \
185 ['npcm7xx_adc-test',
186 'npcm7xx_gpio-test',
187 'npcm7xx_pwm-test',
188 'npcm7xx_rng-test',
189 'npcm7xx_sdhci-test',
190 'npcm7xx_smbus-test',
191 'npcm7xx_timer-test',
192 'npcm7xx_watchdog_timer-test'] + \
193 (slirp.found() ? ['npcm7xx_emc-test'] : [])
194 qtests_aspeed = \
195 ['aspeed_hace-test',
196 'aspeed_smc-test',
197 'aspeed_gpio-test']
198 qtests_arm = \
199 (config_all_devices.has_key('CONFIG_MPS2') ? ['sse-timer-test'] : []) + \
200 (config_all_devices.has_key('CONFIG_CMSDK_APB_DUALTIMER') ? ['cmsdk-apb-dualtimer-test'] : []) + \
201 (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-timer-test'] : []) + \
202 (config_all_devices.has_key('CONFIG_CMSDK_APB_WATCHDOG') ? ['cmsdk-apb-watchdog-test'] : []) + \
203 (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test'] : []) + \
204 (config_all_devices.has_key('CONFIG_ASPEED_SOC') ? qtests_aspeed : []) + \
205 (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \
206 ['arm-cpu-features',
207 'microbit-test',
208 'test-arm-mptimer',
209 'boot-serial-test',
210 'hexloader-test']
211
212 # TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional
213 qtests_aarch64 = \
214 (cpu != 'arm' and unpack_edk2_blobs ? ['bios-tables-test'] : []) + \
215 (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-test'] : []) + \
216 (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-swtpm-test'] : []) + \
217 (config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \
218 ['arm-cpu-features',
219 'numa-test',
220 'boot-serial-test',
221 'migration-test']
222
223 qtests_s390x = \
224 (slirp.found() ? ['pxe-test', 'test-netfilter'] : []) + \
225 (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \
226 (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : []) + \
227 ['boot-serial-test',
228 'drive_del-test',
229 'device-plug-test',
230 'virtio-ccw-test',
231 'cpu-plug-test',
232 'migration-test']
233
234 qos_test_ss = ss.source_set()
235 qos_test_ss.add(
236 'ac97-test.c',
237 'adm1272-test.c',
238 'ds1338-test.c',
239 'e1000-test.c',
240 'e1000e-test.c',
241 'eepro100-test.c',
242 'es1370-test.c',
243 'ipoctal232-test.c',
244 'lsm303dlhc-mag-test.c',
245 'isl_pmbus_vr-test.c',
246 'max34451-test.c',
247 'megasas-test.c',
248 'ne2000-test.c',
249 'tulip-test.c',
250 'nvme-test.c',
251 'pca9552-test.c',
252 'pci-test.c',
253 'pcnet-test.c',
254 'sdhci-test.c',
255 'spapr-phb-test.c',
256 'tmp105-test.c',
257 'emc141x-test.c',
258 'usb-hcd-ohci-test.c',
259 'virtio-test.c',
260 'virtio-blk-test.c',
261 'virtio-net-test.c',
262 'virtio-rng-test.c',
263 'virtio-scsi-test.c',
264 'virtio-serial-test.c',
265 'virtio-iommu-test.c',
266 'vmxnet3-test.c',
267 )
268 if have_virtfs
269 qos_test_ss.add(files('virtio-9p-test.c'))
270 endif
271 if have_vhost_user
272 qos_test_ss.add(files('vhost-user-test.c'))
273 endif
274 if have_tools and have_vhost_user_blk_server
275 qos_test_ss.add(files('vhost-user-blk-test.c'))
276 endif
277
278 tpmemu_files = ['tpm-emu.c', 'tpm-util.c', 'tpm-tests.c']
279
280 migration_files = [files('migration-helpers.c')]
281 if gnutls.found()
282 migration_files += [files('../unit/crypto-tls-psk-helpers.c'), gnutls]
283
284 if tasn1.found()
285 migration_files += [files('../unit/crypto-tls-x509-helpers.c',
286 '../unit/pkix_asn1_tab.c'), tasn1]
287 endif
288 endif
289
290 qtests = {
291 'bios-tables-test': [io, 'boot-sector.c', 'acpi-utils.c', 'tpm-emu.c'],
292 'cdrom-test': files('boot-sector.c'),
293 'dbus-vmstate-test': files('migration-helpers.c') + dbus_vmstate1,
294 'erst-test': files('erst-test.c'),
295 'ivshmem-test': [rt, '../../contrib/ivshmem-server/ivshmem-server.c'],
296 'migration-test': migration_files,
297 'pxe-test': files('boot-sector.c'),
298 'qos-test': [chardev, io, qos_test_ss.apply(config_host, strict: false).sources()],
299 'tpm-crb-swtpm-test': [io, tpmemu_files],
300 'tpm-crb-test': [io, tpmemu_files],
301 'tpm-tis-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'],
302 'tpm-tis-test': [io, tpmemu_files, 'tpm-tis-util.c'],
303 'tpm-tis-device-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'],
304 'tpm-tis-device-test': [io, tpmemu_files, 'tpm-tis-util.c'],
305 'vmgenid-test': files('boot-sector.c', 'acpi-utils.c'),
306 }
307
308 if dbus_display
309 qtests += {'dbus-display-test': [dbus_display1, gio]}
310 endif
311
312 qtest_executables = {}
313 foreach dir : target_dirs
314 if not dir.endswith('-softmmu')
315 continue
316 endif
317
318 target_base = dir.split('-')[0]
319 qtest_emulator = emulators['qemu-system-' + target_base]
320 target_qtests = get_variable('qtests_' + target_base, []) + qtests_generic
321
322 test_deps = roms
323 qtest_env = environment()
324 if have_tools
325 qtest_env.set('QTEST_QEMU_IMG', './qemu-img')
326 test_deps += [qemu_img]
327 endif
328 qtest_env.set('G_TEST_DBUS_DAEMON', meson.project_source_root() / 'tests/dbus-vmstate-daemon.sh')
329 qtest_env.set('QTEST_QEMU_BINARY', './qemu-system-' + target_base)
330 if have_tools and have_vhost_user_blk_server
331 qtest_env.set('QTEST_QEMU_STORAGE_DAEMON_BINARY', './storage-daemon/qemu-storage-daemon')
332 test_deps += [qsd]
333 endif
334
335 foreach test : target_qtests
336 # Executables are shared across targets, declare them only the first time we
337 # encounter them
338 if not qtest_executables.has_key(test)
339 src = [test + '.c']
340 deps = [qemuutil, qos]
341 if test in qtests
342 # use a sourceset to quickly separate sources and deps
343 test_ss = ss.source_set()
344 test_ss.add(qtests[test])
345 src += test_ss.all_sources()
346 deps += test_ss.all_dependencies()
347 endif
348 qtest_executables += {
349 test: executable(test, src, dependencies: deps)
350 }
351 endif
352 test('qtest-@0@/@1@'.format(target_base, test),
353 qtest_executables[test],
354 depends: [test_deps, qtest_emulator, emulator_modules],
355 env: qtest_env,
356 args: ['--tap', '-k'],
357 protocol: 'tap',
358 timeout: slow_qtests.get(test, 30),
359 priority: slow_qtests.get(test, 30),
360 suite: ['qtest', 'qtest-' + target_base])
361 endforeach
362 endforeach