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