xref: /openbmc/qemu/tests/qtest/meson.build (revision 0038e9a2)
1slow_qtests = {
2  'ahci-test' : 60,
3  'bios-tables-test' : 120,
4  'boot-serial-test' : 60,
5  'migration-test' : 150,
6  'npcm7xx_pwm-test': 150,
7  'prom-env-test' : 60,
8  'pxe-test' : 60,
9  'qos-test' : 60,
10  'qom-test' : 300,
11  'test-hmp' : 120,
12}
13
14qtests_generic = [
15  'cdrom-test',
16  'device-introspect-test',
17  'machine-none-test',
18  'qmp-test',
19  'qmp-cmd-test',
20  'qom-test',
21  'test-hmp',
22  'qos-test',
23  'readconfig-test',
24]
25if config_host.has_key('CONFIG_MODULES')
26  qtests_generic += [ 'modules-test' ]
27endif
28
29qtests_pci = \
30  (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) +                  \
31  (config_all_devices.has_key('CONFIG_IVSHMEM_DEVICE') ? ['ivshmem-test'] : [])
32
33qtests_cxl = \
34  (config_all_devices.has_key('CONFIG_CXL') ? ['cxl-test'] : [])
35
36qtests_filter = \
37  (slirp.found() ? ['test-netfilter'] : []) + \
38  (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \
39  (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : [])
40
41qtests_i386 = \
42  (slirp.found() ? ['pxe-test'] : []) + \
43  qtests_filter + \
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_host.has_key('CONFIG_POSIX') and                                                  \
74   config_all_devices.has_key('CONFIG_ACPI_ERST') ? ['erst-test'] : []) +                   \
75  (config_all_devices.has_key('CONFIG_VIRTIO_NET') and                                      \
76   config_all_devices.has_key('CONFIG_Q35') and                                             \
77   config_all_devices.has_key('CONFIG_VIRTIO_PCI') and                                      \
78   slirp.found() ? ['virtio-net-failover'] : []) +                                          \
79  (unpack_edk2_blobs ? ['bios-tables-test'] : []) +                                         \
80  qtests_pci +                                                                              \
81  qtests_cxl +                                                                              \
82  ['fdc-test',
83   'ide-test',
84   'hd-geo-test',
85   'boot-order-test',
86   'rtc-test',
87   'i440fx-test',
88   'fw_cfg-test',
89   'device-plug-test',
90   'drive_del-test',
91   'tco-test',
92   'cpu-plug-test',
93   'q35-test',
94   'vmgenid-test',
95   'migration-test',
96   'test-x86-cpuid-compat',
97   'numa-test'
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  qtests_filter + \
122  (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : [])
123
124qtests_avr = [ 'boot-serial-test' ]
125
126qtests_hppa = ['boot-serial-test'] + \
127  qtests_filter + \
128  (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : [])
129
130qtests_m68k = ['boot-serial-test'] + \
131  qtests_filter
132
133qtests_microblaze = ['boot-serial-test'] + \
134  qtests_filter
135
136qtests_microblazeel = qtests_microblaze
137
138qtests_mips = \
139  qtests_filter + \
140  (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) +            \
141  (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : [])
142
143qtests_mipsel = qtests_mips
144qtests_mips64 = qtests_mips
145qtests_mips64el = qtests_mips
146
147qtests_ppc = \
148  qtests_filter + \
149  (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) +            \
150  (config_all_devices.has_key('CONFIG_M48T59') ? ['m48t59-test'] : []) +                     \
151  (config_all_devices.has_key('CONFIG_TCG') ? ['prom-env-test'] : []) +                      \
152  (config_all_devices.has_key('CONFIG_TCG') ? ['boot-serial-test'] : []) +                   \
153  ['boot-order-test']
154
155qtests_ppc64 = \
156  qtests_ppc + \
157  (config_all_devices.has_key('CONFIG_PSERIES') ? ['device-plug-test'] : []) +               \
158  (config_all_devices.has_key('CONFIG_POWERNV') ? ['pnv-xscom-test'] : []) +                 \
159  (config_all_devices.has_key('CONFIG_PSERIES') ? ['rtas-test'] : []) +                      \
160  (slirp.found() ? ['pxe-test'] : []) +              \
161  (config_all_devices.has_key('CONFIG_USB_UHCI') ? ['usb-hcd-uhci-test'] : []) +             \
162  (config_all_devices.has_key('CONFIG_USB_XHCI_NEC') ? ['usb-hcd-xhci-test'] : []) +         \
163  qtests_pci + ['migration-test', 'numa-test', 'cpu-plug-test', 'drive_del-test']
164
165qtests_sh4 = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : [])
166qtests_sh4eb = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : [])
167
168qtests_sparc = ['prom-env-test', 'm48t59-test', 'boot-serial-test'] + \
169  qtests_filter
170
171qtests_sparc64 = \
172  (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) +            \
173  qtests_filter + \
174  ['prom-env-test', 'boot-serial-test']
175
176qtests_npcm7xx = \
177  ['npcm7xx_adc-test',
178   'npcm7xx_gpio-test',
179   'npcm7xx_pwm-test',
180   'npcm7xx_rng-test',
181   'npcm7xx_sdhci-test',
182   'npcm7xx_smbus-test',
183   'npcm7xx_timer-test',
184   'npcm7xx_watchdog_timer-test'] + \
185   (slirp.found() ? ['npcm7xx_emc-test'] : [])
186qtests_aspeed = \
187  ['aspeed_hace-test',
188   'aspeed_smc-test',
189   'aspeed_gpio-test']
190qtests_arm = \
191  (config_all_devices.has_key('CONFIG_MPS2') ? ['sse-timer-test'] : []) + \
192  (config_all_devices.has_key('CONFIG_CMSDK_APB_DUALTIMER') ? ['cmsdk-apb-dualtimer-test'] : []) + \
193  (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-timer-test'] : []) + \
194  (config_all_devices.has_key('CONFIG_CMSDK_APB_WATCHDOG') ? ['cmsdk-apb-watchdog-test'] : []) + \
195  (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test'] : []) +         \
196  (config_all_devices.has_key('CONFIG_ASPEED_SOC') ? qtests_aspeed : []) + \
197  (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \
198  ['arm-cpu-features',
199   'microbit-test',
200   'test-arm-mptimer',
201   'boot-serial-test',
202   'hexloader-test']
203
204# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional
205qtests_aarch64 = \
206  (cpu != 'arm' and unpack_edk2_blobs ? ['bios-tables-test'] : []) +                            \
207  (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-test'] : []) +        \
208  (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-swtpm-test'] : []) +  \
209  (config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \
210  ['arm-cpu-features',
211   'numa-test',
212   'boot-serial-test',
213   'migration-test',
214   'bcm2835-dma-test']
215
216qtests_s390x = \
217  (slirp.found() ? ['pxe-test', 'test-netfilter'] : []) +                 \
218  (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) +                         \
219  (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : []) +                     \
220  ['boot-serial-test',
221   'drive_del-test',
222   'device-plug-test',
223   'virtio-ccw-test',
224   'cpu-plug-test',
225   'migration-test']
226
227qos_test_ss = ss.source_set()
228qos_test_ss.add(
229  'ac97-test.c',
230  'adm1272-test.c',
231  'ds1338-test.c',
232  'e1000-test.c',
233  'eepro100-test.c',
234  'es1370-test.c',
235  'ipoctal232-test.c',
236  'lsm303dlhc-mag-test.c',
237  'isl_pmbus_vr-test.c',
238  'max34451-test.c',
239  'megasas-test.c',
240  'ne2000-test.c',
241  'tulip-test.c',
242  'nvme-test.c',
243  'pca9552-test.c',
244  'pci-test.c',
245  'pcnet-test.c',
246  'sdhci-test.c',
247  'spapr-phb-test.c',
248  'tmp105-test.c',
249  'emc141x-test.c',
250  'usb-hcd-ohci-test.c',
251  'virtio-test.c',
252  'virtio-blk-test.c',
253  'virtio-net-test.c',
254  'virtio-rng-test.c',
255  'virtio-scsi-test.c',
256  'virtio-serial-test.c',
257  'virtio-iommu-test.c',
258  'vmxnet3-test.c',
259)
260if config_host.has_key('CONFIG_POSIX')
261  qos_test_ss.add(files('e1000e-test.c'))
262endif
263if have_virtfs
264  qos_test_ss.add(files('virtio-9p-test.c'))
265endif
266if have_vhost_user
267  qos_test_ss.add(files('vhost-user-test.c'))
268endif
269if have_tools and have_vhost_user_blk_server
270  qos_test_ss.add(files('vhost-user-blk-test.c'))
271endif
272
273tpmemu_files = ['tpm-emu.c', 'tpm-util.c', 'tpm-tests.c']
274
275migration_files = [files('migration-helpers.c')]
276if gnutls.found()
277  migration_files += [files('../unit/crypto-tls-psk-helpers.c'), gnutls]
278
279  if tasn1.found()
280    migration_files += [files('../unit/crypto-tls-x509-helpers.c',
281                              '../unit/pkix_asn1_tab.c'), tasn1]
282  endif
283endif
284
285qtests = {
286  'bios-tables-test': [io, 'boot-sector.c', 'acpi-utils.c', 'tpm-emu.c'],
287  'cdrom-test': files('boot-sector.c'),
288  'dbus-vmstate-test': files('migration-helpers.c') + dbus_vmstate1,
289  'erst-test': files('erst-test.c'),
290  'ivshmem-test': [rt, '../../contrib/ivshmem-server/ivshmem-server.c'],
291  'migration-test': migration_files,
292  'pxe-test': files('boot-sector.c'),
293  'qos-test': [chardev, io, qos_test_ss.apply(config_host, strict: false).sources()],
294  'tpm-crb-swtpm-test': [io, tpmemu_files],
295  'tpm-crb-test': [io, tpmemu_files],
296  'tpm-tis-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'],
297  'tpm-tis-test': [io, tpmemu_files, 'tpm-tis-util.c'],
298  'tpm-tis-device-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'],
299  'tpm-tis-device-test': [io, tpmemu_files, 'tpm-tis-util.c'],
300  'vmgenid-test': files('boot-sector.c', 'acpi-utils.c'),
301}
302
303gvnc = dependency('gvnc-1.0', required: false)
304if gvnc.found()
305  qtests += {'vnc-display-test': [gvnc]}
306  qtests_generic += [ 'vnc-display-test' ]
307endif
308
309if dbus_display
310  qtests += {'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