xref: /qemu/tests/functional/meson.build (revision 9ca8239aad94c1da9c8a2423a7c983cf5febfd32)
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 = {
14d841f720SThomas Huth  'aarch64_raspi4' : 120,
158f16cd80SPhilippe Mathieu-Daudé  'aarch64_sbsaref' : 600,
161255f5e4SPhilippe Mathieu-Daudé  'aarch64_virt' : 360,
1705caa062SThomas Huth  'acpi_bits' : 240,
18d841f720SThomas Huth  'arm_raspi2' : 120,
19de9f57a6SThomas Huth  'arm_tuxrun' : 120,
20d841f720SThomas Huth  'mips_malta' : 120,
214c0a2df8SThomas Huth  'netdev_ethtool' : 180,
22407a6883SThomas Huth  'ppc_40p' : 240,
2388c90719SThomas Huth  'ppc64_hv' : 1000,
24d841f720SThomas Huth  'ppc64_powernv' : 240,
25d841f720SThomas Huth  'ppc64_pseries' : 240,
26d841f720SThomas Huth  's390x_ccw_virtio' : 240,
2714973778SThomas Huth}
2814973778SThomas Huth
2914973778SThomas Huthtests_generic_system = [
30cce85725SThomas Huth  'empty_cpu_model',
31eeba3d73SThomas Huth  'info_usernet',
32eeba3d73SThomas Huth  'version',
33eeba3d73SThomas Huth]
34eeba3d73SThomas Huth
3514973778SThomas Huthtests_generic_linuxuser = [
3614973778SThomas Huth]
3714973778SThomas Huth
3814973778SThomas Huthtests_generic_bsduser = [
3914973778SThomas Huth]
4014973778SThomas Huth
418f16cd80SPhilippe Mathieu-Daudétests_aarch64_system_thorough = [
42471f7ff7SPhilippe Mathieu-Daudé  'aarch64_raspi3',
43547738beSPhilippe Mathieu-Daudé  'aarch64_raspi4',
448f16cd80SPhilippe Mathieu-Daudé  'aarch64_sbsaref',
451255f5e4SPhilippe Mathieu-Daudé  'aarch64_virt',
4669e4fbd0SThomas Huth  'multiprocess',
478f16cd80SPhilippe Mathieu-Daudé]
488f16cd80SPhilippe Mathieu-Daudé
499a76bc04SThomas Huthtests_alpha_system_thorough = [
509a76bc04SThomas Huth  'alpha_clipper',
519a76bc04SThomas Huth]
529a76bc04SThomas Huth
53e3fc99b1SThomas Huthtests_arm_system_thorough = [
54e3fc99b1SThomas Huth  'arm_canona1100',
55ef83aea0SPhilippe Mathieu-Daudé  'arm_integratorcp',
56165ab274SPhilippe Mathieu-Daudé  'arm_raspi2',
57c3cff727SThomas Huth  'arm_vexpress',
58de9f57a6SThomas Huth  'arm_tuxrun',
59e3fc99b1SThomas Huth]
60e3fc99b1SThomas Huth
6134917eadSPhilippe Mathieu-Daudétests_arm_linuxuser_thorough = [
6234917eadSPhilippe Mathieu-Daudé  'arm_bflt',
6334917eadSPhilippe Mathieu-Daudé]
6434917eadSPhilippe Mathieu-Daudé
654c0a2df8SThomas Huthtests_avr_system_thorough = [
664c0a2df8SThomas Huth  'avr_mega2560',
674c0a2df8SThomas Huth]
684c0a2df8SThomas Huth
694007fc94SThomas Huthtests_i386_system_thorough = [
704007fc94SThomas Huth  'i386_tuxrun',
714007fc94SThomas Huth]
724007fc94SThomas Huth
734c0a2df8SThomas Huthtests_loongarch64_system_thorough = [
744c0a2df8SThomas Huth  'loongarch64_virt',
754c0a2df8SThomas Huth]
764c0a2df8SThomas Huth
77576fffbcSThomas Huthtests_m68k_system_thorough = [
789f989d65SThomas Huth  'm68k_mcf5208evb',
79c7f3663cSThomas Huth  'm68k_nextcube',
80c7f3663cSThomas Huth  'm68k_q800',
81576fffbcSThomas Huth]
82576fffbcSThomas Huth
83624fb343SThomas Huthtests_microblaze_system_thorough = [
84624fb343SThomas Huth  'microblaze_s3adsp1800'
85624fb343SThomas Huth]
86624fb343SThomas Huth
87624fb343SThomas Huthtests_microblazeel_system_thorough = [
88624fb343SThomas Huth  'microblazeel_s3adsp1800'
89624fb343SThomas Huth]
90624fb343SThomas Huth
9179cb4a14SPhilippe Mathieu-Daudétests_mips_system_thorough = [
9279cb4a14SPhilippe Mathieu-Daudé  'mips_malta',
9387cab1aeSThomas Huth  'mips_tuxrun',
9479cb4a14SPhilippe Mathieu-Daudé]
9579cb4a14SPhilippe Mathieu-Daudé
96a4b60becSPhilippe Mathieu-Daudétests_mipsel_system_thorough = [
97a4b60becSPhilippe Mathieu-Daudé  'mipsel_malta',
9855716a89SThomas Huth  'mipsel_tuxrun',
99a4b60becSPhilippe Mathieu-Daudé]
100a4b60becSPhilippe Mathieu-Daudé
101a01be218SThomas Huthtests_mips64_system_thorough = [
102a01be218SThomas Huth  'mips64_tuxrun',
103a01be218SThomas Huth]
104a01be218SThomas Huth
1054c0a2df8SThomas Huthtests_mips64el_system_thorough = [
1060d2a8acfSThomas Huth  'mips64el_fuloong2e',
1074c0a2df8SThomas Huth  'mips64el_loongson3v',
108fcf2658bSPhilippe Mathieu-Daudé  'mips64el_malta',
109a2a2a5b0SThomas Huth  'mips64el_tuxrun',
1104c0a2df8SThomas Huth]
1114c0a2df8SThomas Huth
1120addb05aSThomas Huthtests_or1k_system_thorough = [
1133a07875fSThomas Huth  'or1k_sim',
1143a07875fSThomas Huth]
1153a07875fSThomas Huth
1164c0a2df8SThomas Huthtests_ppc_system_quick = [
1174c0a2df8SThomas Huth  'ppc_74xx',
1184c0a2df8SThomas Huth]
1194c0a2df8SThomas Huth
1204c0a2df8SThomas Huthtests_ppc_system_thorough = [
1214c0a2df8SThomas Huth  'ppc_405',
122407a6883SThomas Huth  'ppc_40p',
123cef1becbSThomas Huth  'ppc_amiga',
124e3fc99b1SThomas Huth  'ppc_bamboo',
12512c0b407SThomas Huth  'ppc_mac',
126407a6883SThomas Huth  'ppc_mpc8544ds',
127*9ca8239aSThomas Huth  'ppc_tuxrun',
128407a6883SThomas Huth  'ppc_virtex_ml507',
129407a6883SThomas Huth]
130407a6883SThomas Huth
131407a6883SThomas Huthtests_ppc64_system_thorough = [
13253a62fdeSThomas Huth  'ppc64_e500',
13388c90719SThomas Huth  'ppc64_hv',
134407a6883SThomas Huth  'ppc64_powernv',
135407a6883SThomas Huth  'ppc64_pseries',
136e3fc99b1SThomas Huth]
137e3fc99b1SThomas Huth
138d5674412SThomas Huthtests_rx_system_thorough = [
139d5674412SThomas Huth  'rx_gdbsim',
140d5674412SThomas Huth]
141d5674412SThomas Huth
14277bc76c7SThomas Huthtests_riscv32_system_thorough = [
14377bc76c7SThomas Huth  'riscv32_tuxrun',
14477bc76c7SThomas Huth]
14577bc76c7SThomas Huth
1467746a6c4SThomas Huthtests_riscv64_system_thorough = [
1477746a6c4SThomas Huth  'riscv64_tuxrun',
1487746a6c4SThomas Huth]
1497746a6c4SThomas Huth
150e2e9fd25SThomas Huthtests_s390x_system_thorough = [
151e2e9fd25SThomas Huth  's390x_ccw_virtio',
152e2e9fd25SThomas Huth  's390x_topology',
153e2e9fd25SThomas Huth]
154e2e9fd25SThomas Huth
155a94bfe1bSThomas Huthtests_sh4_system_thorough = [
156a94bfe1bSThomas Huth  'sh4_r2d',
157a94bfe1bSThomas Huth]
158a94bfe1bSThomas Huth
159f90527d3SThomas Huthtests_sparc_system_thorough = [
160f90527d3SThomas Huth  'sparc_sun4m',
161f90527d3SThomas Huth]
162f90527d3SThomas Huth
163e3fc99b1SThomas Huthtests_sparc64_system_thorough = [
164e3fc99b1SThomas Huth  'sparc64_sun4u',
165116667aaSThomas Huth  'sparc64_tuxrun',
1664c0a2df8SThomas Huth]
1674c0a2df8SThomas Huth
16814973778SThomas Huthtests_x86_64_system_quick = [
169cce85725SThomas Huth  'cpu_queries',
170cce85725SThomas Huth  'mem_addr_space',
171cce85725SThomas Huth  'pc_cpu_hotplug_props',
172cce85725SThomas Huth  'virtio_version',
173be849ef7SThomas Huth  'x86_cpu_model_versions',
17414973778SThomas Huth]
17514973778SThomas Huth
17614973778SThomas Huthtests_x86_64_system_thorough = [
17705caa062SThomas Huth  'acpi_bits',
1787cea8fe3SThomas Huth  'x86_64_tuxrun',
1798dcac1cfSThomas Huth  'linux_initrd',
18069e4fbd0SThomas Huth  'multiprocess',
1814c0a2df8SThomas Huth  'netdev_ethtool',
182239d08aaSThomas Huth  'virtio_gpu',
18314973778SThomas Huth]
18414973778SThomas Huth
185d1939097SThomas Huthtests_xtensa_system_thorough = [
186d1939097SThomas Huth  'xtensa_lx60',
187d1939097SThomas Huth]
188d1939097SThomas Huth
189f57213f8SDaniel P. Berrangéprecache_all = []
19014973778SThomas Huthforeach speed : ['quick', 'thorough']
19114973778SThomas Huth  foreach dir : target_dirs
19214973778SThomas Huth
19314973778SThomas Huth    target_base = dir.split('-')[0]
19414973778SThomas Huth
19514973778SThomas Huth    if dir.endswith('-softmmu')
19614973778SThomas Huth      sysmode = 'system'
19714973778SThomas Huth      test_emulator = emulators['qemu-system-' + target_base]
19814973778SThomas Huth    elif dir.endswith('-linux-user')
19914973778SThomas Huth      sysmode = 'linuxuser'
20014973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
20114973778SThomas Huth    elif dir.endswith('-bsd-user')
20214973778SThomas Huth      sysmode = 'bsduser'
20314973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
20414973778SThomas Huth    else
20514973778SThomas Huth      continue
20614973778SThomas Huth    endif
20714973778SThomas Huth
20814973778SThomas Huth    if speed == 'quick'
20914973778SThomas Huth      suites = ['func-quick', 'func-' + target_base]
21014973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
21114973778SThomas Huth                     + get_variable('tests_generic_' + sysmode)
21214973778SThomas Huth    else
21314973778SThomas Huth      suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
21414973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
21514973778SThomas Huth    endif
21614973778SThomas Huth
21714973778SThomas Huth    test_deps = roms
21814973778SThomas Huth    test_env = environment()
21914973778SThomas Huth    if have_tools
22014973778SThomas Huth      test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
22114973778SThomas Huth      test_deps += [qemu_img]
22214973778SThomas Huth    endif
22314973778SThomas Huth    test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
22414973778SThomas Huth    test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
22514973778SThomas Huth    test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
22614973778SThomas Huth                               meson.current_source_dir())
22714973778SThomas Huth
22814973778SThomas Huth    foreach test : target_tests
229f57213f8SDaniel P. Berrangé      testname = '@0@-@1@'.format(target_base, test)
230f57213f8SDaniel P. Berrangé      testfile = 'test_' + test + '.py'
231f57213f8SDaniel P. Berrangé      testpath = meson.current_source_dir() / testfile
232f57213f8SDaniel P. Berrangé      teststamp = testname + '.tstamp'
233f57213f8SDaniel P. Berrangé      test_precache_env = environment()
234f57213f8SDaniel P. Berrangé      test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
235f57213f8SDaniel P. Berrangé      test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
236f57213f8SDaniel P. Berrangé                                          meson.current_source_dir())
237f57213f8SDaniel P. Berrangé      precache = custom_target('func-precache-' + testname,
238f57213f8SDaniel P. Berrangé                               output: teststamp,
239f57213f8SDaniel P. Berrangé                               command: [python, testpath],
240f57213f8SDaniel P. Berrangé                               depend_files: files(testpath),
241f57213f8SDaniel P. Berrangé                               build_by_default: false,
242f57213f8SDaniel P. Berrangé                               env: test_precache_env)
243f57213f8SDaniel P. Berrangé      precache_all += precache
244f57213f8SDaniel P. Berrangé
245f57213f8SDaniel P. Berrangé      # Ideally we would add 'precache' to 'depends' here, such that
246f57213f8SDaniel P. Berrangé      # 'build_by_default: false' lets the pre-caching automatically
247f57213f8SDaniel P. Berrangé      # run immediately before the test runs. In practice this is
248f57213f8SDaniel P. Berrangé      # broken in meson, with it running the pre-caching in the normal
249f57213f8SDaniel P. Berrangé      # compile phase https://github.com/mesonbuild/meson/issues/2518
250f57213f8SDaniel P. Berrangé      # If the above bug ever gets fixed, when QEMU changes the min
251f57213f8SDaniel P. Berrangé      # meson version, add the 'depends' and remove the custom
252f57213f8SDaniel P. Berrangé      # 'run_target' logic below & in Makefile.include
253f57213f8SDaniel P. Berrangé      test('func-' + testname,
25414973778SThomas Huth           python,
25514973778SThomas Huth           depends: [test_deps, test_emulator, emulator_modules],
25614973778SThomas Huth           env: test_env,
257f57213f8SDaniel P. Berrangé           args: [testpath],
25814973778SThomas Huth           protocol: 'tap',
25914973778SThomas Huth           timeout: test_timeouts.get(test, 60),
26014973778SThomas Huth           priority: test_timeouts.get(test, 60),
26114973778SThomas Huth           suite: suites)
26214973778SThomas Huth    endforeach
26314973778SThomas Huth  endforeach
26414973778SThomas Huthendforeach
265f57213f8SDaniel P. Berrangé
266f57213f8SDaniel P. Berrangérun_target('precache-functional',
267f57213f8SDaniel P. Berrangé           depends: precache_all,
268f57213f8SDaniel P. Berrangé           command: ['true'])
269