xref: /qemu/tests/functional/meson.build (revision 0f31f0f53c45e248b1d361699210019ec867c22b)
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,
52*0f31f0f5SThomas Huth  'x86_64_replay' : 480,
5314973778SThomas Huth}
5414973778SThomas Huth
5514973778SThomas Huthtests_generic_system = [
56cce85725SThomas Huth  'empty_cpu_model',
57eeba3d73SThomas Huth  'info_usernet',
58eeba3d73SThomas Huth  'version',
59eeba3d73SThomas Huth]
60eeba3d73SThomas Huth
6114973778SThomas Huthtests_generic_linuxuser = [
6214973778SThomas Huth]
6314973778SThomas Huth
6414973778SThomas Huthtests_generic_bsduser = [
6514973778SThomas Huth]
6614973778SThomas Huth
67092fd648SThomas Huthtests_aarch64_system_quick = [
68092fd648SThomas Huth  'migration',
69092fd648SThomas Huth]
70092fd648SThomas Huth
718f16cd80SPhilippe Mathieu-Daudétests_aarch64_system_thorough = [
72c95309b2SCédric Le Goater  'aarch64_aspeed',
73471f7ff7SPhilippe Mathieu-Daudé  'aarch64_raspi3',
74547738beSPhilippe Mathieu-Daudé  'aarch64_raspi4',
754d75a374SThomas Huth  'aarch64_replay',
760d77c908SPierrick Bouvier  'aarch64_rme_virt',
770d77c908SPierrick Bouvier  'aarch64_rme_sbsaref',
788f16cd80SPhilippe Mathieu-Daudé  'aarch64_sbsaref',
799acd3884SThomas Huth  'aarch64_sbsaref_alpine',
809acd3884SThomas Huth  'aarch64_sbsaref_freebsd',
81156ee8b8SThomas Huth  'aarch64_tcg_plugins',
8237136902SThomas Huth  'aarch64_tuxrun',
831255f5e4SPhilippe Mathieu-Daudé  'aarch64_virt',
8401466041SThomas Huth  'aarch64_xen',
85490d25e6SThomas Huth  'aarch64_xlnx_versal',
8669e4fbd0SThomas Huth  'multiprocess',
878f16cd80SPhilippe Mathieu-Daudé]
888f16cd80SPhilippe Mathieu-Daudé
89092fd648SThomas Huthtests_alpha_system_quick = [
90092fd648SThomas Huth  'migration',
91092fd648SThomas Huth]
92092fd648SThomas Huth
939a76bc04SThomas Huthtests_alpha_system_thorough = [
949a76bc04SThomas Huth  'alpha_clipper',
9574728629SThomas Huth  'alpha_replay',
969a76bc04SThomas Huth]
979a76bc04SThomas Huth
98092fd648SThomas Huthtests_arm_system_quick = [
99092fd648SThomas Huth  'migration',
100092fd648SThomas Huth]
101092fd648SThomas Huth
102e3fc99b1SThomas Huthtests_arm_system_thorough = [
103e50c7285SCédric Le Goater  'arm_aspeed_ast1030',
104e517cff7SCédric Le Goater  'arm_aspeed_palmetto',
1055f2b9738SCédric Le Goater  'arm_aspeed_romulus',
10608743dbaSCédric Le Goater  'arm_aspeed_ast2500',
107c7bc9cabSCédric Le Goater  'arm_aspeed_ast2600',
10838cd5c52SCédric Le Goater  'arm_aspeed_rainier',
109f7d6b772SThomas Huth  'arm_bpim2u',
110e3fc99b1SThomas Huth  'arm_canona1100',
111aff83583SPeter Maydell  'arm_collie',
112d4d183afSThomas Huth  'arm_cubieboard',
113bade2d51SThomas Huth  'arm_emcraft_sf2',
114ef83aea0SPhilippe Mathieu-Daudé  'arm_integratorcp',
115cb5f6ca8SThomas Huth  'arm_microbit',
116380f7268SThomas Huth  'arm_orangepi',
117799d6830SThomas Huth  'arm_quanta_gsj',
118165ab274SPhilippe Mathieu-Daudé  'arm_raspi2',
1198a145225SThomas Huth  'arm_replay',
12081e2926dSThomas Huth  'arm_smdkc210',
121bc4d45b2SPeter Maydell  'arm_sx1',
122c3cff727SThomas Huth  'arm_vexpress',
123a44b318fSThomas Huth  'arm_virt',
124de9f57a6SThomas Huth  'arm_tuxrun',
125e3fc99b1SThomas Huth]
126e3fc99b1SThomas Huth
12734917eadSPhilippe Mathieu-Daudétests_arm_linuxuser_thorough = [
12834917eadSPhilippe Mathieu-Daudé  'arm_bflt',
12934917eadSPhilippe Mathieu-Daudé]
13034917eadSPhilippe Mathieu-Daudé
1314c0a2df8SThomas Huthtests_avr_system_thorough = [
1324c0a2df8SThomas Huth  'avr_mega2560',
1334c0a2df8SThomas Huth]
1344c0a2df8SThomas Huth
135e4a407d2SPhilippe Mathieu-Daudétests_hppa_system_quick = [
136e4a407d2SPhilippe Mathieu-Daudé  'hppa_seabios',
137e4a407d2SPhilippe Mathieu-Daudé]
138e4a407d2SPhilippe Mathieu-Daudé
139092fd648SThomas Huthtests_i386_system_quick = [
140092fd648SThomas Huth  'migration',
141092fd648SThomas Huth]
142092fd648SThomas Huth
1434007fc94SThomas Huthtests_i386_system_thorough = [
1444007fc94SThomas Huth  'i386_tuxrun',
1454007fc94SThomas Huth]
1464007fc94SThomas Huth
1474c0a2df8SThomas Huthtests_loongarch64_system_thorough = [
1484c0a2df8SThomas Huth  'loongarch64_virt',
1494c0a2df8SThomas Huth]
1504c0a2df8SThomas Huth
151576fffbcSThomas Huthtests_m68k_system_thorough = [
1529f989d65SThomas Huth  'm68k_mcf5208evb',
153c7f3663cSThomas Huth  'm68k_nextcube',
154ec971d85SThomas Huth  'm68k_replay',
155c7f3663cSThomas Huth  'm68k_q800',
1563356bb83SAlex Bennée  'm68k_tuxrun',
157576fffbcSThomas Huth]
158576fffbcSThomas Huth
159624fb343SThomas Huthtests_microblaze_system_thorough = [
1606674fa9cSThomas Huth  'microblaze_replay',
161624fb343SThomas Huth  'microblaze_s3adsp1800'
162624fb343SThomas Huth]
163624fb343SThomas Huth
164624fb343SThomas Huthtests_microblazeel_system_thorough = [
165624fb343SThomas Huth  'microblazeel_s3adsp1800'
166624fb343SThomas Huth]
167624fb343SThomas Huth
16879cb4a14SPhilippe Mathieu-Daudétests_mips_system_thorough = [
16979cb4a14SPhilippe Mathieu-Daudé  'mips_malta',
170f194f0caSThomas Huth  'mips_replay',
17187cab1aeSThomas Huth  'mips_tuxrun',
17279cb4a14SPhilippe Mathieu-Daudé]
17379cb4a14SPhilippe Mathieu-Daudé
174a4b60becSPhilippe Mathieu-Daudétests_mipsel_system_thorough = [
175a4b60becSPhilippe Mathieu-Daudé  'mipsel_malta',
176350a998dSThomas Huth  'mipsel_replay',
17755716a89SThomas Huth  'mipsel_tuxrun',
178a4b60becSPhilippe Mathieu-Daudé]
179a4b60becSPhilippe Mathieu-Daudé
180a01be218SThomas Huthtests_mips64_system_thorough = [
181a01be218SThomas Huth  'mips64_tuxrun',
182a01be218SThomas Huth]
183a01be218SThomas Huth
1844c0a2df8SThomas Huthtests_mips64el_system_thorough = [
1850d2a8acfSThomas Huth  'mips64el_fuloong2e',
1864c0a2df8SThomas Huth  'mips64el_loongson3v',
187fcf2658bSPhilippe Mathieu-Daudé  'mips64el_malta',
188f348229eSThomas Huth  'mips64el_replay',
189a2a2a5b0SThomas Huth  'mips64el_tuxrun',
1904c0a2df8SThomas Huth]
1914c0a2df8SThomas Huth
1920addb05aSThomas Huthtests_or1k_system_thorough = [
19352ec5f51SThomas Huth  'or1k_replay',
1943a07875fSThomas Huth  'or1k_sim',
1953a07875fSThomas Huth]
1963a07875fSThomas Huth
1974c0a2df8SThomas Huthtests_ppc_system_quick = [
198092fd648SThomas Huth  'migration',
1994c0a2df8SThomas Huth  'ppc_74xx',
2004c0a2df8SThomas Huth]
2014c0a2df8SThomas Huth
2024c0a2df8SThomas Huthtests_ppc_system_thorough = [
2034c0a2df8SThomas Huth  'ppc_405',
204407a6883SThomas Huth  'ppc_40p',
205cef1becbSThomas Huth  'ppc_amiga',
206e3fc99b1SThomas Huth  'ppc_bamboo',
20712c0b407SThomas Huth  'ppc_mac',
208407a6883SThomas Huth  'ppc_mpc8544ds',
2099917e06cSThomas Huth  'ppc_replay',
21055727771SCédric Le Goater  'ppc_sam460ex',
2119ca8239aSThomas Huth  'ppc_tuxrun',
212407a6883SThomas Huth  'ppc_virtex_ml507',
213407a6883SThomas Huth]
214407a6883SThomas Huth
215092fd648SThomas Huthtests_ppc64_system_quick = [
216092fd648SThomas Huth  'migration',
217092fd648SThomas Huth]
218092fd648SThomas Huth
219407a6883SThomas Huthtests_ppc64_system_thorough = [
22053a62fdeSThomas Huth  'ppc64_e500',
22188c90719SThomas Huth  'ppc64_hv',
222407a6883SThomas Huth  'ppc64_powernv',
223407a6883SThomas Huth  'ppc64_pseries',
224221620b7SThomas Huth  'ppc64_replay',
225e6a401d7SThomas Huth  'ppc64_tuxrun',
2265e654086SCédric Le Goater  'ppc64_mac99',
227e3fc99b1SThomas Huth]
228e3fc99b1SThomas Huth
2296a564c8aSThomas Huthtests_riscv32_system_quick = [
230092fd648SThomas Huth  'migration',
2316a564c8aSThomas Huth  'riscv_opensbi',
232d5674412SThomas Huth]
233d5674412SThomas Huth
23477bc76c7SThomas Huthtests_riscv32_system_thorough = [
23577bc76c7SThomas Huth  'riscv32_tuxrun',
23677bc76c7SThomas Huth]
23777bc76c7SThomas Huth
2386a564c8aSThomas Huthtests_riscv64_system_quick = [
239092fd648SThomas Huth  'migration',
2406a564c8aSThomas Huth  'riscv_opensbi',
2416a564c8aSThomas Huth]
2426a564c8aSThomas Huth
2437746a6c4SThomas Huthtests_riscv64_system_thorough = [
2447746a6c4SThomas Huth  'riscv64_tuxrun',
2457746a6c4SThomas Huth]
2467746a6c4SThomas Huth
2476a564c8aSThomas Huthtests_rx_system_thorough = [
2486a564c8aSThomas Huth  'rx_gdbsim',
2496a564c8aSThomas Huth]
2506a564c8aSThomas Huth
251e2e9fd25SThomas Huthtests_s390x_system_thorough = [
252e2e9fd25SThomas Huth  's390x_ccw_virtio',
25350424852SThomas Huth  's390x_replay',
254e2e9fd25SThomas Huth  's390x_topology',
255e6a401d7SThomas Huth  's390x_tuxrun',
256e2e9fd25SThomas Huth]
257e2e9fd25SThomas Huth
258a94bfe1bSThomas Huthtests_sh4_system_thorough = [
259a94bfe1bSThomas Huth  'sh4_r2d',
260c592ff35SThomas Huth  'sh4_tuxrun',
261a94bfe1bSThomas Huth]
262a94bfe1bSThomas Huth
26362728ddcSThomas Huthtests_sh4eb_system_thorough = [
26462728ddcSThomas Huth  'sh4eb_r2d',
26562728ddcSThomas Huth]
266c592ff35SThomas Huth
267092fd648SThomas Huthtests_sparc_system_quick = [
268092fd648SThomas Huth  'migration',
269092fd648SThomas Huth]
270092fd648SThomas Huth
271f90527d3SThomas Huthtests_sparc_system_thorough = [
272a14dfd93SThomas Huth  'sparc_replay',
273f90527d3SThomas Huth  'sparc_sun4m',
274f90527d3SThomas Huth]
275f90527d3SThomas Huth
276092fd648SThomas Huthtests_sparc64_system_quick = [
277092fd648SThomas Huth  'migration',
278092fd648SThomas Huth]
279092fd648SThomas Huth
280e3fc99b1SThomas Huthtests_sparc64_system_thorough = [
281e3fc99b1SThomas Huth  'sparc64_sun4u',
282116667aaSThomas Huth  'sparc64_tuxrun',
2834c0a2df8SThomas Huth]
2844c0a2df8SThomas Huth
28514973778SThomas Huthtests_x86_64_system_quick = [
286cce85725SThomas Huth  'cpu_queries',
287cce85725SThomas Huth  'mem_addr_space',
288092fd648SThomas Huth  'migration',
289cce85725SThomas Huth  'pc_cpu_hotplug_props',
290cce85725SThomas Huth  'virtio_version',
291be849ef7SThomas Huth  'x86_cpu_model_versions',
292c82bfaf4SThomas Huth  'vnc',
29314973778SThomas Huth]
29414973778SThomas Huth
29514973778SThomas Huthtests_x86_64_system_thorough = [
29605caa062SThomas Huth  'acpi_bits',
297270d4a51SThomas Huth  'intel_iommu',
2988dcac1cfSThomas Huth  'linux_initrd',
29969e4fbd0SThomas Huth  'multiprocess',
3004c0a2df8SThomas Huth  'netdev_ethtool',
3011456e906SDaniel P. Berrangé  'virtio_balloon',
302239d08aaSThomas Huth  'virtio_gpu',
3035f6a260fSThomas Huth  'x86_64_hotplug_blk',
304bf850896SThomas Huth  'x86_64_hotplug_cpu',
3050a8b4fd5SThomas Huth  'x86_64_kvm_xen',
306*0f31f0f5SThomas Huth  'x86_64_replay',
307270d4a51SThomas Huth  'x86_64_tuxrun',
30814973778SThomas Huth]
30914973778SThomas Huth
310d1939097SThomas Huthtests_xtensa_system_thorough = [
311d1939097SThomas Huth  'xtensa_lx60',
3126e52e84dSThomas Huth  'xtensa_replay',
313d1939097SThomas Huth]
314d1939097SThomas Huth
315f57213f8SDaniel P. Berrangéprecache_all = []
31614973778SThomas Huthforeach speed : ['quick', 'thorough']
31714973778SThomas Huth  foreach dir : target_dirs
31814973778SThomas Huth
31914973778SThomas Huth    target_base = dir.split('-')[0]
32014973778SThomas Huth
32114973778SThomas Huth    if dir.endswith('-softmmu')
32214973778SThomas Huth      sysmode = 'system'
32314973778SThomas Huth      test_emulator = emulators['qemu-system-' + target_base]
32414973778SThomas Huth    elif dir.endswith('-linux-user')
32514973778SThomas Huth      sysmode = 'linuxuser'
32614973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
32714973778SThomas Huth    elif dir.endswith('-bsd-user')
32814973778SThomas Huth      sysmode = 'bsduser'
32914973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
33014973778SThomas Huth    else
33114973778SThomas Huth      continue
33214973778SThomas Huth    endif
33314973778SThomas Huth
33414973778SThomas Huth    if speed == 'quick'
33514973778SThomas Huth      suites = ['func-quick', 'func-' + target_base]
33614973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
33714973778SThomas Huth                     + get_variable('tests_generic_' + sysmode)
33814973778SThomas Huth    else
33914973778SThomas Huth      suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
34014973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
34114973778SThomas Huth    endif
34214973778SThomas Huth
34314973778SThomas Huth    test_deps = roms
34414973778SThomas Huth    test_env = environment()
34514973778SThomas Huth    if have_tools
34614973778SThomas Huth      test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
34714973778SThomas Huth      test_deps += [qemu_img]
34814973778SThomas Huth    endif
34914973778SThomas Huth    test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
35014973778SThomas Huth    test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
35114973778SThomas Huth    test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
35214973778SThomas Huth                               meson.current_source_dir())
35314973778SThomas Huth
35414973778SThomas Huth    foreach test : target_tests
355f57213f8SDaniel P. Berrangé      testname = '@0@-@1@'.format(target_base, test)
356f57213f8SDaniel P. Berrangé      testfile = 'test_' + test + '.py'
357f57213f8SDaniel P. Berrangé      testpath = meson.current_source_dir() / testfile
358f57213f8SDaniel P. Berrangé      teststamp = testname + '.tstamp'
359f57213f8SDaniel P. Berrangé      test_precache_env = environment()
360f57213f8SDaniel P. Berrangé      test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
361f57213f8SDaniel P. Berrangé      test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
362f57213f8SDaniel P. Berrangé                                          meson.current_source_dir())
363f57213f8SDaniel P. Berrangé      precache = custom_target('func-precache-' + testname,
364f57213f8SDaniel P. Berrangé                               output: teststamp,
365f57213f8SDaniel P. Berrangé                               command: [python, testpath],
366f57213f8SDaniel P. Berrangé                               depend_files: files(testpath),
367f57213f8SDaniel P. Berrangé                               build_by_default: false,
368f57213f8SDaniel P. Berrangé                               env: test_precache_env)
369f57213f8SDaniel P. Berrangé      precache_all += precache
370f57213f8SDaniel P. Berrangé
371f57213f8SDaniel P. Berrangé      # Ideally we would add 'precache' to 'depends' here, such that
372f57213f8SDaniel P. Berrangé      # 'build_by_default: false' lets the pre-caching automatically
373f57213f8SDaniel P. Berrangé      # run immediately before the test runs. In practice this is
374f57213f8SDaniel P. Berrangé      # broken in meson, with it running the pre-caching in the normal
375f57213f8SDaniel P. Berrangé      # compile phase https://github.com/mesonbuild/meson/issues/2518
376f57213f8SDaniel P. Berrangé      # If the above bug ever gets fixed, when QEMU changes the min
377f57213f8SDaniel P. Berrangé      # meson version, add the 'depends' and remove the custom
378f57213f8SDaniel P. Berrangé      # 'run_target' logic below & in Makefile.include
379f57213f8SDaniel P. Berrangé      test('func-' + testname,
38014973778SThomas Huth           python,
38114973778SThomas Huth           depends: [test_deps, test_emulator, emulator_modules],
38214973778SThomas Huth           env: test_env,
383f57213f8SDaniel P. Berrangé           args: [testpath],
38414973778SThomas Huth           protocol: 'tap',
385f5ccd7e0SThomas Huth           timeout: test_timeouts.get(test, 90),
386f5ccd7e0SThomas Huth           priority: test_timeouts.get(test, 90),
38714973778SThomas Huth           suite: suites)
38814973778SThomas Huth    endforeach
38914973778SThomas Huth  endforeach
39014973778SThomas Huthendforeach
391f57213f8SDaniel P. Berrangé
392f57213f8SDaniel P. Berrangérun_target('precache-functional',
393f57213f8SDaniel P. Berrangé           depends: precache_all,
394f57213f8SDaniel P. Berrangé           command: ['true'])
395