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