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