xref: /qemu/tests/functional/meson.build (revision 8c63f9aa3f885f06edac3d1e4f21bde939f8c517)
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,
18fe95724dSPeter Maydell  'aarch64_sbsaref_alpine' : 1200,
199acd3884SThomas Huth  'aarch64_sbsaref_freebsd' : 720,
2037136902SThomas Huth  'aarch64_tuxrun' : 240,
219a722825SAlex Bennée  'aarch64_virt' : 360,
229a722825SAlex Bennée  'aarch64_virt_gpu' : 480,
23f5ccd7e0SThomas Huth  'acpi_bits' : 420,
24e517cff7SCédric Le Goater  'arm_aspeed_palmetto' : 120,
255f2b9738SCédric Le Goater  'arm_aspeed_romulus' : 120,
263058b634SCédric Le Goater  'arm_aspeed_witherspoon' : 120,
27fe95724dSPeter Maydell  'arm_aspeed_ast2500' : 720,
28fe95724dSPeter Maydell  'arm_aspeed_ast2600' : 1200,
29b91a1d31SCédric Le Goater  'arm_aspeed_bletchley' : 120,
30fe95724dSPeter Maydell  'arm_aspeed_rainier' : 480,
31f5ccd7e0SThomas Huth  'arm_bpim2u' : 500,
32f5ccd7e0SThomas Huth  'arm_collie' : 180,
33d4d183afSThomas Huth  'arm_cubieboard' : 360,
34380f7268SThomas Huth  'arm_orangepi' : 540,
35799d6830SThomas Huth  'arm_quanta_gsj' : 240,
36d841f720SThomas Huth  'arm_raspi2' : 120,
37*8c63f9aaSPeter Maydell  'arm_replay' : 240,
38f5ccd7e0SThomas Huth  'arm_tuxrun' : 240,
39bc4d45b2SPeter Maydell  'arm_sx1' : 360,
40270d4a51SThomas Huth  'intel_iommu': 300,
41d841f720SThomas Huth  'mips_malta' : 120,
42350a998dSThomas Huth  'mipsel_replay' : 480,
43a31001b1SThomas Huth  'mips64el_replay' : 180,
444c0a2df8SThomas Huth  'netdev_ethtool' : 180,
45407a6883SThomas Huth  'ppc_40p' : 240,
4688c90719SThomas Huth  'ppc64_hv' : 1000,
47f5ccd7e0SThomas Huth  'ppc64_powernv' : 480,
48f5ccd7e0SThomas Huth  'ppc64_pseries' : 480,
49221620b7SThomas Huth  'ppc64_replay' : 210,
50f5ccd7e0SThomas Huth  'ppc64_tuxrun' : 420,
515e654086SCédric Le Goater  'ppc64_mac99' : 120,
52f5ccd7e0SThomas Huth  'riscv64_tuxrun' : 120,
53f5ccd7e0SThomas Huth  's390x_ccw_virtio' : 420,
5473a383dcSThomas Huth  'sh4_tuxrun' : 240,
551456e906SDaniel P. Berrangé  'virtio_balloon': 120,
560a8b4fd5SThomas Huth  'x86_64_kvm_xen' : 180,
570f31f0f5SThomas Huth  'x86_64_replay' : 480,
5814973778SThomas Huth}
5914973778SThomas Huth
6014973778SThomas Huthtests_generic_system = [
61cce85725SThomas Huth  'empty_cpu_model',
62eeba3d73SThomas Huth  'info_usernet',
63eeba3d73SThomas Huth  'version',
64eeba3d73SThomas Huth]
65eeba3d73SThomas Huth
6614973778SThomas Huthtests_generic_linuxuser = [
6714973778SThomas Huth]
6814973778SThomas Huth
6914973778SThomas Huthtests_generic_bsduser = [
7014973778SThomas Huth]
7114973778SThomas Huth
72092fd648SThomas Huthtests_aarch64_system_quick = [
73092fd648SThomas Huth  'migration',
74092fd648SThomas Huth]
75092fd648SThomas Huth
768f16cd80SPhilippe Mathieu-Daudétests_aarch64_system_thorough = [
77c95309b2SCédric Le Goater  'aarch64_aspeed',
78471f7ff7SPhilippe Mathieu-Daudé  'aarch64_raspi3',
79547738beSPhilippe Mathieu-Daudé  'aarch64_raspi4',
804d75a374SThomas Huth  'aarch64_replay',
810d77c908SPierrick Bouvier  'aarch64_rme_virt',
820d77c908SPierrick Bouvier  'aarch64_rme_sbsaref',
838f16cd80SPhilippe Mathieu-Daudé  'aarch64_sbsaref',
849acd3884SThomas Huth  'aarch64_sbsaref_alpine',
859acd3884SThomas Huth  'aarch64_sbsaref_freebsd',
86156ee8b8SThomas Huth  'aarch64_tcg_plugins',
8737136902SThomas Huth  'aarch64_tuxrun',
881255f5e4SPhilippe Mathieu-Daudé  'aarch64_virt',
899a722825SAlex Bennée  'aarch64_virt_gpu',
9001466041SThomas Huth  'aarch64_xen',
91490d25e6SThomas Huth  'aarch64_xlnx_versal',
9269e4fbd0SThomas Huth  'multiprocess',
938f16cd80SPhilippe Mathieu-Daudé]
948f16cd80SPhilippe Mathieu-Daudé
95092fd648SThomas Huthtests_alpha_system_quick = [
96092fd648SThomas Huth  'migration',
97092fd648SThomas Huth]
98092fd648SThomas Huth
999a76bc04SThomas Huthtests_alpha_system_thorough = [
1009a76bc04SThomas Huth  'alpha_clipper',
10174728629SThomas Huth  'alpha_replay',
1029a76bc04SThomas Huth]
1039a76bc04SThomas Huth
104092fd648SThomas Huthtests_arm_system_quick = [
105092fd648SThomas Huth  'migration',
106092fd648SThomas Huth]
107092fd648SThomas Huth
108e3fc99b1SThomas Huthtests_arm_system_thorough = [
109e50c7285SCédric Le Goater  'arm_aspeed_ast1030',
110e517cff7SCédric Le Goater  'arm_aspeed_palmetto',
1115f2b9738SCédric Le Goater  'arm_aspeed_romulus',
1123058b634SCédric Le Goater  'arm_aspeed_witherspoon',
11308743dbaSCédric Le Goater  'arm_aspeed_ast2500',
114c7bc9cabSCédric Le Goater  'arm_aspeed_ast2600',
115b91a1d31SCédric Le Goater  'arm_aspeed_bletchley',
11638cd5c52SCédric Le Goater  'arm_aspeed_rainier',
117f7d6b772SThomas Huth  'arm_bpim2u',
118e3fc99b1SThomas Huth  'arm_canona1100',
119aff83583SPeter Maydell  'arm_collie',
120d4d183afSThomas Huth  'arm_cubieboard',
121bade2d51SThomas Huth  'arm_emcraft_sf2',
122ef83aea0SPhilippe Mathieu-Daudé  'arm_integratorcp',
123cb5f6ca8SThomas Huth  'arm_microbit',
124380f7268SThomas Huth  'arm_orangepi',
125799d6830SThomas Huth  'arm_quanta_gsj',
126165ab274SPhilippe Mathieu-Daudé  'arm_raspi2',
1278a145225SThomas Huth  'arm_replay',
12881e2926dSThomas Huth  'arm_smdkc210',
129bc4d45b2SPeter Maydell  'arm_sx1',
130c3cff727SThomas Huth  'arm_vexpress',
131a44b318fSThomas Huth  'arm_virt',
132de9f57a6SThomas Huth  'arm_tuxrun',
133e3fc99b1SThomas Huth]
134e3fc99b1SThomas Huth
13534917eadSPhilippe Mathieu-Daudétests_arm_linuxuser_thorough = [
13634917eadSPhilippe Mathieu-Daudé  'arm_bflt',
13734917eadSPhilippe Mathieu-Daudé]
13834917eadSPhilippe Mathieu-Daudé
1394c0a2df8SThomas Huthtests_avr_system_thorough = [
1404c0a2df8SThomas Huth  'avr_mega2560',
1414c0a2df8SThomas Huth]
1424c0a2df8SThomas Huth
143e4a407d2SPhilippe Mathieu-Daudétests_hppa_system_quick = [
144e4a407d2SPhilippe Mathieu-Daudé  'hppa_seabios',
145e4a407d2SPhilippe Mathieu-Daudé]
146e4a407d2SPhilippe Mathieu-Daudé
147092fd648SThomas Huthtests_i386_system_quick = [
148092fd648SThomas Huth  'migration',
149092fd648SThomas Huth]
150092fd648SThomas Huth
1514007fc94SThomas Huthtests_i386_system_thorough = [
1524007fc94SThomas Huth  'i386_tuxrun',
1534007fc94SThomas Huth]
1544007fc94SThomas Huth
1554c0a2df8SThomas Huthtests_loongarch64_system_thorough = [
1564c0a2df8SThomas Huth  'loongarch64_virt',
1574c0a2df8SThomas Huth]
1584c0a2df8SThomas Huth
159576fffbcSThomas Huthtests_m68k_system_thorough = [
1609f989d65SThomas Huth  'm68k_mcf5208evb',
161c7f3663cSThomas Huth  'm68k_nextcube',
162ec971d85SThomas Huth  'm68k_replay',
163c7f3663cSThomas Huth  'm68k_q800',
1643356bb83SAlex Bennée  'm68k_tuxrun',
165576fffbcSThomas Huth]
166576fffbcSThomas Huth
167624fb343SThomas Huthtests_microblaze_system_thorough = [
1686674fa9cSThomas Huth  'microblaze_replay',
169624fb343SThomas Huth  'microblaze_s3adsp1800'
170624fb343SThomas Huth]
171624fb343SThomas Huth
172624fb343SThomas Huthtests_microblazeel_system_thorough = [
173624fb343SThomas Huth  'microblazeel_s3adsp1800'
174624fb343SThomas Huth]
175624fb343SThomas Huth
17679cb4a14SPhilippe Mathieu-Daudétests_mips_system_thorough = [
17779cb4a14SPhilippe Mathieu-Daudé  'mips_malta',
178f194f0caSThomas Huth  'mips_replay',
17987cab1aeSThomas Huth  'mips_tuxrun',
18079cb4a14SPhilippe Mathieu-Daudé]
18179cb4a14SPhilippe Mathieu-Daudé
182a4b60becSPhilippe Mathieu-Daudétests_mipsel_system_thorough = [
183a4b60becSPhilippe Mathieu-Daudé  'mipsel_malta',
184350a998dSThomas Huth  'mipsel_replay',
18555716a89SThomas Huth  'mipsel_tuxrun',
186a4b60becSPhilippe Mathieu-Daudé]
187a4b60becSPhilippe Mathieu-Daudé
188a01be218SThomas Huthtests_mips64_system_thorough = [
189a01be218SThomas Huth  'mips64_tuxrun',
190a01be218SThomas Huth]
191a01be218SThomas Huth
1924c0a2df8SThomas Huthtests_mips64el_system_thorough = [
1930d2a8acfSThomas Huth  'mips64el_fuloong2e',
1944c0a2df8SThomas Huth  'mips64el_loongson3v',
195fcf2658bSPhilippe Mathieu-Daudé  'mips64el_malta',
196f348229eSThomas Huth  'mips64el_replay',
197a2a2a5b0SThomas Huth  'mips64el_tuxrun',
1984c0a2df8SThomas Huth]
1994c0a2df8SThomas Huth
2000addb05aSThomas Huthtests_or1k_system_thorough = [
20152ec5f51SThomas Huth  'or1k_replay',
2023a07875fSThomas Huth  'or1k_sim',
2033a07875fSThomas Huth]
2043a07875fSThomas Huth
2054c0a2df8SThomas Huthtests_ppc_system_quick = [
206092fd648SThomas Huth  'migration',
2074c0a2df8SThomas Huth  'ppc_74xx',
2084c0a2df8SThomas Huth]
2094c0a2df8SThomas Huth
2104c0a2df8SThomas Huthtests_ppc_system_thorough = [
2114c0a2df8SThomas Huth  'ppc_405',
212407a6883SThomas Huth  'ppc_40p',
213cef1becbSThomas Huth  'ppc_amiga',
214e3fc99b1SThomas Huth  'ppc_bamboo',
21512c0b407SThomas Huth  'ppc_mac',
216407a6883SThomas Huth  'ppc_mpc8544ds',
2179917e06cSThomas Huth  'ppc_replay',
21855727771SCédric Le Goater  'ppc_sam460ex',
2199ca8239aSThomas Huth  'ppc_tuxrun',
220407a6883SThomas Huth  'ppc_virtex_ml507',
221407a6883SThomas Huth]
222407a6883SThomas Huth
223092fd648SThomas Huthtests_ppc64_system_quick = [
224092fd648SThomas Huth  'migration',
225092fd648SThomas Huth]
226092fd648SThomas Huth
227407a6883SThomas Huthtests_ppc64_system_thorough = [
22853a62fdeSThomas Huth  'ppc64_e500',
22988c90719SThomas Huth  'ppc64_hv',
230407a6883SThomas Huth  'ppc64_powernv',
231407a6883SThomas Huth  'ppc64_pseries',
232221620b7SThomas Huth  'ppc64_replay',
233e6a401d7SThomas Huth  'ppc64_tuxrun',
2345e654086SCédric Le Goater  'ppc64_mac99',
235e3fc99b1SThomas Huth]
236e3fc99b1SThomas Huth
2376a564c8aSThomas Huthtests_riscv32_system_quick = [
238092fd648SThomas Huth  'migration',
2396a564c8aSThomas Huth  'riscv_opensbi',
240d5674412SThomas Huth]
241d5674412SThomas Huth
24277bc76c7SThomas Huthtests_riscv32_system_thorough = [
24377bc76c7SThomas Huth  'riscv32_tuxrun',
24477bc76c7SThomas Huth]
24577bc76c7SThomas Huth
2466a564c8aSThomas Huthtests_riscv64_system_quick = [
247092fd648SThomas Huth  'migration',
2486a564c8aSThomas Huth  'riscv_opensbi',
2496a564c8aSThomas Huth]
2506a564c8aSThomas Huth
2517746a6c4SThomas Huthtests_riscv64_system_thorough = [
2527746a6c4SThomas Huth  'riscv64_tuxrun',
2537746a6c4SThomas Huth]
2547746a6c4SThomas Huth
2556a564c8aSThomas Huthtests_rx_system_thorough = [
2566a564c8aSThomas Huth  'rx_gdbsim',
2576a564c8aSThomas Huth]
2586a564c8aSThomas Huth
259e2e9fd25SThomas Huthtests_s390x_system_thorough = [
260e2e9fd25SThomas Huth  's390x_ccw_virtio',
26150424852SThomas Huth  's390x_replay',
262e2e9fd25SThomas Huth  's390x_topology',
263e6a401d7SThomas Huth  's390x_tuxrun',
264e2e9fd25SThomas Huth]
265e2e9fd25SThomas Huth
266a94bfe1bSThomas Huthtests_sh4_system_thorough = [
267a94bfe1bSThomas Huth  'sh4_r2d',
268c592ff35SThomas Huth  'sh4_tuxrun',
269a94bfe1bSThomas Huth]
270a94bfe1bSThomas Huth
27162728ddcSThomas Huthtests_sh4eb_system_thorough = [
27262728ddcSThomas Huth  'sh4eb_r2d',
27362728ddcSThomas Huth]
274c592ff35SThomas Huth
275092fd648SThomas Huthtests_sparc_system_quick = [
276092fd648SThomas Huth  'migration',
277092fd648SThomas Huth]
278092fd648SThomas Huth
279f90527d3SThomas Huthtests_sparc_system_thorough = [
280a14dfd93SThomas Huth  'sparc_replay',
281f90527d3SThomas Huth  'sparc_sun4m',
282f90527d3SThomas Huth]
283f90527d3SThomas Huth
284092fd648SThomas Huthtests_sparc64_system_quick = [
285092fd648SThomas Huth  'migration',
286092fd648SThomas Huth]
287092fd648SThomas Huth
288e3fc99b1SThomas Huthtests_sparc64_system_thorough = [
289e3fc99b1SThomas Huth  'sparc64_sun4u',
290116667aaSThomas Huth  'sparc64_tuxrun',
2914c0a2df8SThomas Huth]
2924c0a2df8SThomas Huth
29314973778SThomas Huthtests_x86_64_system_quick = [
294cce85725SThomas Huth  'cpu_queries',
295cce85725SThomas Huth  'mem_addr_space',
296092fd648SThomas Huth  'migration',
297cce85725SThomas Huth  'pc_cpu_hotplug_props',
298cce85725SThomas Huth  'virtio_version',
299be849ef7SThomas Huth  'x86_cpu_model_versions',
300c82bfaf4SThomas Huth  'vnc',
30114973778SThomas Huth]
30214973778SThomas Huth
30314973778SThomas Huthtests_x86_64_system_thorough = [
30405caa062SThomas Huth  'acpi_bits',
305270d4a51SThomas Huth  'intel_iommu',
3068dcac1cfSThomas Huth  'linux_initrd',
30769e4fbd0SThomas Huth  'multiprocess',
3084c0a2df8SThomas Huth  'netdev_ethtool',
3091456e906SDaniel P. Berrangé  'virtio_balloon',
310239d08aaSThomas Huth  'virtio_gpu',
3115f6a260fSThomas Huth  'x86_64_hotplug_blk',
312bf850896SThomas Huth  'x86_64_hotplug_cpu',
3130a8b4fd5SThomas Huth  'x86_64_kvm_xen',
3140f31f0f5SThomas Huth  'x86_64_replay',
315270d4a51SThomas Huth  'x86_64_tuxrun',
31614973778SThomas Huth]
31714973778SThomas Huth
318d1939097SThomas Huthtests_xtensa_system_thorough = [
319d1939097SThomas Huth  'xtensa_lx60',
3206e52e84dSThomas Huth  'xtensa_replay',
321d1939097SThomas Huth]
322d1939097SThomas Huth
323f57213f8SDaniel P. Berrangéprecache_all = []
32414973778SThomas Huthforeach speed : ['quick', 'thorough']
32514973778SThomas Huth  foreach dir : target_dirs
32614973778SThomas Huth
32714973778SThomas Huth    target_base = dir.split('-')[0]
32814973778SThomas Huth
32914973778SThomas Huth    if dir.endswith('-softmmu')
33014973778SThomas Huth      sysmode = 'system'
33114973778SThomas Huth      test_emulator = emulators['qemu-system-' + target_base]
33214973778SThomas Huth    elif dir.endswith('-linux-user')
33314973778SThomas Huth      sysmode = 'linuxuser'
33414973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
33514973778SThomas Huth    elif dir.endswith('-bsd-user')
33614973778SThomas Huth      sysmode = 'bsduser'
33714973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
33814973778SThomas Huth    else
33914973778SThomas Huth      continue
34014973778SThomas Huth    endif
34114973778SThomas Huth
34214973778SThomas Huth    if speed == 'quick'
34314973778SThomas Huth      suites = ['func-quick', 'func-' + target_base]
34414973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
34514973778SThomas Huth                     + get_variable('tests_generic_' + sysmode)
34614973778SThomas Huth    else
34714973778SThomas Huth      suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
34814973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
34914973778SThomas Huth    endif
35014973778SThomas Huth
35114973778SThomas Huth    test_deps = roms
35214973778SThomas Huth    test_env = environment()
35314973778SThomas Huth    if have_tools
35414973778SThomas Huth      test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
35514973778SThomas Huth      test_deps += [qemu_img]
35614973778SThomas Huth    endif
35714973778SThomas Huth    test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
35814973778SThomas Huth    test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
35914973778SThomas Huth    test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
36014973778SThomas Huth                               meson.current_source_dir())
36114973778SThomas Huth
36214973778SThomas Huth    foreach test : target_tests
363f57213f8SDaniel P. Berrangé      testname = '@0@-@1@'.format(target_base, test)
364f57213f8SDaniel P. Berrangé      testfile = 'test_' + test + '.py'
365f57213f8SDaniel P. Berrangé      testpath = meson.current_source_dir() / testfile
366f57213f8SDaniel P. Berrangé      teststamp = testname + '.tstamp'
367f57213f8SDaniel P. Berrangé      test_precache_env = environment()
368f57213f8SDaniel P. Berrangé      test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
369f57213f8SDaniel P. Berrangé      test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
370f57213f8SDaniel P. Berrangé                                          meson.current_source_dir())
371f57213f8SDaniel P. Berrangé      precache = custom_target('func-precache-' + testname,
372f57213f8SDaniel P. Berrangé                               output: teststamp,
373f57213f8SDaniel P. Berrangé                               command: [python, testpath],
374f57213f8SDaniel P. Berrangé                               depend_files: files(testpath),
375f57213f8SDaniel P. Berrangé                               build_by_default: false,
376f57213f8SDaniel P. Berrangé                               env: test_precache_env)
377f57213f8SDaniel P. Berrangé      precache_all += precache
378f57213f8SDaniel P. Berrangé
379f57213f8SDaniel P. Berrangé      # Ideally we would add 'precache' to 'depends' here, such that
380f57213f8SDaniel P. Berrangé      # 'build_by_default: false' lets the pre-caching automatically
381f57213f8SDaniel P. Berrangé      # run immediately before the test runs. In practice this is
382f57213f8SDaniel P. Berrangé      # broken in meson, with it running the pre-caching in the normal
383f57213f8SDaniel P. Berrangé      # compile phase https://github.com/mesonbuild/meson/issues/2518
384f57213f8SDaniel P. Berrangé      # If the above bug ever gets fixed, when QEMU changes the min
385f57213f8SDaniel P. Berrangé      # meson version, add the 'depends' and remove the custom
386f57213f8SDaniel P. Berrangé      # 'run_target' logic below & in Makefile.include
387f57213f8SDaniel P. Berrangé      test('func-' + testname,
38814973778SThomas Huth           python,
389892b06c4SPierrick Bouvier           depends: [test_deps, test_emulator, emulator_modules, plugin_modules],
39014973778SThomas Huth           env: test_env,
391f57213f8SDaniel P. Berrangé           args: [testpath],
39214973778SThomas Huth           protocol: 'tap',
393f5ccd7e0SThomas Huth           timeout: test_timeouts.get(test, 90),
394f5ccd7e0SThomas Huth           priority: test_timeouts.get(test, 90),
39514973778SThomas Huth           suite: suites)
39614973778SThomas Huth    endforeach
39714973778SThomas Huth  endforeach
39814973778SThomas Huthendforeach
399f57213f8SDaniel P. Berrangé
400f57213f8SDaniel P. Berrangérun_target('precache-functional',
401f57213f8SDaniel P. Berrangé           depends: precache_all,
402f57213f8SDaniel P. Berrangé           command: ['true'])
403