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