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