xref: /qemu/tests/functional/meson.build (revision e6c9ab0b1808004ded669fcad93134422c70e62f)
1# QEMU functional tests:
2# Tests that are put in the 'quick' category are run by default during
3# 'make check'. Everything that should not be run during 'make check'
4# (e.g. tests that fetch assets from the internet) should be put into
5# the 'thorough' category instead.
6
7# Most tests run too slow with TCI enabled, so skip the functional tests there
8if get_option('tcg_interpreter')
9  subdir_done()
10endif
11
12# Timeouts for individual tests that can be slow e.g. with debugging enabled
13test_timeouts = {
14  'aarch64_aspeed' : 600,
15  'aarch64_raspi4' : 480,
16  'aarch64_rme_virt' : 1200,
17  'aarch64_rme_sbsaref' : 1200,
18  'aarch64_sbsaref_alpine' : 720,
19  'aarch64_sbsaref_freebsd' : 720,
20  'aarch64_tuxrun' : 240,
21  'aarch64_virt' : 720,
22  'acpi_bits' : 420,
23  'arm_aspeed_palmetto' : 120,
24  'arm_aspeed_romulus' : 120,
25  'arm_aspeed_ast2500' : 480,
26  'arm_aspeed_ast2600' : 720,
27  'arm_aspeed_rainier' : 240,
28  'arm_bpim2u' : 500,
29  'arm_collie' : 180,
30  'arm_cubieboard' : 360,
31  'arm_orangepi' : 540,
32  'arm_quanta_gsj' : 240,
33  'arm_raspi2' : 120,
34  'arm_tuxrun' : 240,
35  'arm_sx1' : 360,
36  'intel_iommu': 300,
37  'mips_malta' : 120,
38  'netdev_ethtool' : 180,
39  'ppc_40p' : 240,
40  'ppc64_hv' : 1000,
41  'ppc64_powernv' : 480,
42  'ppc64_pseries' : 480,
43  'ppc64_tuxrun' : 420,
44  'riscv64_tuxrun' : 120,
45  's390x_ccw_virtio' : 420,
46  'sh4_tuxrun' : 240,
47}
48
49tests_generic_system = [
50  'empty_cpu_model',
51  'info_usernet',
52  'version',
53]
54
55tests_generic_linuxuser = [
56]
57
58tests_generic_bsduser = [
59]
60
61tests_aarch64_system_thorough = [
62  'aarch64_aspeed',
63  'aarch64_raspi3',
64  'aarch64_raspi4',
65  'aarch64_rme_virt',
66  'aarch64_rme_sbsaref',
67  'aarch64_sbsaref',
68  'aarch64_sbsaref_alpine',
69  'aarch64_sbsaref_freebsd',
70  'aarch64_tuxrun',
71  'aarch64_virt',
72  'aarch64_xlnx_versal',
73  'multiprocess',
74]
75
76tests_alpha_system_thorough = [
77  'alpha_clipper',
78]
79
80tests_arm_system_thorough = [
81  'arm_aspeed_ast1030',
82  'arm_aspeed_palmetto',
83  'arm_aspeed_romulus',
84  'arm_aspeed_ast2500',
85  'arm_aspeed_ast2600',
86  'arm_aspeed_rainier',
87  'arm_bpim2u',
88  'arm_canona1100',
89  'arm_collie',
90  'arm_cubieboard',
91  'arm_emcraft_sf2',
92  'arm_integratorcp',
93  'arm_orangepi',
94  'arm_quanta_gsj',
95  'arm_raspi2',
96  'arm_smdkc210',
97  'arm_sx1',
98  'arm_vexpress',
99  'arm_virt',
100  'arm_tuxrun',
101]
102
103tests_arm_linuxuser_thorough = [
104  'arm_bflt',
105]
106
107tests_avr_system_thorough = [
108  'avr_mega2560',
109]
110
111tests_i386_system_thorough = [
112  'i386_tuxrun',
113]
114
115tests_loongarch64_system_thorough = [
116  'loongarch64_virt',
117]
118
119tests_m68k_system_thorough = [
120  'm68k_mcf5208evb',
121  'm68k_nextcube',
122  'm68k_q800',
123  'm68k_tuxrun',
124]
125
126tests_microblaze_system_thorough = [
127  'microblaze_s3adsp1800'
128]
129
130tests_microblazeel_system_thorough = [
131  'microblazeel_s3adsp1800'
132]
133
134tests_mips_system_thorough = [
135  'mips_malta',
136  'mips_tuxrun',
137]
138
139tests_mipsel_system_thorough = [
140  'mipsel_malta',
141  'mipsel_tuxrun',
142]
143
144tests_mips64_system_thorough = [
145  'mips64_tuxrun',
146]
147
148tests_mips64el_system_thorough = [
149  'mips64el_fuloong2e',
150  'mips64el_loongson3v',
151  'mips64el_malta',
152  'mips64el_tuxrun',
153]
154
155tests_or1k_system_thorough = [
156  'or1k_sim',
157]
158
159tests_ppc_system_quick = [
160  'ppc_74xx',
161]
162
163tests_ppc_system_thorough = [
164  'ppc_405',
165  'ppc_40p',
166  'ppc_amiga',
167  'ppc_bamboo',
168  'ppc_mac',
169  'ppc_mpc8544ds',
170  'ppc_tuxrun',
171  'ppc_virtex_ml507',
172]
173
174tests_ppc64_system_thorough = [
175  'ppc64_e500',
176  'ppc64_hv',
177  'ppc64_powernv',
178  'ppc64_pseries',
179  'ppc64_tuxrun',
180]
181
182tests_riscv32_system_quick = [
183  'riscv_opensbi',
184]
185
186tests_riscv32_system_thorough = [
187  'riscv32_tuxrun',
188]
189
190tests_riscv64_system_quick = [
191  'riscv_opensbi',
192]
193
194tests_riscv64_system_thorough = [
195  'riscv64_tuxrun',
196]
197
198tests_rx_system_thorough = [
199  'rx_gdbsim',
200]
201
202tests_s390x_system_thorough = [
203  's390x_ccw_virtio',
204  's390x_topology',
205  's390x_tuxrun',
206]
207
208tests_sh4_system_thorough = [
209  'sh4_r2d',
210  'sh4_tuxrun',
211]
212
213tests_sh4eb_system_thorough = [
214  'sh4eb_r2d',
215]
216
217tests_sparc_system_thorough = [
218  'sparc_sun4m',
219]
220
221tests_sparc64_system_thorough = [
222  'sparc64_sun4u',
223  'sparc64_tuxrun',
224]
225
226tests_x86_64_system_quick = [
227  'cpu_queries',
228  'mem_addr_space',
229  'pc_cpu_hotplug_props',
230  'virtio_version',
231  'x86_cpu_model_versions',
232  'vnc',
233]
234
235tests_x86_64_system_thorough = [
236  'acpi_bits',
237  'intel_iommu',
238  'linux_initrd',
239  'multiprocess',
240  'netdev_ethtool',
241  'virtio_gpu',
242  'x86_64_hotplug_cpu',
243  'x86_64_tuxrun',
244]
245
246tests_xtensa_system_thorough = [
247  'xtensa_lx60',
248]
249
250precache_all = []
251foreach speed : ['quick', 'thorough']
252  foreach dir : target_dirs
253
254    target_base = dir.split('-')[0]
255
256    if dir.endswith('-softmmu')
257      sysmode = 'system'
258      test_emulator = emulators['qemu-system-' + target_base]
259    elif dir.endswith('-linux-user')
260      sysmode = 'linuxuser'
261      test_emulator = emulators['qemu-' + target_base]
262    elif dir.endswith('-bsd-user')
263      sysmode = 'bsduser'
264      test_emulator = emulators['qemu-' + target_base]
265    else
266      continue
267    endif
268
269    if speed == 'quick'
270      suites = ['func-quick', 'func-' + target_base]
271      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
272                     + get_variable('tests_generic_' + sysmode)
273    else
274      suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
275      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
276    endif
277
278    test_deps = roms
279    test_env = environment()
280    if have_tools
281      test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
282      test_deps += [qemu_img]
283    endif
284    test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
285    test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
286    test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
287                               meson.current_source_dir())
288
289    foreach test : target_tests
290      testname = '@0@-@1@'.format(target_base, test)
291      testfile = 'test_' + test + '.py'
292      testpath = meson.current_source_dir() / testfile
293      teststamp = testname + '.tstamp'
294      test_precache_env = environment()
295      test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
296      test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
297                                          meson.current_source_dir())
298      precache = custom_target('func-precache-' + testname,
299                               output: teststamp,
300                               command: [python, testpath],
301                               depend_files: files(testpath),
302                               build_by_default: false,
303                               env: test_precache_env)
304      precache_all += precache
305
306      # Ideally we would add 'precache' to 'depends' here, such that
307      # 'build_by_default: false' lets the pre-caching automatically
308      # run immediately before the test runs. In practice this is
309      # broken in meson, with it running the pre-caching in the normal
310      # compile phase https://github.com/mesonbuild/meson/issues/2518
311      # If the above bug ever gets fixed, when QEMU changes the min
312      # meson version, add the 'depends' and remove the custom
313      # 'run_target' logic below & in Makefile.include
314      test('func-' + testname,
315           python,
316           depends: [test_deps, test_emulator, emulator_modules],
317           env: test_env,
318           args: [testpath],
319           protocol: 'tap',
320           timeout: test_timeouts.get(test, 90),
321           priority: test_timeouts.get(test, 90),
322           suite: suites)
323    endforeach
324  endforeach
325endforeach
326
327run_target('precache-functional',
328           depends: precache_all,
329           command: ['true'])
330