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