xref: /qemu/tests/functional/meson.build (revision a14dfd93b55cb9545a510ac0e008479ada25ef94)
114973778SThomas Huth# QEMU functional tests:
214973778SThomas Huth# Tests that are put in the 'quick' category are run by default during
314973778SThomas Huth# 'make check'. Everything that should not be run during 'make check'
414973778SThomas Huth# (e.g. tests that fetch assets from the internet) should be put into
514973778SThomas Huth# the 'thorough' category instead.
614973778SThomas Huth
714973778SThomas Huth# Most tests run too slow with TCI enabled, so skip the functional tests there
814973778SThomas Huthif get_option('tcg_interpreter')
914973778SThomas Huth  subdir_done()
1014973778SThomas Huthendif
1114973778SThomas Huth
1214973778SThomas Huth# Timeouts for individual tests that can be slow e.g. with debugging enabled
1314973778SThomas Huthtest_timeouts = {
14c95309b2SCédric Le Goater  'aarch64_aspeed' : 600,
15f5ccd7e0SThomas Huth  'aarch64_raspi4' : 480,
160d77c908SPierrick Bouvier  'aarch64_rme_virt' : 1200,
170d77c908SPierrick Bouvier  'aarch64_rme_sbsaref' : 1200,
189acd3884SThomas Huth  'aarch64_sbsaref_alpine' : 720,
199acd3884SThomas Huth  'aarch64_sbsaref_freebsd' : 720,
2037136902SThomas Huth  'aarch64_tuxrun' : 240,
21f5ccd7e0SThomas Huth  'aarch64_virt' : 720,
22f5ccd7e0SThomas Huth  'acpi_bits' : 420,
23e517cff7SCédric Le Goater  'arm_aspeed_palmetto' : 120,
245f2b9738SCédric Le Goater  'arm_aspeed_romulus' : 120,
2508743dbaSCédric Le Goater  'arm_aspeed_ast2500' : 480,
26c7bc9cabSCédric Le Goater  'arm_aspeed_ast2600' : 720,
2738cd5c52SCédric Le Goater  'arm_aspeed_rainier' : 240,
28f5ccd7e0SThomas Huth  'arm_bpim2u' : 500,
29f5ccd7e0SThomas Huth  'arm_collie' : 180,
30d4d183afSThomas Huth  'arm_cubieboard' : 360,
31380f7268SThomas Huth  'arm_orangepi' : 540,
32799d6830SThomas Huth  'arm_quanta_gsj' : 240,
33d841f720SThomas Huth  'arm_raspi2' : 120,
34f5ccd7e0SThomas Huth  'arm_tuxrun' : 240,
35bc4d45b2SPeter Maydell  'arm_sx1' : 360,
36270d4a51SThomas Huth  'intel_iommu': 300,
37d841f720SThomas Huth  'mips_malta' : 120,
38350a998dSThomas Huth  'mipsel_replay' : 480,
394c0a2df8SThomas Huth  'netdev_ethtool' : 180,
40407a6883SThomas Huth  'ppc_40p' : 240,
4188c90719SThomas Huth  'ppc64_hv' : 1000,
42f5ccd7e0SThomas Huth  'ppc64_powernv' : 480,
43f5ccd7e0SThomas Huth  'ppc64_pseries' : 480,
44f5ccd7e0SThomas Huth  'ppc64_tuxrun' : 420,
455e654086SCédric Le Goater  'ppc64_mac99' : 120,
46f5ccd7e0SThomas Huth  'riscv64_tuxrun' : 120,
47f5ccd7e0SThomas Huth  's390x_ccw_virtio' : 420,
4873a383dcSThomas Huth  'sh4_tuxrun' : 240,
491456e906SDaniel P. Berrangé  'virtio_balloon': 120,
500a8b4fd5SThomas Huth  'x86_64_kvm_xen' : 180,
5114973778SThomas Huth}
5214973778SThomas Huth
5314973778SThomas Huthtests_generic_system = [
54cce85725SThomas Huth  'empty_cpu_model',
55eeba3d73SThomas Huth  'info_usernet',
56eeba3d73SThomas Huth  'version',
57eeba3d73SThomas Huth]
58eeba3d73SThomas Huth
5914973778SThomas Huthtests_generic_linuxuser = [
6014973778SThomas Huth]
6114973778SThomas Huth
6214973778SThomas Huthtests_generic_bsduser = [
6314973778SThomas Huth]
6414973778SThomas Huth
65092fd648SThomas Huthtests_aarch64_system_quick = [
66092fd648SThomas Huth  'migration',
67092fd648SThomas Huth]
68092fd648SThomas Huth
698f16cd80SPhilippe Mathieu-Daudétests_aarch64_system_thorough = [
70c95309b2SCédric Le Goater  'aarch64_aspeed',
71471f7ff7SPhilippe Mathieu-Daudé  'aarch64_raspi3',
72547738beSPhilippe Mathieu-Daudé  'aarch64_raspi4',
730d77c908SPierrick Bouvier  'aarch64_rme_virt',
740d77c908SPierrick Bouvier  'aarch64_rme_sbsaref',
758f16cd80SPhilippe Mathieu-Daudé  'aarch64_sbsaref',
769acd3884SThomas Huth  'aarch64_sbsaref_alpine',
779acd3884SThomas Huth  'aarch64_sbsaref_freebsd',
78156ee8b8SThomas Huth  'aarch64_tcg_plugins',
7937136902SThomas Huth  'aarch64_tuxrun',
801255f5e4SPhilippe Mathieu-Daudé  'aarch64_virt',
8101466041SThomas Huth  'aarch64_xen',
82490d25e6SThomas Huth  'aarch64_xlnx_versal',
8369e4fbd0SThomas Huth  'multiprocess',
848f16cd80SPhilippe Mathieu-Daudé]
858f16cd80SPhilippe Mathieu-Daudé
86092fd648SThomas Huthtests_alpha_system_quick = [
87092fd648SThomas Huth  'migration',
88092fd648SThomas Huth]
89092fd648SThomas Huth
909a76bc04SThomas Huthtests_alpha_system_thorough = [
919a76bc04SThomas Huth  'alpha_clipper',
929a76bc04SThomas Huth]
939a76bc04SThomas Huth
94092fd648SThomas Huthtests_arm_system_quick = [
95092fd648SThomas Huth  'migration',
96092fd648SThomas Huth]
97092fd648SThomas Huth
98e3fc99b1SThomas Huthtests_arm_system_thorough = [
99e50c7285SCédric Le Goater  'arm_aspeed_ast1030',
100e517cff7SCédric Le Goater  'arm_aspeed_palmetto',
1015f2b9738SCédric Le Goater  'arm_aspeed_romulus',
10208743dbaSCédric Le Goater  'arm_aspeed_ast2500',
103c7bc9cabSCédric Le Goater  'arm_aspeed_ast2600',
10438cd5c52SCédric Le Goater  'arm_aspeed_rainier',
105f7d6b772SThomas Huth  'arm_bpim2u',
106e3fc99b1SThomas Huth  'arm_canona1100',
107aff83583SPeter Maydell  'arm_collie',
108d4d183afSThomas Huth  'arm_cubieboard',
109bade2d51SThomas Huth  'arm_emcraft_sf2',
110ef83aea0SPhilippe Mathieu-Daudé  'arm_integratorcp',
111cb5f6ca8SThomas Huth  'arm_microbit',
112380f7268SThomas Huth  'arm_orangepi',
113799d6830SThomas Huth  'arm_quanta_gsj',
114165ab274SPhilippe Mathieu-Daudé  'arm_raspi2',
11581e2926dSThomas Huth  'arm_smdkc210',
116bc4d45b2SPeter Maydell  'arm_sx1',
117c3cff727SThomas Huth  'arm_vexpress',
118a44b318fSThomas Huth  'arm_virt',
119de9f57a6SThomas Huth  'arm_tuxrun',
120e3fc99b1SThomas Huth]
121e3fc99b1SThomas Huth
12234917eadSPhilippe Mathieu-Daudétests_arm_linuxuser_thorough = [
12334917eadSPhilippe Mathieu-Daudé  'arm_bflt',
12434917eadSPhilippe Mathieu-Daudé]
12534917eadSPhilippe Mathieu-Daudé
1264c0a2df8SThomas Huthtests_avr_system_thorough = [
1274c0a2df8SThomas Huth  'avr_mega2560',
1284c0a2df8SThomas Huth]
1294c0a2df8SThomas Huth
130e4a407d2SPhilippe Mathieu-Daudétests_hppa_system_quick = [
131e4a407d2SPhilippe Mathieu-Daudé  'hppa_seabios',
132e4a407d2SPhilippe Mathieu-Daudé]
133e4a407d2SPhilippe Mathieu-Daudé
134092fd648SThomas Huthtests_i386_system_quick = [
135092fd648SThomas Huth  'migration',
136092fd648SThomas Huth]
137092fd648SThomas Huth
1384007fc94SThomas Huthtests_i386_system_thorough = [
1394007fc94SThomas Huth  'i386_tuxrun',
1404007fc94SThomas Huth]
1414007fc94SThomas Huth
1424c0a2df8SThomas Huthtests_loongarch64_system_thorough = [
1434c0a2df8SThomas Huth  'loongarch64_virt',
1444c0a2df8SThomas Huth]
1454c0a2df8SThomas Huth
146576fffbcSThomas Huthtests_m68k_system_thorough = [
1479f989d65SThomas Huth  'm68k_mcf5208evb',
148c7f3663cSThomas Huth  'm68k_nextcube',
149c7f3663cSThomas Huth  'm68k_q800',
1503356bb83SAlex Bennée  'm68k_tuxrun',
151576fffbcSThomas Huth]
152576fffbcSThomas Huth
153624fb343SThomas Huthtests_microblaze_system_thorough = [
154624fb343SThomas Huth  'microblaze_s3adsp1800'
155624fb343SThomas Huth]
156624fb343SThomas Huth
157624fb343SThomas Huthtests_microblazeel_system_thorough = [
158624fb343SThomas Huth  'microblazeel_s3adsp1800'
159624fb343SThomas Huth]
160624fb343SThomas Huth
16179cb4a14SPhilippe Mathieu-Daudétests_mips_system_thorough = [
16279cb4a14SPhilippe Mathieu-Daudé  'mips_malta',
163f194f0caSThomas Huth  'mips_replay',
16487cab1aeSThomas Huth  'mips_tuxrun',
16579cb4a14SPhilippe Mathieu-Daudé]
16679cb4a14SPhilippe Mathieu-Daudé
167a4b60becSPhilippe Mathieu-Daudétests_mipsel_system_thorough = [
168a4b60becSPhilippe Mathieu-Daudé  'mipsel_malta',
169350a998dSThomas Huth  'mipsel_replay',
17055716a89SThomas Huth  'mipsel_tuxrun',
171a4b60becSPhilippe Mathieu-Daudé]
172a4b60becSPhilippe Mathieu-Daudé
173a01be218SThomas Huthtests_mips64_system_thorough = [
174a01be218SThomas Huth  'mips64_tuxrun',
175a01be218SThomas Huth]
176a01be218SThomas Huth
1774c0a2df8SThomas Huthtests_mips64el_system_thorough = [
1780d2a8acfSThomas Huth  'mips64el_fuloong2e',
1794c0a2df8SThomas Huth  'mips64el_loongson3v',
180fcf2658bSPhilippe Mathieu-Daudé  'mips64el_malta',
181f348229eSThomas Huth  'mips64el_replay',
182a2a2a5b0SThomas Huth  'mips64el_tuxrun',
1834c0a2df8SThomas Huth]
1844c0a2df8SThomas Huth
1850addb05aSThomas Huthtests_or1k_system_thorough = [
1863a07875fSThomas Huth  'or1k_sim',
1873a07875fSThomas Huth]
1883a07875fSThomas Huth
1894c0a2df8SThomas Huthtests_ppc_system_quick = [
190092fd648SThomas Huth  'migration',
1914c0a2df8SThomas Huth  'ppc_74xx',
1924c0a2df8SThomas Huth]
1934c0a2df8SThomas Huth
1944c0a2df8SThomas Huthtests_ppc_system_thorough = [
1954c0a2df8SThomas Huth  'ppc_405',
196407a6883SThomas Huth  'ppc_40p',
197cef1becbSThomas Huth  'ppc_amiga',
198e3fc99b1SThomas Huth  'ppc_bamboo',
19912c0b407SThomas Huth  'ppc_mac',
200407a6883SThomas Huth  'ppc_mpc8544ds',
20155727771SCédric Le Goater  'ppc_sam460ex',
2029ca8239aSThomas Huth  'ppc_tuxrun',
203407a6883SThomas Huth  'ppc_virtex_ml507',
204407a6883SThomas Huth]
205407a6883SThomas Huth
206092fd648SThomas Huthtests_ppc64_system_quick = [
207092fd648SThomas Huth  'migration',
208092fd648SThomas Huth]
209092fd648SThomas Huth
210407a6883SThomas Huthtests_ppc64_system_thorough = [
21153a62fdeSThomas Huth  'ppc64_e500',
21288c90719SThomas Huth  'ppc64_hv',
213407a6883SThomas Huth  'ppc64_powernv',
214407a6883SThomas Huth  'ppc64_pseries',
215e6a401d7SThomas Huth  'ppc64_tuxrun',
2165e654086SCédric Le Goater  'ppc64_mac99',
217e3fc99b1SThomas Huth]
218e3fc99b1SThomas Huth
2196a564c8aSThomas Huthtests_riscv32_system_quick = [
220092fd648SThomas Huth  'migration',
2216a564c8aSThomas Huth  'riscv_opensbi',
222d5674412SThomas Huth]
223d5674412SThomas Huth
22477bc76c7SThomas Huthtests_riscv32_system_thorough = [
22577bc76c7SThomas Huth  'riscv32_tuxrun',
22677bc76c7SThomas Huth]
22777bc76c7SThomas Huth
2286a564c8aSThomas Huthtests_riscv64_system_quick = [
229092fd648SThomas Huth  'migration',
2306a564c8aSThomas Huth  'riscv_opensbi',
2316a564c8aSThomas Huth]
2326a564c8aSThomas Huth
2337746a6c4SThomas Huthtests_riscv64_system_thorough = [
2347746a6c4SThomas Huth  'riscv64_tuxrun',
2357746a6c4SThomas Huth]
2367746a6c4SThomas Huth
2376a564c8aSThomas Huthtests_rx_system_thorough = [
2386a564c8aSThomas Huth  'rx_gdbsim',
2396a564c8aSThomas Huth]
2406a564c8aSThomas Huth
241e2e9fd25SThomas Huthtests_s390x_system_thorough = [
242e2e9fd25SThomas Huth  's390x_ccw_virtio',
243e2e9fd25SThomas Huth  's390x_topology',
244e6a401d7SThomas Huth  's390x_tuxrun',
245e2e9fd25SThomas Huth]
246e2e9fd25SThomas Huth
247a94bfe1bSThomas Huthtests_sh4_system_thorough = [
248a94bfe1bSThomas Huth  'sh4_r2d',
249c592ff35SThomas Huth  'sh4_tuxrun',
250a94bfe1bSThomas Huth]
251a94bfe1bSThomas Huth
25262728ddcSThomas Huthtests_sh4eb_system_thorough = [
25362728ddcSThomas Huth  'sh4eb_r2d',
25462728ddcSThomas Huth]
255c592ff35SThomas Huth
256092fd648SThomas Huthtests_sparc_system_quick = [
257092fd648SThomas Huth  'migration',
258092fd648SThomas Huth]
259092fd648SThomas Huth
260f90527d3SThomas Huthtests_sparc_system_thorough = [
261*a14dfd93SThomas Huth  'sparc_replay',
262f90527d3SThomas Huth  'sparc_sun4m',
263f90527d3SThomas Huth]
264f90527d3SThomas Huth
265092fd648SThomas Huthtests_sparc64_system_quick = [
266092fd648SThomas Huth  'migration',
267092fd648SThomas Huth]
268092fd648SThomas Huth
269e3fc99b1SThomas Huthtests_sparc64_system_thorough = [
270e3fc99b1SThomas Huth  'sparc64_sun4u',
271116667aaSThomas Huth  'sparc64_tuxrun',
2724c0a2df8SThomas Huth]
2734c0a2df8SThomas Huth
27414973778SThomas Huthtests_x86_64_system_quick = [
275cce85725SThomas Huth  'cpu_queries',
276cce85725SThomas Huth  'mem_addr_space',
277092fd648SThomas Huth  'migration',
278cce85725SThomas Huth  'pc_cpu_hotplug_props',
279cce85725SThomas Huth  'virtio_version',
280be849ef7SThomas Huth  'x86_cpu_model_versions',
281c82bfaf4SThomas Huth  'vnc',
28214973778SThomas Huth]
28314973778SThomas Huth
28414973778SThomas Huthtests_x86_64_system_thorough = [
28505caa062SThomas Huth  'acpi_bits',
286270d4a51SThomas Huth  'intel_iommu',
2878dcac1cfSThomas Huth  'linux_initrd',
28869e4fbd0SThomas Huth  'multiprocess',
2894c0a2df8SThomas Huth  'netdev_ethtool',
2901456e906SDaniel P. Berrangé  'virtio_balloon',
291239d08aaSThomas Huth  'virtio_gpu',
2925f6a260fSThomas Huth  'x86_64_hotplug_blk',
293bf850896SThomas Huth  'x86_64_hotplug_cpu',
2940a8b4fd5SThomas Huth  'x86_64_kvm_xen',
295270d4a51SThomas Huth  'x86_64_tuxrun',
29614973778SThomas Huth]
29714973778SThomas Huth
298d1939097SThomas Huthtests_xtensa_system_thorough = [
299d1939097SThomas Huth  'xtensa_lx60',
3006e52e84dSThomas Huth  'xtensa_replay',
301d1939097SThomas Huth]
302d1939097SThomas Huth
303f57213f8SDaniel P. Berrangéprecache_all = []
30414973778SThomas Huthforeach speed : ['quick', 'thorough']
30514973778SThomas Huth  foreach dir : target_dirs
30614973778SThomas Huth
30714973778SThomas Huth    target_base = dir.split('-')[0]
30814973778SThomas Huth
30914973778SThomas Huth    if dir.endswith('-softmmu')
31014973778SThomas Huth      sysmode = 'system'
31114973778SThomas Huth      test_emulator = emulators['qemu-system-' + target_base]
31214973778SThomas Huth    elif dir.endswith('-linux-user')
31314973778SThomas Huth      sysmode = 'linuxuser'
31414973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
31514973778SThomas Huth    elif dir.endswith('-bsd-user')
31614973778SThomas Huth      sysmode = 'bsduser'
31714973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
31814973778SThomas Huth    else
31914973778SThomas Huth      continue
32014973778SThomas Huth    endif
32114973778SThomas Huth
32214973778SThomas Huth    if speed == 'quick'
32314973778SThomas Huth      suites = ['func-quick', 'func-' + target_base]
32414973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
32514973778SThomas Huth                     + get_variable('tests_generic_' + sysmode)
32614973778SThomas Huth    else
32714973778SThomas Huth      suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
32814973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
32914973778SThomas Huth    endif
33014973778SThomas Huth
33114973778SThomas Huth    test_deps = roms
33214973778SThomas Huth    test_env = environment()
33314973778SThomas Huth    if have_tools
33414973778SThomas Huth      test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
33514973778SThomas Huth      test_deps += [qemu_img]
33614973778SThomas Huth    endif
33714973778SThomas Huth    test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
33814973778SThomas Huth    test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
33914973778SThomas Huth    test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
34014973778SThomas Huth                               meson.current_source_dir())
34114973778SThomas Huth
34214973778SThomas Huth    foreach test : target_tests
343f57213f8SDaniel P. Berrangé      testname = '@0@-@1@'.format(target_base, test)
344f57213f8SDaniel P. Berrangé      testfile = 'test_' + test + '.py'
345f57213f8SDaniel P. Berrangé      testpath = meson.current_source_dir() / testfile
346f57213f8SDaniel P. Berrangé      teststamp = testname + '.tstamp'
347f57213f8SDaniel P. Berrangé      test_precache_env = environment()
348f57213f8SDaniel P. Berrangé      test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
349f57213f8SDaniel P. Berrangé      test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
350f57213f8SDaniel P. Berrangé                                          meson.current_source_dir())
351f57213f8SDaniel P. Berrangé      precache = custom_target('func-precache-' + testname,
352f57213f8SDaniel P. Berrangé                               output: teststamp,
353f57213f8SDaniel P. Berrangé                               command: [python, testpath],
354f57213f8SDaniel P. Berrangé                               depend_files: files(testpath),
355f57213f8SDaniel P. Berrangé                               build_by_default: false,
356f57213f8SDaniel P. Berrangé                               env: test_precache_env)
357f57213f8SDaniel P. Berrangé      precache_all += precache
358f57213f8SDaniel P. Berrangé
359f57213f8SDaniel P. Berrangé      # Ideally we would add 'precache' to 'depends' here, such that
360f57213f8SDaniel P. Berrangé      # 'build_by_default: false' lets the pre-caching automatically
361f57213f8SDaniel P. Berrangé      # run immediately before the test runs. In practice this is
362f57213f8SDaniel P. Berrangé      # broken in meson, with it running the pre-caching in the normal
363f57213f8SDaniel P. Berrangé      # compile phase https://github.com/mesonbuild/meson/issues/2518
364f57213f8SDaniel P. Berrangé      # If the above bug ever gets fixed, when QEMU changes the min
365f57213f8SDaniel P. Berrangé      # meson version, add the 'depends' and remove the custom
366f57213f8SDaniel P. Berrangé      # 'run_target' logic below & in Makefile.include
367f57213f8SDaniel P. Berrangé      test('func-' + testname,
36814973778SThomas Huth           python,
36914973778SThomas Huth           depends: [test_deps, test_emulator, emulator_modules],
37014973778SThomas Huth           env: test_env,
371f57213f8SDaniel P. Berrangé           args: [testpath],
37214973778SThomas Huth           protocol: 'tap',
373f5ccd7e0SThomas Huth           timeout: test_timeouts.get(test, 90),
374f5ccd7e0SThomas Huth           priority: test_timeouts.get(test, 90),
37514973778SThomas Huth           suite: suites)
37614973778SThomas Huth    endforeach
37714973778SThomas Huth  endforeach
37814973778SThomas Huthendforeach
379f57213f8SDaniel P. Berrangé
380f57213f8SDaniel P. Berrangérun_target('precache-functional',
381f57213f8SDaniel P. Berrangé           depends: precache_all,
382f57213f8SDaniel P. Berrangé           command: ['true'])
383