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