tests/qtest: Only run fuzz-megasas-test if megasas device is available
[qemu/ar7.git] / tests / qtest / meson.build
blob536991cdb8e9f1f895dae972a80be5a00c6fdcb7
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   (config_all_devices.has_key('CONFIG_MEGASAS_SCSI_PCI') ? ['fuzz-megasas-test'] : []) + \
22   [
23   'cdrom-test',
24   'device-introspect-test',
25   'machine-none-test',
26   'qmp-test',
27   'qmp-cmd-test',
28   'qom-test',
29   'test-hmp',
30   'qos-test',
32 if config_host.has_key('CONFIG_MODULES')
33   qtests_generic += [ 'modules-test' ]
34 endif
35 if slirp.found()
36   qtests_generic += [ 'test-query-netdev' ]
37 endif
39 qtests_pci = \
40   (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) +                  \
41   (config_all_devices.has_key('CONFIG_IVSHMEM_DEVICE') ? ['ivshmem-test'] : [])
43 qtests_i386 = \
44   (slirp.found() ? ['pxe-test', 'test-netfilter'] : []) +             \
45   (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) +                     \
46   (have_tools ? ['ahci-test'] : []) +                                                       \
47   (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) +           \
48   (config_all_devices.has_key('CONFIG_SGA') ? ['boot-serial-test'] : []) +                  \
49   (config_all_devices.has_key('CONFIG_RTL8139_PCI') ? ['test-filter-redirector'] : []) +    \
50   (config_all_devices.has_key('CONFIG_ISA_IPMI_KCS') ? ['ipmi-kcs-test'] : []) +            \
51   (config_host.has_key('CONFIG_LINUX') and                                                  \
52    config_all_devices.has_key('CONFIG_ISA_IPMI_BT') ? ['ipmi-bt-test'] : []) +              \
53   (config_all_devices.has_key('CONFIG_WDT_IB700') ? ['wdt_ib700-test'] : []) +              \
54   (config_all_devices.has_key('CONFIG_PVPANIC_ISA') ? ['pvpanic-test'] : []) +              \
55   (config_all_devices.has_key('CONFIG_PVPANIC_PCI') ? ['pvpanic-pci-test'] : []) +          \
56   (config_all_devices.has_key('CONFIG_HDA') ? ['intel-hda-test'] : []) +                    \
57   (config_all_devices.has_key('CONFIG_I82801B11') ? ['i82801b11-test'] : []) +             \
58   (config_all_devices.has_key('CONFIG_IOH3420') ? ['ioh3420-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   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    'fuzz-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']
88 dbus_daemon = find_program('dbus-daemon', required: false)
89 if 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()
99 else
100   dbus_vmstate1 = []
101 endif
103 qtests_x86_64 = qtests_i386
105 qtests_alpha = [ 'boot-serial-test' ] +                                                      \
106   (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : [])
108 qtests_avr = [ 'boot-serial-test' ]
110 qtests_hppa = [ 'boot-serial-test' ] +                                                       \
111   (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : [])
113 qtests_m68k = [ 'boot-serial-test' ]
114 qtests_microblaze = [ 'boot-serial-test' ]
115 qtests_microblazeel = qtests_microblaze
117 qtests_mips = \
118   (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) +            \
119   (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : [])
121 qtests_mips64 = \
122   (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) +            \
123   (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : [])
125 qtests_mips64el = \
126   (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) +            \
127   (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : [])
129 qtests_moxie = [ 'boot-serial-test' ]
131 qtests_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']                 \
136 qtests_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']
146 qtests_sh4 = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : [])
147 qtests_sh4eb = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : [])
149 qtests_sparc = ['prom-env-test', 'm48t59-test', 'boot-serial-test']
151 qtests_sparc64 = \
152   (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) +            \
153   ['prom-env-test', 'boot-serial-test']
155 qtests_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'] : [])
164 qtests_arm = \
165   (config_all_devices.has_key('CONFIG_MPS2') ? ['sse-timer-test'] : []) + \
166   (config_all_devices.has_key('CONFIG_CMSDK_APB_DUALTIMER') ? ['cmsdk-apb-dualtimer-test'] : []) + \
167   (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-timer-test'] : []) + \
168   (config_all_devices.has_key('CONFIG_CMSDK_APB_WATCHDOG') ? ['cmsdk-apb-watchdog-test'] : []) + \
169   (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test'] : []) +         \
170   (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \
171   ['arm-cpu-features',
172    'microbit-test',
173    'm25p80-test',
174    'test-arm-mptimer',
175    'boot-serial-test',
176    'hexloader-test']
178 # TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional
179 qtests_aarch64 = \
180   (cpu != 'arm' ? ['bios-tables-test'] : []) +                                                  \
181   (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-test'] : []) +        \
182   (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-swtpm-test'] : []) +  \
183   ['arm-cpu-features',
184    'numa-test',
185    'boot-serial-test',
186    'xlnx-can-test',
187    'migration-test']
189 qtests_s390x = \
190   (slirp.found() ? ['pxe-test', 'test-netfilter'] : []) +                 \
191   (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) +                         \
192   (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : []) +                     \
193   ['boot-serial-test',
194    'drive_del-test',
195    'device-plug-test',
196    'virtio-ccw-test',
197    'cpu-plug-test',
198    'migration-test']
200 qos_test_ss = ss.source_set()
201 qos_test_ss.add(
202   'ac97-test.c',
203   'ds1338-test.c',
204   'e1000-test.c',
205   'e1000e-test.c',
206   'eepro100-test.c',
207   'es1370-test.c',
208   'ipoctal232-test.c',
209   'megasas-test.c',
210   'ne2000-test.c',
211   'tulip-test.c',
212   'nvme-test.c',
213   'pca9552-test.c',
214   'pci-test.c',
215   'pcnet-test.c',
216   'sdhci-test.c',
217   'spapr-phb-test.c',
218   'tmp105-test.c',
219   'emc141x-test.c',
220   'usb-hcd-ohci-test.c',
221   'virtio-test.c',
222   'virtio-blk-test.c',
223   'virtio-net-test.c',
224   'virtio-rng-test.c',
225   'virtio-scsi-test.c',
226   'virtio-serial-test.c',
227   'vmxnet3-test.c',
229 if have_virtfs
230   qos_test_ss.add(files('virtio-9p-test.c'))
231 endif
232 qos_test_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user-test.c'))
234 tpmemu_files = ['tpm-emu.c', 'tpm-util.c', 'tpm-tests.c']
236 qtests = {
237   'bios-tables-test': [io, 'boot-sector.c', 'acpi-utils.c', 'tpm-emu.c'],
238   'cdrom-test': files('boot-sector.c'),
239   'dbus-vmstate-test': files('migration-helpers.c') + dbus_vmstate1,
240   'ivshmem-test': [rt, '../../contrib/ivshmem-server/ivshmem-server.c'],
241   'migration-test': files('migration-helpers.c'),
242   'pxe-test': files('boot-sector.c'),
243   'qos-test': [chardev, io, qos_test_ss.apply(config_host, strict: false).sources()],
244   'tpm-crb-swtpm-test': [io, tpmemu_files],
245   'tpm-crb-test': [io, tpmemu_files],
246   'tpm-tis-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'],
247   'tpm-tis-test': [io, tpmemu_files, 'tpm-tis-util.c'],
248   'tpm-tis-device-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'],
249   'tpm-tis-device-test': [io, tpmemu_files, 'tpm-tis-util.c'],
250   'vmgenid-test': files('boot-sector.c', 'acpi-utils.c'),
253 qtest_executables = {}
254 foreach dir : target_dirs
255   if not dir.endswith('-softmmu')
256     continue
257   endif
259   target_base = dir.split('-')[0]
260   qtest_emulator = emulators['qemu-system-' + target_base]
261   target_qtests = get_variable('qtests_' + target_base, []) + qtests_generic
263   test_deps = []
264   qtest_env = environment()
265   if have_tools
266     qtest_env.set('QTEST_QEMU_IMG', './qemu-img')
267     test_deps += [qemu_img]
268   endif
269   qtest_env.set('G_TEST_DBUS_DAEMON', meson.source_root() / 'tests/dbus-vmstate-daemon.sh')
270   qtest_env.set('QTEST_QEMU_BINARY', './qemu-system-' + target_base)
271   
272   foreach test : target_qtests
273     # Executables are shared across targets, declare them only the first time we
274     # encounter them
275     if not qtest_executables.has_key(test)
276       src = [test + '.c']
277       deps = [qemuutil, qos]
278       if test in qtests
279         # use a sourceset to quickly separate sources and deps
280         test_ss = ss.source_set()
281         test_ss.add(qtests[test])
282         src += test_ss.all_sources()
283         deps += test_ss.all_dependencies()
284       endif
285       qtest_executables += {
286         test: executable(test, src, dependencies: deps)
287       }
288     endif
289     # FIXME: missing dependency on the emulator binary and qemu-img
290     test('qtest-@0@/@1@'.format(target_base, test),
291          qtest_executables[test],
292          depends: [test_deps, qtest_emulator],
293          env: qtest_env,
294          args: ['--tap', '-k'],
295          protocol: 'tap',
296          timeout: slow_qtests.get(test, 30),
297          priority: slow_qtests.get(test, 30),
298          suite: ['qtest', 'qtest-' + target_base])
299   endforeach
300 endforeach