xref: /qemu/tests/functional/meson.build (revision 689a8b56a6f3d16458004006b604950295da87df)
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_reverse_debug' : 180,
17  'aarch64_rme_virt' : 1200,
18  'aarch64_rme_sbsaref' : 1200,
19  'aarch64_sbsaref_alpine' : 1200,
20  'aarch64_sbsaref_freebsd' : 720,
21  'aarch64_tuxrun' : 240,
22  'aarch64_virt' : 360,
23  'aarch64_virt_gpu' : 480,
24  'acpi_bits' : 420,
25  'arm_aspeed_palmetto' : 120,
26  'arm_aspeed_romulus' : 120,
27  'arm_aspeed_witherspoon' : 120,
28  'arm_aspeed_ast2500' : 720,
29  'arm_aspeed_ast2600' : 1200,
30  'arm_aspeed_bletchley' : 480,
31  'arm_aspeed_rainier' : 480,
32  'arm_bpim2u' : 500,
33  'arm_collie' : 180,
34  'arm_cubieboard' : 360,
35  'arm_orangepi' : 540,
36  'arm_quanta_gsj' : 240,
37  'arm_raspi2' : 120,
38  'arm_replay' : 240,
39  'arm_tuxrun' : 240,
40  'arm_sx1' : 360,
41  'intel_iommu': 300,
42  'mips_malta' : 480,
43  'mipsel_malta' : 420,
44  'mipsel_replay' : 480,
45  'mips64el_replay' : 180,
46  'netdev_ethtool' : 180,
47  'ppc_40p' : 240,
48  'ppc64_hv' : 1000,
49  'ppc64_powernv' : 480,
50  'ppc64_pseries' : 480,
51  'ppc64_replay' : 210,
52  'ppc64_tuxrun' : 420,
53  'ppc64_mac99' : 120,
54  'riscv64_tuxrun' : 120,
55  's390x_ccw_virtio' : 420,
56  'sh4_tuxrun' : 240,
57  'virtio_balloon': 120,
58  'x86_64_kvm_xen' : 180,
59  'x86_64_replay' : 480,
60}
61
62tests_generic_system = [
63  'empty_cpu_model',
64  'info_usernet',
65  'version',
66]
67
68tests_generic_linuxuser = [
69]
70
71tests_generic_bsduser = [
72]
73
74tests_aarch64_system_quick = [
75  'migration',
76]
77
78tests_aarch64_system_thorough = [
79  'aarch64_aspeed',
80  'aarch64_raspi3',
81  'aarch64_raspi4',
82  'aarch64_replay',
83  'aarch64_reverse_debug',
84  'aarch64_rme_virt',
85  'aarch64_rme_sbsaref',
86  'aarch64_sbsaref',
87  'aarch64_sbsaref_alpine',
88  'aarch64_sbsaref_freebsd',
89  'aarch64_tcg_plugins',
90  'aarch64_tuxrun',
91  'aarch64_virt',
92  'aarch64_virt_gpu',
93  'aarch64_xen',
94  'aarch64_xlnx_versal',
95  'multiprocess',
96]
97
98tests_alpha_system_quick = [
99  'migration',
100]
101
102tests_alpha_system_thorough = [
103  'alpha_clipper',
104  'alpha_replay',
105]
106
107tests_arm_system_quick = [
108  'migration',
109]
110
111tests_arm_system_thorough = [
112  'arm_aspeed_ast1030',
113  'arm_aspeed_palmetto',
114  'arm_aspeed_romulus',
115  'arm_aspeed_witherspoon',
116  'arm_aspeed_ast2500',
117  'arm_aspeed_ast2600',
118  'arm_aspeed_bletchley',
119  'arm_aspeed_rainier',
120  'arm_bpim2u',
121  'arm_canona1100',
122  'arm_collie',
123  'arm_cubieboard',
124  'arm_emcraft_sf2',
125  'arm_integratorcp',
126  'arm_microbit',
127  'arm_orangepi',
128  'arm_quanta_gsj',
129  'arm_raspi2',
130  'arm_replay',
131  'arm_smdkc210',
132  'arm_sx1',
133  'arm_vexpress',
134  'arm_virt',
135  'arm_tuxrun',
136]
137
138tests_arm_linuxuser_thorough = [
139  'arm_bflt',
140]
141
142tests_avr_system_thorough = [
143  'avr_mega2560',
144]
145
146tests_hppa_system_quick = [
147  'hppa_seabios',
148]
149
150tests_i386_system_quick = [
151  'migration',
152]
153
154tests_i386_system_thorough = [
155  'i386_replay',
156  'i386_tuxrun',
157]
158
159tests_loongarch64_system_thorough = [
160  'loongarch64_virt',
161]
162
163tests_m68k_system_thorough = [
164  'm68k_mcf5208evb',
165  'm68k_nextcube',
166  'm68k_replay',
167  'm68k_q800',
168  'm68k_tuxrun',
169]
170
171tests_microblaze_system_thorough = [
172  'microblaze_replay',
173  'microblaze_s3adsp1800'
174]
175
176tests_microblazeel_system_thorough = [
177  'microblazeel_s3adsp1800'
178]
179
180tests_mips_system_thorough = [
181  'mips_malta',
182  'mips_replay',
183  'mips_tuxrun',
184]
185
186tests_mipsel_system_thorough = [
187  'mipsel_malta',
188  'mipsel_replay',
189  'mipsel_tuxrun',
190]
191
192tests_mips64_system_thorough = [
193  'mips64_tuxrun',
194]
195
196tests_mips64el_system_thorough = [
197  'mips64el_fuloong2e',
198  'mips64el_loongson3v',
199  'mips64el_malta',
200  'mips64el_replay',
201  'mips64el_tuxrun',
202]
203
204tests_or1k_system_thorough = [
205  'or1k_replay',
206  'or1k_sim',
207]
208
209tests_ppc_system_quick = [
210  'migration',
211  'ppc_74xx',
212]
213
214tests_ppc_system_thorough = [
215  'ppc_40p',
216  'ppc_amiga',
217  'ppc_bamboo',
218  'ppc_mac',
219  'ppc_mpc8544ds',
220  'ppc_replay',
221  'ppc_sam460ex',
222  'ppc_tuxrun',
223  'ppc_virtex_ml507',
224]
225
226tests_ppc64_system_quick = [
227  'migration',
228]
229
230tests_ppc64_system_thorough = [
231  'ppc64_e500',
232  'ppc64_hv',
233  'ppc64_powernv',
234  'ppc64_pseries',
235  'ppc64_replay',
236  'ppc64_reverse_debug',
237  'ppc64_tuxrun',
238  'ppc64_mac99',
239]
240
241tests_riscv32_system_quick = [
242  'migration',
243  'riscv_opensbi',
244]
245
246tests_riscv32_system_thorough = [
247  'riscv32_tuxrun',
248]
249
250tests_riscv64_system_quick = [
251  'migration',
252  'riscv_opensbi',
253]
254
255tests_riscv64_system_thorough = [
256  'riscv64_tuxrun',
257]
258
259tests_rx_system_thorough = [
260  'rx_gdbsim',
261]
262
263tests_s390x_system_thorough = [
264  's390x_ccw_virtio',
265  's390x_replay',
266  's390x_topology',
267  's390x_tuxrun',
268]
269
270tests_sh4_system_thorough = [
271  'sh4_r2d',
272  'sh4_tuxrun',
273]
274
275tests_sh4eb_system_thorough = [
276  'sh4eb_r2d',
277]
278
279tests_sparc_system_quick = [
280  'migration',
281]
282
283tests_sparc_system_thorough = [
284  'sparc_replay',
285  'sparc_sun4m',
286]
287
288tests_sparc64_system_quick = [
289  'migration',
290]
291
292tests_sparc64_system_thorough = [
293  'sparc64_sun4u',
294  'sparc64_tuxrun',
295]
296
297tests_x86_64_system_quick = [
298  'cpu_queries',
299  'mem_addr_space',
300  'migration',
301  'pc_cpu_hotplug_props',
302  'virtio_version',
303  'x86_cpu_model_versions',
304  'vnc',
305]
306
307tests_x86_64_system_thorough = [
308  'acpi_bits',
309  'intel_iommu',
310  'linux_initrd',
311  'multiprocess',
312  'netdev_ethtool',
313  'virtio_balloon',
314  'virtio_gpu',
315  'x86_64_hotplug_blk',
316  'x86_64_hotplug_cpu',
317  'x86_64_kvm_xen',
318  'x86_64_replay',
319  'x86_64_reverse_debug',
320  'x86_64_tuxrun',
321]
322
323tests_xtensa_system_thorough = [
324  'xtensa_lx60',
325  'xtensa_replay',
326]
327
328precache_all = []
329foreach speed : ['quick', 'thorough']
330  foreach dir : target_dirs
331
332    target_base = dir.split('-')[0]
333
334    if dir.endswith('-softmmu')
335      sysmode = 'system'
336      test_emulator = emulators['qemu-system-' + target_base]
337    elif dir.endswith('-linux-user')
338      sysmode = 'linuxuser'
339      test_emulator = emulators['qemu-' + target_base]
340    elif dir.endswith('-bsd-user')
341      sysmode = 'bsduser'
342      test_emulator = emulators['qemu-' + target_base]
343    else
344      continue
345    endif
346
347    if speed == 'quick'
348      suites = ['func-quick', 'func-' + target_base]
349      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
350                     + get_variable('tests_generic_' + sysmode)
351    else
352      suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
353      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
354    endif
355
356    test_deps = roms
357    test_env = environment()
358    if have_tools
359      test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
360      test_deps += [qemu_img]
361    endif
362    test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
363    test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
364    test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
365                               meson.current_source_dir())
366
367    foreach test : target_tests
368      testname = '@0@-@1@'.format(target_base, test)
369      testfile = 'test_' + test + '.py'
370      testpath = meson.current_source_dir() / testfile
371      teststamp = testname + '.tstamp'
372      test_precache_env = environment()
373      test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
374      test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
375                                          meson.current_source_dir())
376      precache = custom_target('func-precache-' + testname,
377                               output: teststamp,
378                               command: [python, testpath],
379                               depend_files: files(testpath),
380                               build_by_default: false,
381                               env: test_precache_env)
382      precache_all += precache
383
384      # Ideally we would add 'precache' to 'depends' here, such that
385      # 'build_by_default: false' lets the pre-caching automatically
386      # run immediately before the test runs. In practice this is
387      # broken in meson, with it running the pre-caching in the normal
388      # compile phase https://github.com/mesonbuild/meson/issues/2518
389      # If the above bug ever gets fixed, when QEMU changes the min
390      # meson version, add the 'depends' and remove the custom
391      # 'run_target' logic below & in Makefile.include
392      test('func-' + testname,
393           python,
394           depends: [test_deps, test_emulator, emulator_modules, plugin_modules],
395           env: test_env,
396           args: [testpath],
397           protocol: 'tap',
398           timeout: test_timeouts.get(test, 90),
399           priority: test_timeouts.get(test, 90),
400           suite: suites)
401    endforeach
402  endforeach
403endforeach
404
405run_target('precache-functional',
406           depends: precache_all,
407           command: ['true'])
408