xref: /qemu/tests/functional/meson.build (revision 576fffbc8eefd806c47850f8e1c60fdcb37733e3)
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 = {
144c0a2df8SThomas Huth  'netdev_ethtool' : 180,
15407a6883SThomas Huth  'ppc_40p' : 240,
1688c90719SThomas Huth  'ppc64_hv' : 1000,
17407a6883SThomas Huth  'ppc64_powernv' : 120,
18407a6883SThomas Huth  'ppc64_pseries' : 120,
19e2e9fd25SThomas Huth  's390x_ccw_virtio' : 180,
2014973778SThomas Huth}
2114973778SThomas Huth
2214973778SThomas Huthtests_generic_system = [
23cce85725SThomas Huth  'empty_cpu_model',
24eeba3d73SThomas Huth  'info_usernet',
25eeba3d73SThomas Huth  'version',
26eeba3d73SThomas Huth]
27eeba3d73SThomas Huth
2814973778SThomas Huthtests_generic_linuxuser = [
2914973778SThomas Huth]
3014973778SThomas Huth
3114973778SThomas Huthtests_generic_bsduser = [
3214973778SThomas Huth]
3314973778SThomas Huth
34e3fc99b1SThomas Huthtests_arm_system_thorough = [
35e3fc99b1SThomas Huth  'arm_canona1100',
36e3fc99b1SThomas Huth]
37e3fc99b1SThomas Huth
384c0a2df8SThomas Huthtests_avr_system_thorough = [
394c0a2df8SThomas Huth  'avr_mega2560',
404c0a2df8SThomas Huth]
414c0a2df8SThomas Huth
424c0a2df8SThomas Huthtests_loongarch64_system_thorough = [
434c0a2df8SThomas Huth  'loongarch64_virt',
444c0a2df8SThomas Huth]
454c0a2df8SThomas Huth
46*576fffbcSThomas Huthtests_m68k_system_thorough = [
47*576fffbcSThomas Huth  'm68k_nextcube'
48*576fffbcSThomas Huth]
49*576fffbcSThomas Huth
50624fb343SThomas Huthtests_microblaze_system_thorough = [
51624fb343SThomas Huth  'microblaze_s3adsp1800'
52624fb343SThomas Huth]
53624fb343SThomas Huth
54624fb343SThomas Huthtests_microblazeel_system_thorough = [
55624fb343SThomas Huth  'microblazeel_s3adsp1800'
56624fb343SThomas Huth]
57624fb343SThomas Huth
584c0a2df8SThomas Huthtests_mips64el_system_thorough = [
594c0a2df8SThomas Huth  'mips64el_loongson3v',
604c0a2df8SThomas Huth]
614c0a2df8SThomas Huth
624c0a2df8SThomas Huthtests_ppc_system_quick = [
634c0a2df8SThomas Huth  'ppc_74xx',
644c0a2df8SThomas Huth]
654c0a2df8SThomas Huth
664c0a2df8SThomas Huthtests_ppc_system_thorough = [
674c0a2df8SThomas Huth  'ppc_405',
68407a6883SThomas Huth  'ppc_40p',
69cef1becbSThomas Huth  'ppc_amiga',
70e3fc99b1SThomas Huth  'ppc_bamboo',
71407a6883SThomas Huth  'ppc_mpc8544ds',
72407a6883SThomas Huth  'ppc_virtex_ml507',
73407a6883SThomas Huth]
74407a6883SThomas Huth
75407a6883SThomas Huthtests_ppc64_system_thorough = [
7688c90719SThomas Huth  'ppc64_hv',
77407a6883SThomas Huth  'ppc64_powernv',
78407a6883SThomas Huth  'ppc64_pseries',
79e3fc99b1SThomas Huth]
80e3fc99b1SThomas Huth
81e2e9fd25SThomas Huthtests_s390x_system_thorough = [
82e2e9fd25SThomas Huth  's390x_ccw_virtio',
83e2e9fd25SThomas Huth  's390x_topology',
84e2e9fd25SThomas Huth]
85e2e9fd25SThomas Huth
86e3fc99b1SThomas Huthtests_sparc64_system_thorough = [
87e3fc99b1SThomas Huth  'sparc64_sun4u',
884c0a2df8SThomas Huth]
894c0a2df8SThomas Huth
9014973778SThomas Huthtests_x86_64_system_quick = [
91cce85725SThomas Huth  'cpu_queries',
92cce85725SThomas Huth  'mem_addr_space',
93cce85725SThomas Huth  'pc_cpu_hotplug_props',
94cce85725SThomas Huth  'virtio_version',
95be849ef7SThomas Huth  'x86_cpu_model_versions',
9614973778SThomas Huth]
9714973778SThomas Huth
9814973778SThomas Huthtests_x86_64_system_thorough = [
994c0a2df8SThomas Huth  'netdev_ethtool',
100239d08aaSThomas Huth  'virtio_gpu',
10114973778SThomas Huth]
10214973778SThomas Huth
103f57213f8SDaniel P. Berrangéprecache_all = []
10414973778SThomas Huthforeach speed : ['quick', 'thorough']
10514973778SThomas Huth  foreach dir : target_dirs
10614973778SThomas Huth
10714973778SThomas Huth    target_base = dir.split('-')[0]
10814973778SThomas Huth
10914973778SThomas Huth    if dir.endswith('-softmmu')
11014973778SThomas Huth      sysmode = 'system'
11114973778SThomas Huth      test_emulator = emulators['qemu-system-' + target_base]
11214973778SThomas Huth    elif dir.endswith('-linux-user')
11314973778SThomas Huth      sysmode = 'linuxuser'
11414973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
11514973778SThomas Huth    elif dir.endswith('-bsd-user')
11614973778SThomas Huth      sysmode = 'bsduser'
11714973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
11814973778SThomas Huth    else
11914973778SThomas Huth      continue
12014973778SThomas Huth    endif
12114973778SThomas Huth
12214973778SThomas Huth    if speed == 'quick'
12314973778SThomas Huth      suites = ['func-quick', 'func-' + target_base]
12414973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
12514973778SThomas Huth                     + get_variable('tests_generic_' + sysmode)
12614973778SThomas Huth    else
12714973778SThomas Huth      suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
12814973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
12914973778SThomas Huth    endif
13014973778SThomas Huth
13114973778SThomas Huth    test_deps = roms
13214973778SThomas Huth    test_env = environment()
13314973778SThomas Huth    if have_tools
13414973778SThomas Huth      test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
13514973778SThomas Huth      test_deps += [qemu_img]
13614973778SThomas Huth    endif
13714973778SThomas Huth    test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
13814973778SThomas Huth    test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
13914973778SThomas Huth    test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
14014973778SThomas Huth                               meson.current_source_dir())
14114973778SThomas Huth
14214973778SThomas Huth    foreach test : target_tests
143f57213f8SDaniel P. Berrangé      testname = '@0@-@1@'.format(target_base, test)
144f57213f8SDaniel P. Berrangé      testfile = 'test_' + test + '.py'
145f57213f8SDaniel P. Berrangé      testpath = meson.current_source_dir() / testfile
146f57213f8SDaniel P. Berrangé      teststamp = testname + '.tstamp'
147f57213f8SDaniel P. Berrangé      test_precache_env = environment()
148f57213f8SDaniel P. Berrangé      test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
149f57213f8SDaniel P. Berrangé      test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
150f57213f8SDaniel P. Berrangé                                          meson.current_source_dir())
151f57213f8SDaniel P. Berrangé      precache = custom_target('func-precache-' + testname,
152f57213f8SDaniel P. Berrangé                               output: teststamp,
153f57213f8SDaniel P. Berrangé                               command: [python, testpath],
154f57213f8SDaniel P. Berrangé                               depend_files: files(testpath),
155f57213f8SDaniel P. Berrangé                               build_by_default: false,
156f57213f8SDaniel P. Berrangé                               env: test_precache_env)
157f57213f8SDaniel P. Berrangé      precache_all += precache
158f57213f8SDaniel P. Berrangé
159f57213f8SDaniel P. Berrangé      # Ideally we would add 'precache' to 'depends' here, such that
160f57213f8SDaniel P. Berrangé      # 'build_by_default: false' lets the pre-caching automatically
161f57213f8SDaniel P. Berrangé      # run immediately before the test runs. In practice this is
162f57213f8SDaniel P. Berrangé      # broken in meson, with it running the pre-caching in the normal
163f57213f8SDaniel P. Berrangé      # compile phase https://github.com/mesonbuild/meson/issues/2518
164f57213f8SDaniel P. Berrangé      # If the above bug ever gets fixed, when QEMU changes the min
165f57213f8SDaniel P. Berrangé      # meson version, add the 'depends' and remove the custom
166f57213f8SDaniel P. Berrangé      # 'run_target' logic below & in Makefile.include
167f57213f8SDaniel P. Berrangé      test('func-' + testname,
16814973778SThomas Huth           python,
16914973778SThomas Huth           depends: [test_deps, test_emulator, emulator_modules],
17014973778SThomas Huth           env: test_env,
171f57213f8SDaniel P. Berrangé           args: [testpath],
17214973778SThomas Huth           protocol: 'tap',
17314973778SThomas Huth           timeout: test_timeouts.get(test, 60),
17414973778SThomas Huth           priority: test_timeouts.get(test, 60),
17514973778SThomas Huth           suite: suites)
17614973778SThomas Huth    endforeach
17714973778SThomas Huth  endforeach
17814973778SThomas Huthendforeach
179f57213f8SDaniel P. Berrangé
180f57213f8SDaniel P. Berrangérun_target('precache-functional',
181f57213f8SDaniel P. Berrangé           depends: precache_all,
182f57213f8SDaniel P. Berrangé           command: ['true'])
183