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