xref: /qemu/tests/functional/meson.build (revision a4b60bec10c087e87f22c5c379600b7f32a3a8af)
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 = {
148f16cd80SPhilippe Mathieu-Daudé  'aarch64_sbsaref' : 600,
151255f5e4SPhilippe Mathieu-Daudé  'aarch64_virt' : 360,
1605caa062SThomas Huth  'acpi_bits' : 240,
174c0a2df8SThomas Huth  'netdev_ethtool' : 180,
18407a6883SThomas Huth  'ppc_40p' : 240,
1988c90719SThomas Huth  'ppc64_hv' : 1000,
20407a6883SThomas Huth  'ppc64_powernv' : 120,
21407a6883SThomas Huth  'ppc64_pseries' : 120,
22e2e9fd25SThomas Huth  's390x_ccw_virtio' : 180,
2314973778SThomas Huth}
2414973778SThomas Huth
2514973778SThomas Huthtests_generic_system = [
26cce85725SThomas Huth  'empty_cpu_model',
27eeba3d73SThomas Huth  'info_usernet',
28eeba3d73SThomas Huth  'version',
29eeba3d73SThomas Huth]
30eeba3d73SThomas Huth
3114973778SThomas Huthtests_generic_linuxuser = [
3214973778SThomas Huth]
3314973778SThomas Huth
3414973778SThomas Huthtests_generic_bsduser = [
3514973778SThomas Huth]
3614973778SThomas Huth
378f16cd80SPhilippe Mathieu-Daudétests_aarch64_system_thorough = [
388f16cd80SPhilippe Mathieu-Daudé  'aarch64_sbsaref',
391255f5e4SPhilippe Mathieu-Daudé  'aarch64_virt',
408f16cd80SPhilippe Mathieu-Daudé]
418f16cd80SPhilippe Mathieu-Daudé
42e3fc99b1SThomas Huthtests_arm_system_thorough = [
43e3fc99b1SThomas Huth  'arm_canona1100',
44ef83aea0SPhilippe Mathieu-Daudé  'arm_integratorcp',
45e3fc99b1SThomas Huth]
46e3fc99b1SThomas Huth
4734917eadSPhilippe Mathieu-Daudétests_arm_linuxuser_thorough = [
4834917eadSPhilippe Mathieu-Daudé  'arm_bflt',
4934917eadSPhilippe Mathieu-Daudé]
5034917eadSPhilippe Mathieu-Daudé
514c0a2df8SThomas Huthtests_avr_system_thorough = [
524c0a2df8SThomas Huth  'avr_mega2560',
534c0a2df8SThomas Huth]
544c0a2df8SThomas Huth
554c0a2df8SThomas Huthtests_loongarch64_system_thorough = [
564c0a2df8SThomas Huth  'loongarch64_virt',
574c0a2df8SThomas Huth]
584c0a2df8SThomas Huth
59576fffbcSThomas Huthtests_m68k_system_thorough = [
60c7f3663cSThomas Huth  'm68k_nextcube',
61c7f3663cSThomas Huth  'm68k_q800',
62576fffbcSThomas Huth]
63576fffbcSThomas Huth
64624fb343SThomas Huthtests_microblaze_system_thorough = [
65624fb343SThomas Huth  'microblaze_s3adsp1800'
66624fb343SThomas Huth]
67624fb343SThomas Huth
68624fb343SThomas Huthtests_microblazeel_system_thorough = [
69624fb343SThomas Huth  'microblazeel_s3adsp1800'
70624fb343SThomas Huth]
71624fb343SThomas Huth
72*a4b60becSPhilippe Mathieu-Daudétests_mipsel_system_thorough = [
73*a4b60becSPhilippe Mathieu-Daudé  'mipsel_malta',
74*a4b60becSPhilippe Mathieu-Daudé]
75*a4b60becSPhilippe Mathieu-Daudé
76bce9e484SPhilippe Mathieu-Daudétests_mips64el_system_quick = [
77bce9e484SPhilippe Mathieu-Daudé  'mips64el_fuloong2e',
78bce9e484SPhilippe Mathieu-Daudé]
79bce9e484SPhilippe Mathieu-Daudé
804c0a2df8SThomas Huthtests_mips64el_system_thorough = [
814c0a2df8SThomas Huth  'mips64el_loongson3v',
82fcf2658bSPhilippe Mathieu-Daudé  'mips64el_malta',
834c0a2df8SThomas Huth]
844c0a2df8SThomas Huth
854c0a2df8SThomas Huthtests_ppc_system_quick = [
864c0a2df8SThomas Huth  'ppc_74xx',
874c0a2df8SThomas Huth]
884c0a2df8SThomas Huth
894c0a2df8SThomas Huthtests_ppc_system_thorough = [
904c0a2df8SThomas Huth  'ppc_405',
91407a6883SThomas Huth  'ppc_40p',
92cef1becbSThomas Huth  'ppc_amiga',
93e3fc99b1SThomas Huth  'ppc_bamboo',
94407a6883SThomas Huth  'ppc_mpc8544ds',
95407a6883SThomas Huth  'ppc_virtex_ml507',
96407a6883SThomas Huth]
97407a6883SThomas Huth
98407a6883SThomas Huthtests_ppc64_system_thorough = [
9988c90719SThomas Huth  'ppc64_hv',
100407a6883SThomas Huth  'ppc64_powernv',
101407a6883SThomas Huth  'ppc64_pseries',
102e3fc99b1SThomas Huth]
103e3fc99b1SThomas Huth
104d5674412SThomas Huthtests_rx_system_thorough = [
105d5674412SThomas Huth  'rx_gdbsim',
106d5674412SThomas Huth]
107d5674412SThomas Huth
108e2e9fd25SThomas Huthtests_s390x_system_thorough = [
109e2e9fd25SThomas Huth  's390x_ccw_virtio',
110e2e9fd25SThomas Huth  's390x_topology',
111e2e9fd25SThomas Huth]
112e2e9fd25SThomas Huth
113e3fc99b1SThomas Huthtests_sparc64_system_thorough = [
114e3fc99b1SThomas Huth  'sparc64_sun4u',
1154c0a2df8SThomas Huth]
1164c0a2df8SThomas Huth
11714973778SThomas Huthtests_x86_64_system_quick = [
118cce85725SThomas Huth  'cpu_queries',
119cce85725SThomas Huth  'mem_addr_space',
120cce85725SThomas Huth  'pc_cpu_hotplug_props',
121cce85725SThomas Huth  'virtio_version',
122be849ef7SThomas Huth  'x86_cpu_model_versions',
12314973778SThomas Huth]
12414973778SThomas Huth
12514973778SThomas Huthtests_x86_64_system_thorough = [
12605caa062SThomas Huth  'acpi_bits',
1278dcac1cfSThomas Huth  'linux_initrd',
1284c0a2df8SThomas Huth  'netdev_ethtool',
129239d08aaSThomas Huth  'virtio_gpu',
13014973778SThomas Huth]
13114973778SThomas Huth
132f57213f8SDaniel P. Berrangéprecache_all = []
13314973778SThomas Huthforeach speed : ['quick', 'thorough']
13414973778SThomas Huth  foreach dir : target_dirs
13514973778SThomas Huth
13614973778SThomas Huth    target_base = dir.split('-')[0]
13714973778SThomas Huth
13814973778SThomas Huth    if dir.endswith('-softmmu')
13914973778SThomas Huth      sysmode = 'system'
14014973778SThomas Huth      test_emulator = emulators['qemu-system-' + target_base]
14114973778SThomas Huth    elif dir.endswith('-linux-user')
14214973778SThomas Huth      sysmode = 'linuxuser'
14314973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
14414973778SThomas Huth    elif dir.endswith('-bsd-user')
14514973778SThomas Huth      sysmode = 'bsduser'
14614973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
14714973778SThomas Huth    else
14814973778SThomas Huth      continue
14914973778SThomas Huth    endif
15014973778SThomas Huth
15114973778SThomas Huth    if speed == 'quick'
15214973778SThomas Huth      suites = ['func-quick', 'func-' + target_base]
15314973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
15414973778SThomas Huth                     + get_variable('tests_generic_' + sysmode)
15514973778SThomas Huth    else
15614973778SThomas Huth      suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
15714973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
15814973778SThomas Huth    endif
15914973778SThomas Huth
16014973778SThomas Huth    test_deps = roms
16114973778SThomas Huth    test_env = environment()
16214973778SThomas Huth    if have_tools
16314973778SThomas Huth      test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
16414973778SThomas Huth      test_deps += [qemu_img]
16514973778SThomas Huth    endif
16614973778SThomas Huth    test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
16714973778SThomas Huth    test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
16814973778SThomas Huth    test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
16914973778SThomas Huth                               meson.current_source_dir())
17014973778SThomas Huth
17114973778SThomas Huth    foreach test : target_tests
172f57213f8SDaniel P. Berrangé      testname = '@0@-@1@'.format(target_base, test)
173f57213f8SDaniel P. Berrangé      testfile = 'test_' + test + '.py'
174f57213f8SDaniel P. Berrangé      testpath = meson.current_source_dir() / testfile
175f57213f8SDaniel P. Berrangé      teststamp = testname + '.tstamp'
176f57213f8SDaniel P. Berrangé      test_precache_env = environment()
177f57213f8SDaniel P. Berrangé      test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
178f57213f8SDaniel P. Berrangé      test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
179f57213f8SDaniel P. Berrangé                                          meson.current_source_dir())
180f57213f8SDaniel P. Berrangé      precache = custom_target('func-precache-' + testname,
181f57213f8SDaniel P. Berrangé                               output: teststamp,
182f57213f8SDaniel P. Berrangé                               command: [python, testpath],
183f57213f8SDaniel P. Berrangé                               depend_files: files(testpath),
184f57213f8SDaniel P. Berrangé                               build_by_default: false,
185f57213f8SDaniel P. Berrangé                               env: test_precache_env)
186f57213f8SDaniel P. Berrangé      precache_all += precache
187f57213f8SDaniel P. Berrangé
188f57213f8SDaniel P. Berrangé      # Ideally we would add 'precache' to 'depends' here, such that
189f57213f8SDaniel P. Berrangé      # 'build_by_default: false' lets the pre-caching automatically
190f57213f8SDaniel P. Berrangé      # run immediately before the test runs. In practice this is
191f57213f8SDaniel P. Berrangé      # broken in meson, with it running the pre-caching in the normal
192f57213f8SDaniel P. Berrangé      # compile phase https://github.com/mesonbuild/meson/issues/2518
193f57213f8SDaniel P. Berrangé      # If the above bug ever gets fixed, when QEMU changes the min
194f57213f8SDaniel P. Berrangé      # meson version, add the 'depends' and remove the custom
195f57213f8SDaniel P. Berrangé      # 'run_target' logic below & in Makefile.include
196f57213f8SDaniel P. Berrangé      test('func-' + testname,
19714973778SThomas Huth           python,
19814973778SThomas Huth           depends: [test_deps, test_emulator, emulator_modules],
19914973778SThomas Huth           env: test_env,
200f57213f8SDaniel P. Berrangé           args: [testpath],
20114973778SThomas Huth           protocol: 'tap',
20214973778SThomas Huth           timeout: test_timeouts.get(test, 60),
20314973778SThomas Huth           priority: test_timeouts.get(test, 60),
20414973778SThomas Huth           suite: suites)
20514973778SThomas Huth    endforeach
20614973778SThomas Huth  endforeach
20714973778SThomas Huthendforeach
208f57213f8SDaniel P. Berrangé
209f57213f8SDaniel P. Berrangérun_target('precache-functional',
210f57213f8SDaniel P. Berrangé           depends: precache_all,
211f57213f8SDaniel P. Berrangé           command: ['true'])
212