xref: /qemu/tests/qtest/meson.build (revision d201cf7a)
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_smbus-test',
194   'npcm7xx_timer-test',
195   'npcm7xx_watchdog_timer-test'] + \
196   (slirp.found() ? ['npcm7xx_emc-test'] : [])
197qtests_aspeed = \
198  ['aspeed_hace-test',
199   'aspeed_smc-test']
200qtests_arm = \
201  (config_all_devices.has_key('CONFIG_MPS2') ? ['sse-timer-test'] : []) + \
202  (config_all_devices.has_key('CONFIG_CMSDK_APB_DUALTIMER') ? ['cmsdk-apb-dualtimer-test'] : []) + \
203  (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-timer-test'] : []) + \
204  (config_all_devices.has_key('CONFIG_CMSDK_APB_WATCHDOG') ? ['cmsdk-apb-watchdog-test'] : []) + \
205  (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test'] : []) +         \
206  (config_all_devices.has_key('CONFIG_ASPEED_SOC') ? qtests_aspeed : []) + \
207  (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \
208  ['arm-cpu-features',
209   'microbit-test',
210   'test-arm-mptimer',
211   'boot-serial-test',
212   'hexloader-test']
213
214# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional
215qtests_aarch64 = \
216  (cpu != 'arm' and unpack_edk2_blobs ? ['bios-tables-test'] : []) +                            \
217  (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-test'] : []) +        \
218  (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-swtpm-test'] : []) +  \
219  (config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \
220  ['arm-cpu-features',
221   'numa-test',
222   'boot-serial-test',
223   'migration-test']
224
225qtests_s390x = \
226  (slirp.found() ? ['pxe-test', 'test-netfilter'] : []) +                 \
227  (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) +                         \
228  (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : []) +                     \
229  ['boot-serial-test',
230   'drive_del-test',
231   'device-plug-test',
232   'virtio-ccw-test',
233   'cpu-plug-test',
234   'migration-test']
235
236qos_test_ss = ss.source_set()
237qos_test_ss.add(
238  'ac97-test.c',
239  'adm1272-test.c',
240  'ds1338-test.c',
241  'e1000-test.c',
242  'e1000e-test.c',
243  'eepro100-test.c',
244  'es1370-test.c',
245  'ipoctal232-test.c',
246  'lsm303dlhc-mag-test.c',
247  'max34451-test.c',
248  'megasas-test.c',
249  'ne2000-test.c',
250  'tulip-test.c',
251  'nvme-test.c',
252  'pca9552-test.c',
253  'pci-test.c',
254  'pcnet-test.c',
255  'sdhci-test.c',
256  'spapr-phb-test.c',
257  'tmp105-test.c',
258  'emc141x-test.c',
259  'usb-hcd-ohci-test.c',
260  'virtio-test.c',
261  'virtio-blk-test.c',
262  'virtio-net-test.c',
263  'virtio-rng-test.c',
264  'virtio-scsi-test.c',
265  'virtio-serial-test.c',
266  'virtio-iommu-test.c',
267  'vmxnet3-test.c',
268)
269if have_virtfs
270  qos_test_ss.add(files('virtio-9p-test.c'))
271endif
272qos_test_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user-test.c'))
273if have_tools and have_vhost_user_blk_server
274  qos_test_ss.add(files('vhost-user-blk-test.c'))
275endif
276
277tpmemu_files = ['tpm-emu.c', 'tpm-util.c', 'tpm-tests.c']
278
279qtests = {
280  'bios-tables-test': [io, 'boot-sector.c', 'acpi-utils.c', 'tpm-emu.c'],
281  'cdrom-test': files('boot-sector.c'),
282  'dbus-vmstate-test': files('migration-helpers.c') + dbus_vmstate1,
283  'erst-test': files('erst-test.c'),
284  'ivshmem-test': [rt, '../../contrib/ivshmem-server/ivshmem-server.c'],
285  'migration-test': files('migration-helpers.c'),
286  'pxe-test': files('boot-sector.c'),
287  'qos-test': [chardev, io, qos_test_ss.apply(config_host, strict: false).sources()],
288  'tpm-crb-swtpm-test': [io, tpmemu_files],
289  'tpm-crb-test': [io, tpmemu_files],
290  'tpm-tis-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'],
291  'tpm-tis-test': [io, tpmemu_files, 'tpm-tis-util.c'],
292  'tpm-tis-device-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'],
293  'tpm-tis-device-test': [io, tpmemu_files, 'tpm-tis-util.c'],
294  'vmgenid-test': files('boot-sector.c', 'acpi-utils.c'),
295}
296
297if dbus_display
298qtests += {'dbus-display-test': [dbus_display1, gio]}
299endif
300
301qtest_executables = {}
302foreach dir : target_dirs
303  if not dir.endswith('-softmmu')
304    continue
305  endif
306
307  target_base = dir.split('-')[0]
308  qtest_emulator = emulators['qemu-system-' + target_base]
309  target_qtests = get_variable('qtests_' + target_base, []) + qtests_generic
310
311  test_deps = roms
312  qtest_env = environment()
313  if have_tools
314    qtest_env.set('QTEST_QEMU_IMG', './qemu-img')
315    test_deps += [qemu_img]
316  endif
317  qtest_env.set('G_TEST_DBUS_DAEMON', meson.project_source_root() / 'tests/dbus-vmstate-daemon.sh')
318  qtest_env.set('QTEST_QEMU_BINARY', './qemu-system-' + target_base)
319  if have_tools and have_vhost_user_blk_server
320    qtest_env.set('QTEST_QEMU_STORAGE_DAEMON_BINARY', './storage-daemon/qemu-storage-daemon')
321    test_deps += [qsd]
322  endif
323
324  foreach test : target_qtests
325    # Executables are shared across targets, declare them only the first time we
326    # encounter them
327    if not qtest_executables.has_key(test)
328      src = [test + '.c']
329      deps = [qemuutil, qos]
330      if test in qtests
331        # use a sourceset to quickly separate sources and deps
332        test_ss = ss.source_set()
333        test_ss.add(qtests[test])
334        src += test_ss.all_sources()
335        deps += test_ss.all_dependencies()
336      endif
337      qtest_executables += {
338        test: executable(test, src, dependencies: deps)
339      }
340    endif
341    test('qtest-@0@/@1@'.format(target_base, test),
342         qtest_executables[test],
343         depends: [test_deps, qtest_emulator, emulator_modules],
344         env: qtest_env,
345         args: ['--tap', '-k'],
346         protocol: 'tap',
347         timeout: slow_qtests.get(test, 30),
348         priority: slow_qtests.get(test, 30),
349         suite: ['qtest', 'qtest-' + target_base])
350  endforeach
351endforeach
352