xref: /qemu/tests/functional/meson.build (revision 8dcac1cf714da71e54e409253f6ebdc92ab97317)
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 = {
1405caa062SThomas Huth  'acpi_bits' : 240,
154c0a2df8SThomas Huth  'netdev_ethtool' : 180,
16407a6883SThomas Huth  'ppc_40p' : 240,
1788c90719SThomas Huth  'ppc64_hv' : 1000,
18407a6883SThomas Huth  'ppc64_powernv' : 120,
19407a6883SThomas Huth  'ppc64_pseries' : 120,
20e2e9fd25SThomas Huth  's390x_ccw_virtio' : 180,
2114973778SThomas Huth}
2214973778SThomas Huth
2314973778SThomas Huthtests_generic_system = [
24cce85725SThomas Huth  'empty_cpu_model',
25eeba3d73SThomas Huth  'info_usernet',
26eeba3d73SThomas Huth  'version',
27eeba3d73SThomas Huth]
28eeba3d73SThomas Huth
2914973778SThomas Huthtests_generic_linuxuser = [
3014973778SThomas Huth]
3114973778SThomas Huth
3214973778SThomas Huthtests_generic_bsduser = [
3314973778SThomas Huth]
3414973778SThomas Huth
35e3fc99b1SThomas Huthtests_arm_system_thorough = [
36e3fc99b1SThomas Huth  'arm_canona1100',
37e3fc99b1SThomas Huth]
38e3fc99b1SThomas Huth
394c0a2df8SThomas Huthtests_avr_system_thorough = [
404c0a2df8SThomas Huth  'avr_mega2560',
414c0a2df8SThomas Huth]
424c0a2df8SThomas Huth
434c0a2df8SThomas Huthtests_loongarch64_system_thorough = [
444c0a2df8SThomas Huth  'loongarch64_virt',
454c0a2df8SThomas Huth]
464c0a2df8SThomas Huth
47576fffbcSThomas Huthtests_m68k_system_thorough = [
48576fffbcSThomas Huth  'm68k_nextcube'
49576fffbcSThomas Huth]
50576fffbcSThomas Huth
51624fb343SThomas Huthtests_microblaze_system_thorough = [
52624fb343SThomas Huth  'microblaze_s3adsp1800'
53624fb343SThomas Huth]
54624fb343SThomas Huth
55624fb343SThomas Huthtests_microblazeel_system_thorough = [
56624fb343SThomas Huth  'microblazeel_s3adsp1800'
57624fb343SThomas Huth]
58624fb343SThomas Huth
594c0a2df8SThomas Huthtests_mips64el_system_thorough = [
604c0a2df8SThomas Huth  'mips64el_loongson3v',
614c0a2df8SThomas Huth]
624c0a2df8SThomas Huth
634c0a2df8SThomas Huthtests_ppc_system_quick = [
644c0a2df8SThomas Huth  'ppc_74xx',
654c0a2df8SThomas Huth]
664c0a2df8SThomas Huth
674c0a2df8SThomas Huthtests_ppc_system_thorough = [
684c0a2df8SThomas Huth  'ppc_405',
69407a6883SThomas Huth  'ppc_40p',
70cef1becbSThomas Huth  'ppc_amiga',
71e3fc99b1SThomas Huth  'ppc_bamboo',
72407a6883SThomas Huth  'ppc_mpc8544ds',
73407a6883SThomas Huth  'ppc_virtex_ml507',
74407a6883SThomas Huth]
75407a6883SThomas Huth
76407a6883SThomas Huthtests_ppc64_system_thorough = [
7788c90719SThomas Huth  'ppc64_hv',
78407a6883SThomas Huth  'ppc64_powernv',
79407a6883SThomas Huth  'ppc64_pseries',
80e3fc99b1SThomas Huth]
81e3fc99b1SThomas Huth
82d5674412SThomas Huthtests_rx_system_thorough = [
83d5674412SThomas Huth  'rx_gdbsim',
84d5674412SThomas Huth]
85d5674412SThomas Huth
86e2e9fd25SThomas Huthtests_s390x_system_thorough = [
87e2e9fd25SThomas Huth  's390x_ccw_virtio',
88e2e9fd25SThomas Huth  's390x_topology',
89e2e9fd25SThomas Huth]
90e2e9fd25SThomas Huth
91e3fc99b1SThomas Huthtests_sparc64_system_thorough = [
92e3fc99b1SThomas Huth  'sparc64_sun4u',
934c0a2df8SThomas Huth]
944c0a2df8SThomas Huth
9514973778SThomas Huthtests_x86_64_system_quick = [
96cce85725SThomas Huth  'cpu_queries',
97cce85725SThomas Huth  'mem_addr_space',
98cce85725SThomas Huth  'pc_cpu_hotplug_props',
99cce85725SThomas Huth  'virtio_version',
100be849ef7SThomas Huth  'x86_cpu_model_versions',
10114973778SThomas Huth]
10214973778SThomas Huth
10314973778SThomas Huthtests_x86_64_system_thorough = [
10405caa062SThomas Huth  'acpi_bits',
105*8dcac1cfSThomas Huth  'linux_initrd',
1064c0a2df8SThomas Huth  'netdev_ethtool',
107239d08aaSThomas Huth  'virtio_gpu',
10814973778SThomas Huth]
10914973778SThomas Huth
110f57213f8SDaniel P. Berrangéprecache_all = []
11114973778SThomas Huthforeach speed : ['quick', 'thorough']
11214973778SThomas Huth  foreach dir : target_dirs
11314973778SThomas Huth
11414973778SThomas Huth    target_base = dir.split('-')[0]
11514973778SThomas Huth
11614973778SThomas Huth    if dir.endswith('-softmmu')
11714973778SThomas Huth      sysmode = 'system'
11814973778SThomas Huth      test_emulator = emulators['qemu-system-' + target_base]
11914973778SThomas Huth    elif dir.endswith('-linux-user')
12014973778SThomas Huth      sysmode = 'linuxuser'
12114973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
12214973778SThomas Huth    elif dir.endswith('-bsd-user')
12314973778SThomas Huth      sysmode = 'bsduser'
12414973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
12514973778SThomas Huth    else
12614973778SThomas Huth      continue
12714973778SThomas Huth    endif
12814973778SThomas Huth
12914973778SThomas Huth    if speed == 'quick'
13014973778SThomas Huth      suites = ['func-quick', 'func-' + target_base]
13114973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
13214973778SThomas Huth                     + get_variable('tests_generic_' + sysmode)
13314973778SThomas Huth    else
13414973778SThomas Huth      suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
13514973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
13614973778SThomas Huth    endif
13714973778SThomas Huth
13814973778SThomas Huth    test_deps = roms
13914973778SThomas Huth    test_env = environment()
14014973778SThomas Huth    if have_tools
14114973778SThomas Huth      test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
14214973778SThomas Huth      test_deps += [qemu_img]
14314973778SThomas Huth    endif
14414973778SThomas Huth    test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
14514973778SThomas Huth    test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
14614973778SThomas Huth    test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
14714973778SThomas Huth                               meson.current_source_dir())
14814973778SThomas Huth
14914973778SThomas Huth    foreach test : target_tests
150f57213f8SDaniel P. Berrangé      testname = '@0@-@1@'.format(target_base, test)
151f57213f8SDaniel P. Berrangé      testfile = 'test_' + test + '.py'
152f57213f8SDaniel P. Berrangé      testpath = meson.current_source_dir() / testfile
153f57213f8SDaniel P. Berrangé      teststamp = testname + '.tstamp'
154f57213f8SDaniel P. Berrangé      test_precache_env = environment()
155f57213f8SDaniel P. Berrangé      test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
156f57213f8SDaniel P. Berrangé      test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
157f57213f8SDaniel P. Berrangé                                          meson.current_source_dir())
158f57213f8SDaniel P. Berrangé      precache = custom_target('func-precache-' + testname,
159f57213f8SDaniel P. Berrangé                               output: teststamp,
160f57213f8SDaniel P. Berrangé                               command: [python, testpath],
161f57213f8SDaniel P. Berrangé                               depend_files: files(testpath),
162f57213f8SDaniel P. Berrangé                               build_by_default: false,
163f57213f8SDaniel P. Berrangé                               env: test_precache_env)
164f57213f8SDaniel P. Berrangé      precache_all += precache
165f57213f8SDaniel P. Berrangé
166f57213f8SDaniel P. Berrangé      # Ideally we would add 'precache' to 'depends' here, such that
167f57213f8SDaniel P. Berrangé      # 'build_by_default: false' lets the pre-caching automatically
168f57213f8SDaniel P. Berrangé      # run immediately before the test runs. In practice this is
169f57213f8SDaniel P. Berrangé      # broken in meson, with it running the pre-caching in the normal
170f57213f8SDaniel P. Berrangé      # compile phase https://github.com/mesonbuild/meson/issues/2518
171f57213f8SDaniel P. Berrangé      # If the above bug ever gets fixed, when QEMU changes the min
172f57213f8SDaniel P. Berrangé      # meson version, add the 'depends' and remove the custom
173f57213f8SDaniel P. Berrangé      # 'run_target' logic below & in Makefile.include
174f57213f8SDaniel P. Berrangé      test('func-' + testname,
17514973778SThomas Huth           python,
17614973778SThomas Huth           depends: [test_deps, test_emulator, emulator_modules],
17714973778SThomas Huth           env: test_env,
178f57213f8SDaniel P. Berrangé           args: [testpath],
17914973778SThomas Huth           protocol: 'tap',
18014973778SThomas Huth           timeout: test_timeouts.get(test, 60),
18114973778SThomas Huth           priority: test_timeouts.get(test, 60),
18214973778SThomas Huth           suite: suites)
18314973778SThomas Huth    endforeach
18414973778SThomas Huth  endforeach
18514973778SThomas Huthendforeach
186f57213f8SDaniel P. Berrangé
187f57213f8SDaniel P. Berrangérun_target('precache-functional',
188f57213f8SDaniel P. Berrangé           depends: precache_all,
189f57213f8SDaniel P. Berrangé           command: ['true'])
190