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