xref: /openbmc/qemu/tests/qtest/meson.build (revision bb7e03cb)
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  '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]
30if config_host.has_key('CONFIG_MODULES')
31  qtests_generic += [ 'modules-test' ]
32endif
33
34qtests_pci = \
35  (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) +                  \
36  (config_all_devices.has_key('CONFIG_IVSHMEM_DEVICE') ? ['ivshmem-test'] : [])
37
38qtests_cxl = \
39  (config_all_devices.has_key('CONFIG_CXL') ? ['cxl-test'] : [])
40
41qtests_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
100if dbus_display
101  qtests_i386 += ['dbus-display-test']
102endif
103
104dbus_daemon = find_program('dbus-daemon', required: false)
105if 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()
114else
115  dbus_vmstate1 = []
116endif
117
118qtests_x86_64 = qtests_i386
119
120qtests_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
125qtests_avr = [ 'boot-serial-test' ]
126
127qtests_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
132qtests_m68k = ['boot-serial-test'] + \
133  ['test-filter-mirror', 'test-filter-redirector'] + \
134  (slirp.found() ? ['test-netfilter'] : [])
135
136qtests_microblaze = ['boot-serial-test'] + \
137  ['test-filter-mirror', 'test-filter-redirector'] + \
138  (slirp.found() ? ['test-netfilter'] : [])
139
140qtests_microblazeel = qtests_microblaze
141
142qtests_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
148qtests_mipsel = qtests_mips
149qtests_mips64 = qtests_mips
150qtests_mips64el = qtests_mips
151
152qtests_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
161qtests_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
171qtests_sh4 = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : [])
172qtests_sh4eb = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : [])
173
174qtests_sparc = ['prom-env-test', 'm48t59-test', 'boot-serial-test'] + \
175  ['test-filter-mirror', 'test-filter-redirector'] + \
176  (slirp.found() ? ['test-netfilter'] : [])
177
178qtests_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
184qtests_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'] : [])
194qtests_aspeed = \
195  ['aspeed_hace-test',
196   'aspeed_smc-test',
197   'aspeed_gpio-test']
198qtests_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
213qtests_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   'bcm2835-dma-test']
223
224qtests_s390x = \
225  (slirp.found() ? ['pxe-test', 'test-netfilter'] : []) +                 \
226  (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) +                         \
227  (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : []) +                     \
228  ['boot-serial-test',
229   'drive_del-test',
230   'device-plug-test',
231   'virtio-ccw-test',
232   'cpu-plug-test',
233   'migration-test']
234
235qos_test_ss = ss.source_set()
236qos_test_ss.add(
237  'ac97-test.c',
238  'adm1272-test.c',
239  'ds1338-test.c',
240  'e1000-test.c',
241  'e1000e-test.c',
242  'eepro100-test.c',
243  'es1370-test.c',
244  'ipoctal232-test.c',
245  'lsm303dlhc-mag-test.c',
246  'isl_pmbus_vr-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
272if have_vhost_user
273  qos_test_ss.add(files('vhost-user-test.c'))
274endif
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
281migration_files = [files('migration-helpers.c')]
282if gnutls.found()
283  migration_files += [files('../unit/crypto-tls-psk-helpers.c'), gnutls]
284
285  if tasn1.found()
286    migration_files += [files('../unit/crypto-tls-x509-helpers.c',
287                              '../unit/pkix_asn1_tab.c'), tasn1]
288  endif
289endif
290
291qtests = {
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'),
307}
308
309if dbus_display
310qtests += {'dbus-display-test': [dbus_display1, gio]}
311endif
312
313qtest_executables = {}
314foreach dir : target_dirs
315  if not dir.endswith('-softmmu')
316    continue
317  endif
318
319  target_base = dir.split('-')[0]
320  qtest_emulator = emulators['qemu-system-' + target_base]
321  target_qtests = get_variable('qtests_' + target_base, []) + qtests_generic
322
323  test_deps = roms
324  qtest_env = environment()
325  if have_tools
326    qtest_env.set('QTEST_QEMU_IMG', './qemu-img')
327    test_deps += [qemu_img]
328  endif
329  qtest_env.set('G_TEST_DBUS_DAEMON', meson.project_source_root() / 'tests/dbus-vmstate-daemon.sh')
330  qtest_env.set('QTEST_QEMU_BINARY', './qemu-system-' + target_base)
331  if have_tools and have_vhost_user_blk_server
332    qtest_env.set('QTEST_QEMU_STORAGE_DAEMON_BINARY', './storage-daemon/qemu-storage-daemon')
333    test_deps += [qsd]
334  endif
335
336  foreach test : target_qtests
337    # Executables are shared across targets, declare them only the first time we
338    # encounter them
339    if not qtest_executables.has_key(test)
340      src = [test + '.c']
341      deps = [qemuutil, qos]
342      if test in qtests
343        # use a sourceset to quickly separate sources and deps
344        test_ss = ss.source_set()
345        test_ss.add(qtests[test])
346        src += test_ss.all_sources()
347        deps += test_ss.all_dependencies()
348      endif
349      qtest_executables += {
350        test: executable(test, src, dependencies: deps)
351      }
352    endif
353    test('qtest-@0@/@1@'.format(target_base, test),
354         qtest_executables[test],
355         depends: [test_deps, qtest_emulator, emulator_modules],
356         env: qtest_env,
357         args: ['--tap', '-k'],
358         protocol: 'tap',
359         timeout: slow_qtests.get(test, 30),
360         priority: slow_qtests.get(test, 30),
361         suite: ['qtest', 'qtest-' + target_base])
362  endforeach
363endforeach
364