xref: /qemu/tests/functional/meson.build (revision 7472862965f77d10b44eba0d9efa9cfb47c94651)
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,
44221620b7SThomas Huth  'ppc64_replay' : 210,
45f5ccd7e0SThomas Huth  'ppc64_tuxrun' : 420,
465e654086SCédric Le Goater  'ppc64_mac99' : 120,
47f5ccd7e0SThomas Huth  'riscv64_tuxrun' : 120,
48f5ccd7e0SThomas Huth  's390x_ccw_virtio' : 420,
4973a383dcSThomas Huth  'sh4_tuxrun' : 240,
501456e906SDaniel P. Berrangé  'virtio_balloon': 120,
510a8b4fd5SThomas Huth  'x86_64_kvm_xen' : 180,
5214973778SThomas Huth}
5314973778SThomas Huth
5414973778SThomas Huthtests_generic_system = [
55cce85725SThomas Huth  'empty_cpu_model',
56eeba3d73SThomas Huth  'info_usernet',
57eeba3d73SThomas Huth  'version',
58eeba3d73SThomas Huth]
59eeba3d73SThomas Huth
6014973778SThomas Huthtests_generic_linuxuser = [
6114973778SThomas Huth]
6214973778SThomas Huth
6314973778SThomas Huthtests_generic_bsduser = [
6414973778SThomas Huth]
6514973778SThomas Huth
66092fd648SThomas Huthtests_aarch64_system_quick = [
67092fd648SThomas Huth  'migration',
68092fd648SThomas Huth]
69092fd648SThomas Huth
708f16cd80SPhilippe Mathieu-Daudétests_aarch64_system_thorough = [
71c95309b2SCédric Le Goater  'aarch64_aspeed',
72471f7ff7SPhilippe Mathieu-Daudé  'aarch64_raspi3',
73547738beSPhilippe Mathieu-Daudé  'aarch64_raspi4',
740d77c908SPierrick Bouvier  'aarch64_rme_virt',
750d77c908SPierrick Bouvier  'aarch64_rme_sbsaref',
768f16cd80SPhilippe Mathieu-Daudé  'aarch64_sbsaref',
779acd3884SThomas Huth  'aarch64_sbsaref_alpine',
789acd3884SThomas Huth  'aarch64_sbsaref_freebsd',
79156ee8b8SThomas Huth  'aarch64_tcg_plugins',
8037136902SThomas Huth  'aarch64_tuxrun',
811255f5e4SPhilippe Mathieu-Daudé  'aarch64_virt',
8201466041SThomas Huth  'aarch64_xen',
83490d25e6SThomas Huth  'aarch64_xlnx_versal',
8469e4fbd0SThomas Huth  'multiprocess',
858f16cd80SPhilippe Mathieu-Daudé]
868f16cd80SPhilippe Mathieu-Daudé
87092fd648SThomas Huthtests_alpha_system_quick = [
88092fd648SThomas Huth  'migration',
89092fd648SThomas Huth]
90092fd648SThomas Huth
919a76bc04SThomas Huthtests_alpha_system_thorough = [
929a76bc04SThomas Huth  'alpha_clipper',
93*74728629SThomas Huth  'alpha_replay',
949a76bc04SThomas Huth]
959a76bc04SThomas Huth
96092fd648SThomas Huthtests_arm_system_quick = [
97092fd648SThomas Huth  'migration',
98092fd648SThomas Huth]
99092fd648SThomas Huth
100e3fc99b1SThomas Huthtests_arm_system_thorough = [
101e50c7285SCédric Le Goater  'arm_aspeed_ast1030',
102e517cff7SCédric Le Goater  'arm_aspeed_palmetto',
1035f2b9738SCédric Le Goater  'arm_aspeed_romulus',
10408743dbaSCédric Le Goater  'arm_aspeed_ast2500',
105c7bc9cabSCédric Le Goater  'arm_aspeed_ast2600',
10638cd5c52SCédric Le Goater  'arm_aspeed_rainier',
107f7d6b772SThomas Huth  'arm_bpim2u',
108e3fc99b1SThomas Huth  'arm_canona1100',
109aff83583SPeter Maydell  'arm_collie',
110d4d183afSThomas Huth  'arm_cubieboard',
111bade2d51SThomas Huth  'arm_emcraft_sf2',
112ef83aea0SPhilippe Mathieu-Daudé  'arm_integratorcp',
113cb5f6ca8SThomas Huth  'arm_microbit',
114380f7268SThomas Huth  'arm_orangepi',
115799d6830SThomas Huth  'arm_quanta_gsj',
116165ab274SPhilippe Mathieu-Daudé  'arm_raspi2',
1178a145225SThomas Huth  'arm_replay',
11881e2926dSThomas Huth  'arm_smdkc210',
119bc4d45b2SPeter Maydell  'arm_sx1',
120c3cff727SThomas Huth  'arm_vexpress',
121a44b318fSThomas Huth  'arm_virt',
122de9f57a6SThomas Huth  'arm_tuxrun',
123e3fc99b1SThomas Huth]
124e3fc99b1SThomas Huth
12534917eadSPhilippe Mathieu-Daudétests_arm_linuxuser_thorough = [
12634917eadSPhilippe Mathieu-Daudé  'arm_bflt',
12734917eadSPhilippe Mathieu-Daudé]
12834917eadSPhilippe Mathieu-Daudé
1294c0a2df8SThomas Huthtests_avr_system_thorough = [
1304c0a2df8SThomas Huth  'avr_mega2560',
1314c0a2df8SThomas Huth]
1324c0a2df8SThomas Huth
133e4a407d2SPhilippe Mathieu-Daudétests_hppa_system_quick = [
134e4a407d2SPhilippe Mathieu-Daudé  'hppa_seabios',
135e4a407d2SPhilippe Mathieu-Daudé]
136e4a407d2SPhilippe Mathieu-Daudé
137092fd648SThomas Huthtests_i386_system_quick = [
138092fd648SThomas Huth  'migration',
139092fd648SThomas Huth]
140092fd648SThomas Huth
1414007fc94SThomas Huthtests_i386_system_thorough = [
1424007fc94SThomas Huth  'i386_tuxrun',
1434007fc94SThomas Huth]
1444007fc94SThomas Huth
1454c0a2df8SThomas Huthtests_loongarch64_system_thorough = [
1464c0a2df8SThomas Huth  'loongarch64_virt',
1474c0a2df8SThomas Huth]
1484c0a2df8SThomas Huth
149576fffbcSThomas Huthtests_m68k_system_thorough = [
1509f989d65SThomas Huth  'm68k_mcf5208evb',
151c7f3663cSThomas Huth  'm68k_nextcube',
152ec971d85SThomas Huth  'm68k_replay',
153c7f3663cSThomas Huth  'm68k_q800',
1543356bb83SAlex Bennée  'm68k_tuxrun',
155576fffbcSThomas Huth]
156576fffbcSThomas Huth
157624fb343SThomas Huthtests_microblaze_system_thorough = [
1586674fa9cSThomas Huth  'microblaze_replay',
159624fb343SThomas Huth  'microblaze_s3adsp1800'
160624fb343SThomas Huth]
161624fb343SThomas Huth
162624fb343SThomas Huthtests_microblazeel_system_thorough = [
163624fb343SThomas Huth  'microblazeel_s3adsp1800'
164624fb343SThomas Huth]
165624fb343SThomas Huth
16679cb4a14SPhilippe Mathieu-Daudétests_mips_system_thorough = [
16779cb4a14SPhilippe Mathieu-Daudé  'mips_malta',
168f194f0caSThomas Huth  'mips_replay',
16987cab1aeSThomas Huth  'mips_tuxrun',
17079cb4a14SPhilippe Mathieu-Daudé]
17179cb4a14SPhilippe Mathieu-Daudé
172a4b60becSPhilippe Mathieu-Daudétests_mipsel_system_thorough = [
173a4b60becSPhilippe Mathieu-Daudé  'mipsel_malta',
174350a998dSThomas Huth  'mipsel_replay',
17555716a89SThomas Huth  'mipsel_tuxrun',
176a4b60becSPhilippe Mathieu-Daudé]
177a4b60becSPhilippe Mathieu-Daudé
178a01be218SThomas Huthtests_mips64_system_thorough = [
179a01be218SThomas Huth  'mips64_tuxrun',
180a01be218SThomas Huth]
181a01be218SThomas Huth
1824c0a2df8SThomas Huthtests_mips64el_system_thorough = [
1830d2a8acfSThomas Huth  'mips64el_fuloong2e',
1844c0a2df8SThomas Huth  'mips64el_loongson3v',
185fcf2658bSPhilippe Mathieu-Daudé  'mips64el_malta',
186f348229eSThomas Huth  'mips64el_replay',
187a2a2a5b0SThomas Huth  'mips64el_tuxrun',
1884c0a2df8SThomas Huth]
1894c0a2df8SThomas Huth
1900addb05aSThomas Huthtests_or1k_system_thorough = [
19152ec5f51SThomas Huth  'or1k_replay',
1923a07875fSThomas Huth  'or1k_sim',
1933a07875fSThomas Huth]
1943a07875fSThomas Huth
1954c0a2df8SThomas Huthtests_ppc_system_quick = [
196092fd648SThomas Huth  'migration',
1974c0a2df8SThomas Huth  'ppc_74xx',
1984c0a2df8SThomas Huth]
1994c0a2df8SThomas Huth
2004c0a2df8SThomas Huthtests_ppc_system_thorough = [
2014c0a2df8SThomas Huth  'ppc_405',
202407a6883SThomas Huth  'ppc_40p',
203cef1becbSThomas Huth  'ppc_amiga',
204e3fc99b1SThomas Huth  'ppc_bamboo',
20512c0b407SThomas Huth  'ppc_mac',
206407a6883SThomas Huth  'ppc_mpc8544ds',
2079917e06cSThomas Huth  'ppc_replay',
20855727771SCédric Le Goater  'ppc_sam460ex',
2099ca8239aSThomas Huth  'ppc_tuxrun',
210407a6883SThomas Huth  'ppc_virtex_ml507',
211407a6883SThomas Huth]
212407a6883SThomas Huth
213092fd648SThomas Huthtests_ppc64_system_quick = [
214092fd648SThomas Huth  'migration',
215092fd648SThomas Huth]
216092fd648SThomas Huth
217407a6883SThomas Huthtests_ppc64_system_thorough = [
21853a62fdeSThomas Huth  'ppc64_e500',
21988c90719SThomas Huth  'ppc64_hv',
220407a6883SThomas Huth  'ppc64_powernv',
221407a6883SThomas Huth  'ppc64_pseries',
222221620b7SThomas Huth  'ppc64_replay',
223e6a401d7SThomas Huth  'ppc64_tuxrun',
2245e654086SCédric Le Goater  'ppc64_mac99',
225e3fc99b1SThomas Huth]
226e3fc99b1SThomas Huth
2276a564c8aSThomas Huthtests_riscv32_system_quick = [
228092fd648SThomas Huth  'migration',
2296a564c8aSThomas Huth  'riscv_opensbi',
230d5674412SThomas Huth]
231d5674412SThomas Huth
23277bc76c7SThomas Huthtests_riscv32_system_thorough = [
23377bc76c7SThomas Huth  'riscv32_tuxrun',
23477bc76c7SThomas Huth]
23577bc76c7SThomas Huth
2366a564c8aSThomas Huthtests_riscv64_system_quick = [
237092fd648SThomas Huth  'migration',
2386a564c8aSThomas Huth  'riscv_opensbi',
2396a564c8aSThomas Huth]
2406a564c8aSThomas Huth
2417746a6c4SThomas Huthtests_riscv64_system_thorough = [
2427746a6c4SThomas Huth  'riscv64_tuxrun',
2437746a6c4SThomas Huth]
2447746a6c4SThomas Huth
2456a564c8aSThomas Huthtests_rx_system_thorough = [
2466a564c8aSThomas Huth  'rx_gdbsim',
2476a564c8aSThomas Huth]
2486a564c8aSThomas Huth
249e2e9fd25SThomas Huthtests_s390x_system_thorough = [
250e2e9fd25SThomas Huth  's390x_ccw_virtio',
251e2e9fd25SThomas Huth  's390x_topology',
252e6a401d7SThomas Huth  's390x_tuxrun',
253e2e9fd25SThomas Huth]
254e2e9fd25SThomas Huth
255a94bfe1bSThomas Huthtests_sh4_system_thorough = [
256a94bfe1bSThomas Huth  'sh4_r2d',
257c592ff35SThomas Huth  'sh4_tuxrun',
258a94bfe1bSThomas Huth]
259a94bfe1bSThomas Huth
26062728ddcSThomas Huthtests_sh4eb_system_thorough = [
26162728ddcSThomas Huth  'sh4eb_r2d',
26262728ddcSThomas Huth]
263c592ff35SThomas Huth
264092fd648SThomas Huthtests_sparc_system_quick = [
265092fd648SThomas Huth  'migration',
266092fd648SThomas Huth]
267092fd648SThomas Huth
268f90527d3SThomas Huthtests_sparc_system_thorough = [
269a14dfd93SThomas Huth  'sparc_replay',
270f90527d3SThomas Huth  'sparc_sun4m',
271f90527d3SThomas Huth]
272f90527d3SThomas Huth
273092fd648SThomas Huthtests_sparc64_system_quick = [
274092fd648SThomas Huth  'migration',
275092fd648SThomas Huth]
276092fd648SThomas Huth
277e3fc99b1SThomas Huthtests_sparc64_system_thorough = [
278e3fc99b1SThomas Huth  'sparc64_sun4u',
279116667aaSThomas Huth  'sparc64_tuxrun',
2804c0a2df8SThomas Huth]
2814c0a2df8SThomas Huth
28214973778SThomas Huthtests_x86_64_system_quick = [
283cce85725SThomas Huth  'cpu_queries',
284cce85725SThomas Huth  'mem_addr_space',
285092fd648SThomas Huth  'migration',
286cce85725SThomas Huth  'pc_cpu_hotplug_props',
287cce85725SThomas Huth  'virtio_version',
288be849ef7SThomas Huth  'x86_cpu_model_versions',
289c82bfaf4SThomas Huth  'vnc',
29014973778SThomas Huth]
29114973778SThomas Huth
29214973778SThomas Huthtests_x86_64_system_thorough = [
29305caa062SThomas Huth  'acpi_bits',
294270d4a51SThomas Huth  'intel_iommu',
2958dcac1cfSThomas Huth  'linux_initrd',
29669e4fbd0SThomas Huth  'multiprocess',
2974c0a2df8SThomas Huth  'netdev_ethtool',
2981456e906SDaniel P. Berrangé  'virtio_balloon',
299239d08aaSThomas Huth  'virtio_gpu',
3005f6a260fSThomas Huth  'x86_64_hotplug_blk',
301bf850896SThomas Huth  'x86_64_hotplug_cpu',
3020a8b4fd5SThomas Huth  'x86_64_kvm_xen',
303270d4a51SThomas Huth  'x86_64_tuxrun',
30414973778SThomas Huth]
30514973778SThomas Huth
306d1939097SThomas Huthtests_xtensa_system_thorough = [
307d1939097SThomas Huth  'xtensa_lx60',
3086e52e84dSThomas Huth  'xtensa_replay',
309d1939097SThomas Huth]
310d1939097SThomas Huth
311f57213f8SDaniel P. Berrangéprecache_all = []
31214973778SThomas Huthforeach speed : ['quick', 'thorough']
31314973778SThomas Huth  foreach dir : target_dirs
31414973778SThomas Huth
31514973778SThomas Huth    target_base = dir.split('-')[0]
31614973778SThomas Huth
31714973778SThomas Huth    if dir.endswith('-softmmu')
31814973778SThomas Huth      sysmode = 'system'
31914973778SThomas Huth      test_emulator = emulators['qemu-system-' + target_base]
32014973778SThomas Huth    elif dir.endswith('-linux-user')
32114973778SThomas Huth      sysmode = 'linuxuser'
32214973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
32314973778SThomas Huth    elif dir.endswith('-bsd-user')
32414973778SThomas Huth      sysmode = 'bsduser'
32514973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
32614973778SThomas Huth    else
32714973778SThomas Huth      continue
32814973778SThomas Huth    endif
32914973778SThomas Huth
33014973778SThomas Huth    if speed == 'quick'
33114973778SThomas Huth      suites = ['func-quick', 'func-' + target_base]
33214973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
33314973778SThomas Huth                     + get_variable('tests_generic_' + sysmode)
33414973778SThomas Huth    else
33514973778SThomas Huth      suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
33614973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
33714973778SThomas Huth    endif
33814973778SThomas Huth
33914973778SThomas Huth    test_deps = roms
34014973778SThomas Huth    test_env = environment()
34114973778SThomas Huth    if have_tools
34214973778SThomas Huth      test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
34314973778SThomas Huth      test_deps += [qemu_img]
34414973778SThomas Huth    endif
34514973778SThomas Huth    test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
34614973778SThomas Huth    test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
34714973778SThomas Huth    test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
34814973778SThomas Huth                               meson.current_source_dir())
34914973778SThomas Huth
35014973778SThomas Huth    foreach test : target_tests
351f57213f8SDaniel P. Berrangé      testname = '@0@-@1@'.format(target_base, test)
352f57213f8SDaniel P. Berrangé      testfile = 'test_' + test + '.py'
353f57213f8SDaniel P. Berrangé      testpath = meson.current_source_dir() / testfile
354f57213f8SDaniel P. Berrangé      teststamp = testname + '.tstamp'
355f57213f8SDaniel P. Berrangé      test_precache_env = environment()
356f57213f8SDaniel P. Berrangé      test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
357f57213f8SDaniel P. Berrangé      test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
358f57213f8SDaniel P. Berrangé                                          meson.current_source_dir())
359f57213f8SDaniel P. Berrangé      precache = custom_target('func-precache-' + testname,
360f57213f8SDaniel P. Berrangé                               output: teststamp,
361f57213f8SDaniel P. Berrangé                               command: [python, testpath],
362f57213f8SDaniel P. Berrangé                               depend_files: files(testpath),
363f57213f8SDaniel P. Berrangé                               build_by_default: false,
364f57213f8SDaniel P. Berrangé                               env: test_precache_env)
365f57213f8SDaniel P. Berrangé      precache_all += precache
366f57213f8SDaniel P. Berrangé
367f57213f8SDaniel P. Berrangé      # Ideally we would add 'precache' to 'depends' here, such that
368f57213f8SDaniel P. Berrangé      # 'build_by_default: false' lets the pre-caching automatically
369f57213f8SDaniel P. Berrangé      # run immediately before the test runs. In practice this is
370f57213f8SDaniel P. Berrangé      # broken in meson, with it running the pre-caching in the normal
371f57213f8SDaniel P. Berrangé      # compile phase https://github.com/mesonbuild/meson/issues/2518
372f57213f8SDaniel P. Berrangé      # If the above bug ever gets fixed, when QEMU changes the min
373f57213f8SDaniel P. Berrangé      # meson version, add the 'depends' and remove the custom
374f57213f8SDaniel P. Berrangé      # 'run_target' logic below & in Makefile.include
375f57213f8SDaniel P. Berrangé      test('func-' + testname,
37614973778SThomas Huth           python,
37714973778SThomas Huth           depends: [test_deps, test_emulator, emulator_modules],
37814973778SThomas Huth           env: test_env,
379f57213f8SDaniel P. Berrangé           args: [testpath],
38014973778SThomas Huth           protocol: 'tap',
381f5ccd7e0SThomas Huth           timeout: test_timeouts.get(test, 90),
382f5ccd7e0SThomas Huth           priority: test_timeouts.get(test, 90),
38314973778SThomas Huth           suite: suites)
38414973778SThomas Huth    endforeach
38514973778SThomas Huth  endforeach
38614973778SThomas Huthendforeach
387f57213f8SDaniel P. Berrangé
388f57213f8SDaniel P. Berrangérun_target('precache-functional',
389f57213f8SDaniel P. Berrangé           depends: precache_all,
390f57213f8SDaniel P. Berrangé           command: ['true'])
391