xref: /qemu/tests/functional/meson.build (revision 5f2b9738b281894d3fdc0affbdcada2f8c0cc19e)
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,
21e517cff7SCédric Le Goater  'arm_aspeed_palmetto' : 120,
22*5f2b9738SCédric Le Goater  'arm_aspeed_romulus' : 120,
23f04cb2d0SCédric Le Goater  'arm_aspeed' : 600,
24f5ccd7e0SThomas Huth  'arm_bpim2u' : 500,
25f5ccd7e0SThomas Huth  'arm_collie' : 180,
26380f7268SThomas Huth  'arm_orangepi' : 540,
27d841f720SThomas Huth  'arm_raspi2' : 120,
28f5ccd7e0SThomas Huth  'arm_tuxrun' : 240,
29bc4d45b2SPeter Maydell  'arm_sx1' : 360,
30d841f720SThomas Huth  'mips_malta' : 120,
314c0a2df8SThomas Huth  'netdev_ethtool' : 180,
32407a6883SThomas Huth  'ppc_40p' : 240,
3388c90719SThomas Huth  'ppc64_hv' : 1000,
34f5ccd7e0SThomas Huth  'ppc64_powernv' : 480,
35f5ccd7e0SThomas Huth  'ppc64_pseries' : 480,
36f5ccd7e0SThomas Huth  'ppc64_tuxrun' : 420,
37f5ccd7e0SThomas Huth  'riscv64_tuxrun' : 120,
38f5ccd7e0SThomas Huth  's390x_ccw_virtio' : 420,
3914973778SThomas Huth}
4014973778SThomas Huth
4114973778SThomas Huthtests_generic_system = [
42cce85725SThomas Huth  'empty_cpu_model',
43eeba3d73SThomas Huth  'info_usernet',
44eeba3d73SThomas Huth  'version',
45eeba3d73SThomas Huth]
46eeba3d73SThomas Huth
4714973778SThomas Huthtests_generic_linuxuser = [
4814973778SThomas Huth]
4914973778SThomas Huth
5014973778SThomas Huthtests_generic_bsduser = [
5114973778SThomas Huth]
5214973778SThomas Huth
538f16cd80SPhilippe Mathieu-Daudétests_aarch64_system_thorough = [
54c95309b2SCédric Le Goater  'aarch64_aspeed',
55471f7ff7SPhilippe Mathieu-Daudé  'aarch64_raspi3',
56547738beSPhilippe Mathieu-Daudé  'aarch64_raspi4',
578f16cd80SPhilippe Mathieu-Daudé  'aarch64_sbsaref',
589acd3884SThomas Huth  'aarch64_sbsaref_alpine',
599acd3884SThomas Huth  'aarch64_sbsaref_freebsd',
6037136902SThomas Huth  'aarch64_tuxrun',
611255f5e4SPhilippe Mathieu-Daudé  'aarch64_virt',
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',
71e50c7285SCédric Le Goater  'arm_aspeed_ast1030',
72e517cff7SCédric Le Goater  'arm_aspeed_palmetto',
73*5f2b9738SCédric Le Goater  'arm_aspeed_romulus',
74f7d6b772SThomas Huth  'arm_bpim2u',
75e3fc99b1SThomas Huth  'arm_canona1100',
76aff83583SPeter Maydell  'arm_collie',
77ef83aea0SPhilippe Mathieu-Daudé  'arm_integratorcp',
78380f7268SThomas Huth  'arm_orangepi',
79165ab274SPhilippe Mathieu-Daudé  'arm_raspi2',
80bc4d45b2SPeter Maydell  'arm_sx1',
81c3cff727SThomas Huth  'arm_vexpress',
82de9f57a6SThomas Huth  'arm_tuxrun',
83e3fc99b1SThomas Huth]
84e3fc99b1SThomas Huth
8534917eadSPhilippe Mathieu-Daudétests_arm_linuxuser_thorough = [
8634917eadSPhilippe Mathieu-Daudé  'arm_bflt',
8734917eadSPhilippe Mathieu-Daudé]
8834917eadSPhilippe Mathieu-Daudé
894c0a2df8SThomas Huthtests_avr_system_thorough = [
904c0a2df8SThomas Huth  'avr_mega2560',
914c0a2df8SThomas Huth]
924c0a2df8SThomas Huth
934007fc94SThomas Huthtests_i386_system_thorough = [
944007fc94SThomas Huth  'i386_tuxrun',
954007fc94SThomas Huth]
964007fc94SThomas Huth
974c0a2df8SThomas Huthtests_loongarch64_system_thorough = [
984c0a2df8SThomas Huth  'loongarch64_virt',
994c0a2df8SThomas Huth]
1004c0a2df8SThomas Huth
101576fffbcSThomas Huthtests_m68k_system_thorough = [
1029f989d65SThomas Huth  'm68k_mcf5208evb',
103c7f3663cSThomas Huth  'm68k_nextcube',
104c7f3663cSThomas Huth  'm68k_q800',
105576fffbcSThomas Huth]
106576fffbcSThomas Huth
107624fb343SThomas Huthtests_microblaze_system_thorough = [
108624fb343SThomas Huth  'microblaze_s3adsp1800'
109624fb343SThomas Huth]
110624fb343SThomas Huth
111624fb343SThomas Huthtests_microblazeel_system_thorough = [
112624fb343SThomas Huth  'microblazeel_s3adsp1800'
113624fb343SThomas Huth]
114624fb343SThomas Huth
11579cb4a14SPhilippe Mathieu-Daudétests_mips_system_thorough = [
11679cb4a14SPhilippe Mathieu-Daudé  'mips_malta',
11787cab1aeSThomas Huth  'mips_tuxrun',
11879cb4a14SPhilippe Mathieu-Daudé]
11979cb4a14SPhilippe Mathieu-Daudé
120a4b60becSPhilippe Mathieu-Daudétests_mipsel_system_thorough = [
121a4b60becSPhilippe Mathieu-Daudé  'mipsel_malta',
12255716a89SThomas Huth  'mipsel_tuxrun',
123a4b60becSPhilippe Mathieu-Daudé]
124a4b60becSPhilippe Mathieu-Daudé
125a01be218SThomas Huthtests_mips64_system_thorough = [
126a01be218SThomas Huth  'mips64_tuxrun',
127a01be218SThomas Huth]
128a01be218SThomas Huth
1294c0a2df8SThomas Huthtests_mips64el_system_thorough = [
1300d2a8acfSThomas Huth  'mips64el_fuloong2e',
1314c0a2df8SThomas Huth  'mips64el_loongson3v',
132fcf2658bSPhilippe Mathieu-Daudé  'mips64el_malta',
133a2a2a5b0SThomas Huth  'mips64el_tuxrun',
1344c0a2df8SThomas Huth]
1354c0a2df8SThomas Huth
1360addb05aSThomas Huthtests_or1k_system_thorough = [
1373a07875fSThomas Huth  'or1k_sim',
1383a07875fSThomas Huth]
1393a07875fSThomas Huth
1404c0a2df8SThomas Huthtests_ppc_system_quick = [
1414c0a2df8SThomas Huth  'ppc_74xx',
1424c0a2df8SThomas Huth]
1434c0a2df8SThomas Huth
1444c0a2df8SThomas Huthtests_ppc_system_thorough = [
1454c0a2df8SThomas Huth  'ppc_405',
146407a6883SThomas Huth  'ppc_40p',
147cef1becbSThomas Huth  'ppc_amiga',
148e3fc99b1SThomas Huth  'ppc_bamboo',
14912c0b407SThomas Huth  'ppc_mac',
150407a6883SThomas Huth  'ppc_mpc8544ds',
1519ca8239aSThomas Huth  'ppc_tuxrun',
152407a6883SThomas Huth  'ppc_virtex_ml507',
153407a6883SThomas Huth]
154407a6883SThomas Huth
155407a6883SThomas Huthtests_ppc64_system_thorough = [
15653a62fdeSThomas Huth  'ppc64_e500',
15788c90719SThomas Huth  'ppc64_hv',
158407a6883SThomas Huth  'ppc64_powernv',
159407a6883SThomas Huth  'ppc64_pseries',
160e6a401d7SThomas Huth  'ppc64_tuxrun',
161e3fc99b1SThomas Huth]
162e3fc99b1SThomas Huth
1636a564c8aSThomas Huthtests_riscv32_system_quick = [
1646a564c8aSThomas Huth  'riscv_opensbi',
165d5674412SThomas Huth]
166d5674412SThomas Huth
16777bc76c7SThomas Huthtests_riscv32_system_thorough = [
16877bc76c7SThomas Huth  'riscv32_tuxrun',
16977bc76c7SThomas Huth]
17077bc76c7SThomas Huth
1716a564c8aSThomas Huthtests_riscv64_system_quick = [
1726a564c8aSThomas Huth  'riscv_opensbi',
1736a564c8aSThomas Huth]
1746a564c8aSThomas Huth
1757746a6c4SThomas Huthtests_riscv64_system_thorough = [
1767746a6c4SThomas Huth  'riscv64_tuxrun',
1777746a6c4SThomas Huth]
1787746a6c4SThomas Huth
1796a564c8aSThomas Huthtests_rx_system_thorough = [
1806a564c8aSThomas Huth  'rx_gdbsim',
1816a564c8aSThomas Huth]
1826a564c8aSThomas Huth
183e2e9fd25SThomas Huthtests_s390x_system_thorough = [
184e2e9fd25SThomas Huth  's390x_ccw_virtio',
185e2e9fd25SThomas Huth  's390x_topology',
186e6a401d7SThomas Huth  's390x_tuxrun',
187e2e9fd25SThomas Huth]
188e2e9fd25SThomas Huth
189a94bfe1bSThomas Huthtests_sh4_system_thorough = [
190a94bfe1bSThomas Huth  'sh4_r2d',
191c592ff35SThomas Huth  'sh4_tuxrun',
192a94bfe1bSThomas Huth]
193a94bfe1bSThomas Huth
19462728ddcSThomas Huthtests_sh4eb_system_thorough = [
19562728ddcSThomas Huth  'sh4eb_r2d',
19662728ddcSThomas Huth]
197c592ff35SThomas Huth
198f90527d3SThomas Huthtests_sparc_system_thorough = [
199f90527d3SThomas Huth  'sparc_sun4m',
200f90527d3SThomas Huth]
201f90527d3SThomas Huth
202e3fc99b1SThomas Huthtests_sparc64_system_thorough = [
203e3fc99b1SThomas Huth  'sparc64_sun4u',
204116667aaSThomas Huth  'sparc64_tuxrun',
2054c0a2df8SThomas Huth]
2064c0a2df8SThomas Huth
20714973778SThomas Huthtests_x86_64_system_quick = [
208cce85725SThomas Huth  'cpu_queries',
209cce85725SThomas Huth  'mem_addr_space',
210cce85725SThomas Huth  'pc_cpu_hotplug_props',
211cce85725SThomas Huth  'virtio_version',
212be849ef7SThomas Huth  'x86_cpu_model_versions',
21314973778SThomas Huth]
21414973778SThomas Huth
21514973778SThomas Huthtests_x86_64_system_thorough = [
21605caa062SThomas Huth  'acpi_bits',
2177cea8fe3SThomas Huth  'x86_64_tuxrun',
2188dcac1cfSThomas Huth  'linux_initrd',
21969e4fbd0SThomas Huth  'multiprocess',
2204c0a2df8SThomas Huth  'netdev_ethtool',
221239d08aaSThomas Huth  'virtio_gpu',
22214973778SThomas Huth]
22314973778SThomas Huth
224d1939097SThomas Huthtests_xtensa_system_thorough = [
225d1939097SThomas Huth  'xtensa_lx60',
226d1939097SThomas Huth]
227d1939097SThomas Huth
228f57213f8SDaniel P. Berrangéprecache_all = []
22914973778SThomas Huthforeach speed : ['quick', 'thorough']
23014973778SThomas Huth  foreach dir : target_dirs
23114973778SThomas Huth
23214973778SThomas Huth    target_base = dir.split('-')[0]
23314973778SThomas Huth
23414973778SThomas Huth    if dir.endswith('-softmmu')
23514973778SThomas Huth      sysmode = 'system'
23614973778SThomas Huth      test_emulator = emulators['qemu-system-' + target_base]
23714973778SThomas Huth    elif dir.endswith('-linux-user')
23814973778SThomas Huth      sysmode = 'linuxuser'
23914973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
24014973778SThomas Huth    elif dir.endswith('-bsd-user')
24114973778SThomas Huth      sysmode = 'bsduser'
24214973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
24314973778SThomas Huth    else
24414973778SThomas Huth      continue
24514973778SThomas Huth    endif
24614973778SThomas Huth
24714973778SThomas Huth    if speed == 'quick'
24814973778SThomas Huth      suites = ['func-quick', 'func-' + target_base]
24914973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
25014973778SThomas Huth                     + get_variable('tests_generic_' + sysmode)
25114973778SThomas Huth    else
25214973778SThomas Huth      suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
25314973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
25414973778SThomas Huth    endif
25514973778SThomas Huth
25614973778SThomas Huth    test_deps = roms
25714973778SThomas Huth    test_env = environment()
25814973778SThomas Huth    if have_tools
25914973778SThomas Huth      test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
26014973778SThomas Huth      test_deps += [qemu_img]
26114973778SThomas Huth    endif
26214973778SThomas Huth    test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
26314973778SThomas Huth    test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
26414973778SThomas Huth    test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
26514973778SThomas Huth                               meson.current_source_dir())
26614973778SThomas Huth
26714973778SThomas Huth    foreach test : target_tests
268f57213f8SDaniel P. Berrangé      testname = '@0@-@1@'.format(target_base, test)
269f57213f8SDaniel P. Berrangé      testfile = 'test_' + test + '.py'
270f57213f8SDaniel P. Berrangé      testpath = meson.current_source_dir() / testfile
271f57213f8SDaniel P. Berrangé      teststamp = testname + '.tstamp'
272f57213f8SDaniel P. Berrangé      test_precache_env = environment()
273f57213f8SDaniel P. Berrangé      test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
274f57213f8SDaniel P. Berrangé      test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
275f57213f8SDaniel P. Berrangé                                          meson.current_source_dir())
276f57213f8SDaniel P. Berrangé      precache = custom_target('func-precache-' + testname,
277f57213f8SDaniel P. Berrangé                               output: teststamp,
278f57213f8SDaniel P. Berrangé                               command: [python, testpath],
279f57213f8SDaniel P. Berrangé                               depend_files: files(testpath),
280f57213f8SDaniel P. Berrangé                               build_by_default: false,
281f57213f8SDaniel P. Berrangé                               env: test_precache_env)
282f57213f8SDaniel P. Berrangé      precache_all += precache
283f57213f8SDaniel P. Berrangé
284f57213f8SDaniel P. Berrangé      # Ideally we would add 'precache' to 'depends' here, such that
285f57213f8SDaniel P. Berrangé      # 'build_by_default: false' lets the pre-caching automatically
286f57213f8SDaniel P. Berrangé      # run immediately before the test runs. In practice this is
287f57213f8SDaniel P. Berrangé      # broken in meson, with it running the pre-caching in the normal
288f57213f8SDaniel P. Berrangé      # compile phase https://github.com/mesonbuild/meson/issues/2518
289f57213f8SDaniel P. Berrangé      # If the above bug ever gets fixed, when QEMU changes the min
290f57213f8SDaniel P. Berrangé      # meson version, add the 'depends' and remove the custom
291f57213f8SDaniel P. Berrangé      # 'run_target' logic below & in Makefile.include
292f57213f8SDaniel P. Berrangé      test('func-' + testname,
29314973778SThomas Huth           python,
29414973778SThomas Huth           depends: [test_deps, test_emulator, emulator_modules],
29514973778SThomas Huth           env: test_env,
296f57213f8SDaniel P. Berrangé           args: [testpath],
29714973778SThomas Huth           protocol: 'tap',
298f5ccd7e0SThomas Huth           timeout: test_timeouts.get(test, 90),
299f5ccd7e0SThomas Huth           priority: test_timeouts.get(test, 90),
30014973778SThomas Huth           suite: suites)
30114973778SThomas Huth    endforeach
30214973778SThomas Huth  endforeach
30314973778SThomas Huthendforeach
304f57213f8SDaniel P. Berrangé
305f57213f8SDaniel P. Berrangérun_target('precache-functional',
306f57213f8SDaniel P. Berrangé           depends: precache_all,
307f57213f8SDaniel P. Berrangé           command: ['true'])
308