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