xref: /qemu/tests/functional/meson.build (revision 490d25e6c52b0c32f78b5176d64cf20a53fde51a)
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,
169acd3884SThomas Huth  'aarch64_sbsaref_alpine' : 720,
179acd3884SThomas Huth  'aarch64_sbsaref_freebsd' : 720,
1837136902SThomas Huth  'aarch64_tuxrun' : 240,
19f5ccd7e0SThomas Huth  'aarch64_virt' : 720,
20f5ccd7e0SThomas Huth  'acpi_bits' : 420,
21f04cb2d0SCédric Le Goater  'arm_aspeed' : 600,
22f5ccd7e0SThomas Huth  'arm_bpim2u' : 500,
23f5ccd7e0SThomas Huth  'arm_collie' : 180,
24380f7268SThomas Huth  'arm_orangepi' : 540,
25d841f720SThomas Huth  'arm_raspi2' : 120,
26f5ccd7e0SThomas Huth  'arm_tuxrun' : 240,
27bc4d45b2SPeter Maydell  'arm_sx1' : 360,
28d841f720SThomas Huth  'mips_malta' : 120,
294c0a2df8SThomas Huth  'netdev_ethtool' : 180,
30407a6883SThomas Huth  'ppc_40p' : 240,
3188c90719SThomas Huth  'ppc64_hv' : 1000,
32f5ccd7e0SThomas Huth  'ppc64_powernv' : 480,
33f5ccd7e0SThomas Huth  'ppc64_pseries' : 480,
34f5ccd7e0SThomas Huth  'ppc64_tuxrun' : 420,
35f5ccd7e0SThomas Huth  'riscv64_tuxrun' : 120,
36f5ccd7e0SThomas Huth  's390x_ccw_virtio' : 420,
3773a383dcSThomas Huth  'sh4_tuxrun' : 240,
3814973778SThomas Huth}
3914973778SThomas Huth
4014973778SThomas Huthtests_generic_system = [
41cce85725SThomas Huth  'empty_cpu_model',
42eeba3d73SThomas Huth  'info_usernet',
43eeba3d73SThomas Huth  'version',
44eeba3d73SThomas Huth]
45eeba3d73SThomas Huth
4614973778SThomas Huthtests_generic_linuxuser = [
4714973778SThomas Huth]
4814973778SThomas Huth
4914973778SThomas Huthtests_generic_bsduser = [
5014973778SThomas Huth]
5114973778SThomas Huth
528f16cd80SPhilippe Mathieu-Daudétests_aarch64_system_thorough = [
53c95309b2SCédric Le Goater  'aarch64_aspeed',
54471f7ff7SPhilippe Mathieu-Daudé  'aarch64_raspi3',
55547738beSPhilippe Mathieu-Daudé  'aarch64_raspi4',
568f16cd80SPhilippe Mathieu-Daudé  'aarch64_sbsaref',
579acd3884SThomas Huth  'aarch64_sbsaref_alpine',
589acd3884SThomas Huth  'aarch64_sbsaref_freebsd',
5937136902SThomas Huth  'aarch64_tuxrun',
601255f5e4SPhilippe Mathieu-Daudé  'aarch64_virt',
61*490d25e6SThomas Huth  'aarch64_xlnx_versal',
6269e4fbd0SThomas Huth  'multiprocess',
638f16cd80SPhilippe Mathieu-Daudé]
648f16cd80SPhilippe Mathieu-Daudé
659a76bc04SThomas Huthtests_alpha_system_thorough = [
669a76bc04SThomas Huth  'alpha_clipper',
679a76bc04SThomas Huth]
689a76bc04SThomas Huth
69e3fc99b1SThomas Huthtests_arm_system_thorough = [
70f04cb2d0SCédric Le Goater  'arm_aspeed',
71f7d6b772SThomas Huth  'arm_bpim2u',
72e3fc99b1SThomas Huth  'arm_canona1100',
73aff83583SPeter Maydell  'arm_collie',
74ef83aea0SPhilippe Mathieu-Daudé  'arm_integratorcp',
75380f7268SThomas Huth  'arm_orangepi',
76165ab274SPhilippe Mathieu-Daudé  'arm_raspi2',
77bc4d45b2SPeter Maydell  'arm_sx1',
78c3cff727SThomas Huth  'arm_vexpress',
79de9f57a6SThomas Huth  'arm_tuxrun',
80e3fc99b1SThomas Huth]
81e3fc99b1SThomas Huth
8234917eadSPhilippe Mathieu-Daudétests_arm_linuxuser_thorough = [
8334917eadSPhilippe Mathieu-Daudé  'arm_bflt',
8434917eadSPhilippe Mathieu-Daudé]
8534917eadSPhilippe Mathieu-Daudé
864c0a2df8SThomas Huthtests_avr_system_thorough = [
874c0a2df8SThomas Huth  'avr_mega2560',
884c0a2df8SThomas Huth]
894c0a2df8SThomas Huth
904007fc94SThomas Huthtests_i386_system_thorough = [
914007fc94SThomas Huth  'i386_tuxrun',
924007fc94SThomas Huth]
934007fc94SThomas Huth
944c0a2df8SThomas Huthtests_loongarch64_system_thorough = [
954c0a2df8SThomas Huth  'loongarch64_virt',
964c0a2df8SThomas Huth]
974c0a2df8SThomas Huth
98576fffbcSThomas Huthtests_m68k_system_thorough = [
999f989d65SThomas Huth  'm68k_mcf5208evb',
100c7f3663cSThomas Huth  'm68k_nextcube',
101c7f3663cSThomas Huth  'm68k_q800',
102576fffbcSThomas Huth]
103576fffbcSThomas Huth
104624fb343SThomas Huthtests_microblaze_system_thorough = [
105624fb343SThomas Huth  'microblaze_s3adsp1800'
106624fb343SThomas Huth]
107624fb343SThomas Huth
108624fb343SThomas Huthtests_microblazeel_system_thorough = [
109624fb343SThomas Huth  'microblazeel_s3adsp1800'
110624fb343SThomas Huth]
111624fb343SThomas Huth
11279cb4a14SPhilippe Mathieu-Daudétests_mips_system_thorough = [
11379cb4a14SPhilippe Mathieu-Daudé  'mips_malta',
11487cab1aeSThomas Huth  'mips_tuxrun',
11579cb4a14SPhilippe Mathieu-Daudé]
11679cb4a14SPhilippe Mathieu-Daudé
117a4b60becSPhilippe Mathieu-Daudétests_mipsel_system_thorough = [
118a4b60becSPhilippe Mathieu-Daudé  'mipsel_malta',
11955716a89SThomas Huth  'mipsel_tuxrun',
120a4b60becSPhilippe Mathieu-Daudé]
121a4b60becSPhilippe Mathieu-Daudé
122a01be218SThomas Huthtests_mips64_system_thorough = [
123a01be218SThomas Huth  'mips64_tuxrun',
124a01be218SThomas Huth]
125a01be218SThomas Huth
1264c0a2df8SThomas Huthtests_mips64el_system_thorough = [
1270d2a8acfSThomas Huth  'mips64el_fuloong2e',
1284c0a2df8SThomas Huth  'mips64el_loongson3v',
129fcf2658bSPhilippe Mathieu-Daudé  'mips64el_malta',
130a2a2a5b0SThomas Huth  'mips64el_tuxrun',
1314c0a2df8SThomas Huth]
1324c0a2df8SThomas Huth
1330addb05aSThomas Huthtests_or1k_system_thorough = [
1343a07875fSThomas Huth  'or1k_sim',
1353a07875fSThomas Huth]
1363a07875fSThomas Huth
1374c0a2df8SThomas Huthtests_ppc_system_quick = [
1384c0a2df8SThomas Huth  'ppc_74xx',
1394c0a2df8SThomas Huth]
1404c0a2df8SThomas Huth
1414c0a2df8SThomas Huthtests_ppc_system_thorough = [
1424c0a2df8SThomas Huth  'ppc_405',
143407a6883SThomas Huth  'ppc_40p',
144cef1becbSThomas Huth  'ppc_amiga',
145e3fc99b1SThomas Huth  'ppc_bamboo',
14612c0b407SThomas Huth  'ppc_mac',
147407a6883SThomas Huth  'ppc_mpc8544ds',
1489ca8239aSThomas Huth  'ppc_tuxrun',
149407a6883SThomas Huth  'ppc_virtex_ml507',
150407a6883SThomas Huth]
151407a6883SThomas Huth
152407a6883SThomas Huthtests_ppc64_system_thorough = [
15353a62fdeSThomas Huth  'ppc64_e500',
15488c90719SThomas Huth  'ppc64_hv',
155407a6883SThomas Huth  'ppc64_powernv',
156407a6883SThomas Huth  'ppc64_pseries',
157e6a401d7SThomas Huth  'ppc64_tuxrun',
158e3fc99b1SThomas Huth]
159e3fc99b1SThomas Huth
1606a564c8aSThomas Huthtests_riscv32_system_quick = [
1616a564c8aSThomas Huth  'riscv_opensbi',
162d5674412SThomas Huth]
163d5674412SThomas Huth
16477bc76c7SThomas Huthtests_riscv32_system_thorough = [
16577bc76c7SThomas Huth  'riscv32_tuxrun',
16677bc76c7SThomas Huth]
16777bc76c7SThomas Huth
1686a564c8aSThomas Huthtests_riscv64_system_quick = [
1696a564c8aSThomas Huth  'riscv_opensbi',
1706a564c8aSThomas Huth]
1716a564c8aSThomas Huth
1727746a6c4SThomas Huthtests_riscv64_system_thorough = [
1737746a6c4SThomas Huth  'riscv64_tuxrun',
1747746a6c4SThomas Huth]
1757746a6c4SThomas Huth
1766a564c8aSThomas Huthtests_rx_system_thorough = [
1776a564c8aSThomas Huth  'rx_gdbsim',
1786a564c8aSThomas Huth]
1796a564c8aSThomas Huth
180e2e9fd25SThomas Huthtests_s390x_system_thorough = [
181e2e9fd25SThomas Huth  's390x_ccw_virtio',
182e2e9fd25SThomas Huth  's390x_topology',
183e6a401d7SThomas Huth  's390x_tuxrun',
184e2e9fd25SThomas Huth]
185e2e9fd25SThomas Huth
186a94bfe1bSThomas Huthtests_sh4_system_thorough = [
187a94bfe1bSThomas Huth  'sh4_r2d',
188c592ff35SThomas Huth  'sh4_tuxrun',
189a94bfe1bSThomas Huth]
190a94bfe1bSThomas Huth
19162728ddcSThomas Huthtests_sh4eb_system_thorough = [
19262728ddcSThomas Huth  'sh4eb_r2d',
19362728ddcSThomas Huth]
194c592ff35SThomas Huth
195f90527d3SThomas Huthtests_sparc_system_thorough = [
196f90527d3SThomas Huth  'sparc_sun4m',
197f90527d3SThomas Huth]
198f90527d3SThomas Huth
199e3fc99b1SThomas Huthtests_sparc64_system_thorough = [
200e3fc99b1SThomas Huth  'sparc64_sun4u',
201116667aaSThomas Huth  'sparc64_tuxrun',
2024c0a2df8SThomas Huth]
2034c0a2df8SThomas Huth
20414973778SThomas Huthtests_x86_64_system_quick = [
205cce85725SThomas Huth  'cpu_queries',
206cce85725SThomas Huth  'mem_addr_space',
207cce85725SThomas Huth  'pc_cpu_hotplug_props',
208cce85725SThomas Huth  'virtio_version',
209be849ef7SThomas Huth  'x86_cpu_model_versions',
21014973778SThomas Huth]
21114973778SThomas Huth
21214973778SThomas Huthtests_x86_64_system_thorough = [
21305caa062SThomas Huth  'acpi_bits',
2147cea8fe3SThomas Huth  'x86_64_tuxrun',
2158dcac1cfSThomas Huth  'linux_initrd',
21669e4fbd0SThomas Huth  'multiprocess',
2174c0a2df8SThomas Huth  'netdev_ethtool',
218239d08aaSThomas Huth  'virtio_gpu',
21914973778SThomas Huth]
22014973778SThomas Huth
221d1939097SThomas Huthtests_xtensa_system_thorough = [
222d1939097SThomas Huth  'xtensa_lx60',
223d1939097SThomas Huth]
224d1939097SThomas Huth
225f57213f8SDaniel P. Berrangéprecache_all = []
22614973778SThomas Huthforeach speed : ['quick', 'thorough']
22714973778SThomas Huth  foreach dir : target_dirs
22814973778SThomas Huth
22914973778SThomas Huth    target_base = dir.split('-')[0]
23014973778SThomas Huth
23114973778SThomas Huth    if dir.endswith('-softmmu')
23214973778SThomas Huth      sysmode = 'system'
23314973778SThomas Huth      test_emulator = emulators['qemu-system-' + target_base]
23414973778SThomas Huth    elif dir.endswith('-linux-user')
23514973778SThomas Huth      sysmode = 'linuxuser'
23614973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
23714973778SThomas Huth    elif dir.endswith('-bsd-user')
23814973778SThomas Huth      sysmode = 'bsduser'
23914973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
24014973778SThomas Huth    else
24114973778SThomas Huth      continue
24214973778SThomas Huth    endif
24314973778SThomas Huth
24414973778SThomas Huth    if speed == 'quick'
24514973778SThomas Huth      suites = ['func-quick', 'func-' + target_base]
24614973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
24714973778SThomas Huth                     + get_variable('tests_generic_' + sysmode)
24814973778SThomas Huth    else
24914973778SThomas Huth      suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
25014973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
25114973778SThomas Huth    endif
25214973778SThomas Huth
25314973778SThomas Huth    test_deps = roms
25414973778SThomas Huth    test_env = environment()
25514973778SThomas Huth    if have_tools
25614973778SThomas Huth      test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
25714973778SThomas Huth      test_deps += [qemu_img]
25814973778SThomas Huth    endif
25914973778SThomas Huth    test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
26014973778SThomas Huth    test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
26114973778SThomas Huth    test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
26214973778SThomas Huth                               meson.current_source_dir())
26314973778SThomas Huth
26414973778SThomas Huth    foreach test : target_tests
265f57213f8SDaniel P. Berrangé      testname = '@0@-@1@'.format(target_base, test)
266f57213f8SDaniel P. Berrangé      testfile = 'test_' + test + '.py'
267f57213f8SDaniel P. Berrangé      testpath = meson.current_source_dir() / testfile
268f57213f8SDaniel P. Berrangé      teststamp = testname + '.tstamp'
269f57213f8SDaniel P. Berrangé      test_precache_env = environment()
270f57213f8SDaniel P. Berrangé      test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
271f57213f8SDaniel P. Berrangé      test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
272f57213f8SDaniel P. Berrangé                                          meson.current_source_dir())
273f57213f8SDaniel P. Berrangé      precache = custom_target('func-precache-' + testname,
274f57213f8SDaniel P. Berrangé                               output: teststamp,
275f57213f8SDaniel P. Berrangé                               command: [python, testpath],
276f57213f8SDaniel P. Berrangé                               depend_files: files(testpath),
277f57213f8SDaniel P. Berrangé                               build_by_default: false,
278f57213f8SDaniel P. Berrangé                               env: test_precache_env)
279f57213f8SDaniel P. Berrangé      precache_all += precache
280f57213f8SDaniel P. Berrangé
281f57213f8SDaniel P. Berrangé      # Ideally we would add 'precache' to 'depends' here, such that
282f57213f8SDaniel P. Berrangé      # 'build_by_default: false' lets the pre-caching automatically
283f57213f8SDaniel P. Berrangé      # run immediately before the test runs. In practice this is
284f57213f8SDaniel P. Berrangé      # broken in meson, with it running the pre-caching in the normal
285f57213f8SDaniel P. Berrangé      # compile phase https://github.com/mesonbuild/meson/issues/2518
286f57213f8SDaniel P. Berrangé      # If the above bug ever gets fixed, when QEMU changes the min
287f57213f8SDaniel P. Berrangé      # meson version, add the 'depends' and remove the custom
288f57213f8SDaniel P. Berrangé      # 'run_target' logic below & in Makefile.include
289f57213f8SDaniel P. Berrangé      test('func-' + testname,
29014973778SThomas Huth           python,
29114973778SThomas Huth           depends: [test_deps, test_emulator, emulator_modules],
29214973778SThomas Huth           env: test_env,
293f57213f8SDaniel P. Berrangé           args: [testpath],
29414973778SThomas Huth           protocol: 'tap',
295f5ccd7e0SThomas Huth           timeout: test_timeouts.get(test, 90),
296f5ccd7e0SThomas Huth           priority: test_timeouts.get(test, 90),
29714973778SThomas Huth           suite: suites)
29814973778SThomas Huth    endforeach
29914973778SThomas Huth  endforeach
30014973778SThomas Huthendforeach
301f57213f8SDaniel P. Berrangé
302f57213f8SDaniel P. Berrangérun_target('precache-functional',
303f57213f8SDaniel P. Berrangé           depends: precache_all,
304f57213f8SDaniel P. Berrangé           command: ['true'])
305