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