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