xref: /qemu/tests/functional/meson.build (revision cef1becb9f5c17d1eb4babc38f75234ead30d40a)
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,
16407a6883SThomas Huth  'ppc64_powernv' : 120,
17407a6883SThomas Huth  'ppc64_pseries' : 120,
18e2e9fd25SThomas Huth  's390x_ccw_virtio' : 180,
1914973778SThomas Huth}
2014973778SThomas Huth
2114973778SThomas Huthtests_generic_system = [
22cce85725SThomas Huth  'empty_cpu_model',
23eeba3d73SThomas Huth  'info_usernet',
24eeba3d73SThomas Huth  'version',
25eeba3d73SThomas Huth]
26eeba3d73SThomas Huth
2714973778SThomas Huthtests_generic_linuxuser = [
2814973778SThomas Huth]
2914973778SThomas Huth
3014973778SThomas Huthtests_generic_bsduser = [
3114973778SThomas Huth]
3214973778SThomas Huth
33e3fc99b1SThomas Huthtests_arm_system_thorough = [
34e3fc99b1SThomas Huth  'arm_canona1100',
35e3fc99b1SThomas Huth]
36e3fc99b1SThomas Huth
374c0a2df8SThomas Huthtests_avr_system_thorough = [
384c0a2df8SThomas Huth  'avr_mega2560',
394c0a2df8SThomas Huth]
404c0a2df8SThomas Huth
414c0a2df8SThomas Huthtests_loongarch64_system_thorough = [
424c0a2df8SThomas Huth  'loongarch64_virt',
434c0a2df8SThomas Huth]
444c0a2df8SThomas Huth
45624fb343SThomas Huthtests_microblaze_system_thorough = [
46624fb343SThomas Huth  'microblaze_s3adsp1800'
47624fb343SThomas Huth]
48624fb343SThomas Huth
49624fb343SThomas Huthtests_microblazeel_system_thorough = [
50624fb343SThomas Huth  'microblazeel_s3adsp1800'
51624fb343SThomas Huth]
52624fb343SThomas Huth
534c0a2df8SThomas Huthtests_mips64el_system_thorough = [
544c0a2df8SThomas Huth  'mips64el_loongson3v',
554c0a2df8SThomas Huth]
564c0a2df8SThomas Huth
574c0a2df8SThomas Huthtests_ppc_system_quick = [
584c0a2df8SThomas Huth  'ppc_74xx',
594c0a2df8SThomas Huth]
604c0a2df8SThomas Huth
614c0a2df8SThomas Huthtests_ppc_system_thorough = [
624c0a2df8SThomas Huth  'ppc_405',
63407a6883SThomas Huth  'ppc_40p',
64*cef1becbSThomas Huth  'ppc_amiga',
65e3fc99b1SThomas Huth  'ppc_bamboo',
66407a6883SThomas Huth  'ppc_mpc8544ds',
67407a6883SThomas Huth  'ppc_virtex_ml507',
68407a6883SThomas Huth]
69407a6883SThomas Huth
70407a6883SThomas Huthtests_ppc64_system_thorough = [
71407a6883SThomas Huth  'ppc64_powernv',
72407a6883SThomas Huth  'ppc64_pseries',
73e3fc99b1SThomas Huth]
74e3fc99b1SThomas Huth
75e2e9fd25SThomas Huthtests_s390x_system_thorough = [
76e2e9fd25SThomas Huth  's390x_ccw_virtio',
77e2e9fd25SThomas Huth  's390x_topology',
78e2e9fd25SThomas Huth]
79e2e9fd25SThomas Huth
80e3fc99b1SThomas Huthtests_sparc64_system_thorough = [
81e3fc99b1SThomas Huth  'sparc64_sun4u',
824c0a2df8SThomas Huth]
834c0a2df8SThomas Huth
8414973778SThomas Huthtests_x86_64_system_quick = [
85cce85725SThomas Huth  'cpu_queries',
86cce85725SThomas Huth  'mem_addr_space',
87cce85725SThomas Huth  'pc_cpu_hotplug_props',
88cce85725SThomas Huth  'virtio_version',
89be849ef7SThomas Huth  'x86_cpu_model_versions',
9014973778SThomas Huth]
9114973778SThomas Huth
9214973778SThomas Huthtests_x86_64_system_thorough = [
934c0a2df8SThomas Huth  'netdev_ethtool',
94239d08aaSThomas Huth  'virtio_gpu',
9514973778SThomas Huth]
9614973778SThomas Huth
97f57213f8SDaniel P. Berrangéprecache_all = []
9814973778SThomas Huthforeach speed : ['quick', 'thorough']
9914973778SThomas Huth  foreach dir : target_dirs
10014973778SThomas Huth
10114973778SThomas Huth    target_base = dir.split('-')[0]
10214973778SThomas Huth
10314973778SThomas Huth    if dir.endswith('-softmmu')
10414973778SThomas Huth      sysmode = 'system'
10514973778SThomas Huth      test_emulator = emulators['qemu-system-' + target_base]
10614973778SThomas Huth    elif dir.endswith('-linux-user')
10714973778SThomas Huth      sysmode = 'linuxuser'
10814973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
10914973778SThomas Huth    elif dir.endswith('-bsd-user')
11014973778SThomas Huth      sysmode = 'bsduser'
11114973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
11214973778SThomas Huth    else
11314973778SThomas Huth      continue
11414973778SThomas Huth    endif
11514973778SThomas Huth
11614973778SThomas Huth    if speed == 'quick'
11714973778SThomas Huth      suites = ['func-quick', 'func-' + target_base]
11814973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
11914973778SThomas Huth                     + get_variable('tests_generic_' + sysmode)
12014973778SThomas Huth    else
12114973778SThomas Huth      suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
12214973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
12314973778SThomas Huth    endif
12414973778SThomas Huth
12514973778SThomas Huth    test_deps = roms
12614973778SThomas Huth    test_env = environment()
12714973778SThomas Huth    if have_tools
12814973778SThomas Huth      test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
12914973778SThomas Huth      test_deps += [qemu_img]
13014973778SThomas Huth    endif
13114973778SThomas Huth    test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
13214973778SThomas Huth    test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
13314973778SThomas Huth    test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
13414973778SThomas Huth                               meson.current_source_dir())
13514973778SThomas Huth
13614973778SThomas Huth    foreach test : target_tests
137f57213f8SDaniel P. Berrangé      testname = '@0@-@1@'.format(target_base, test)
138f57213f8SDaniel P. Berrangé      testfile = 'test_' + test + '.py'
139f57213f8SDaniel P. Berrangé      testpath = meson.current_source_dir() / testfile
140f57213f8SDaniel P. Berrangé      teststamp = testname + '.tstamp'
141f57213f8SDaniel P. Berrangé      test_precache_env = environment()
142f57213f8SDaniel P. Berrangé      test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
143f57213f8SDaniel P. Berrangé      test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
144f57213f8SDaniel P. Berrangé                                          meson.current_source_dir())
145f57213f8SDaniel P. Berrangé      precache = custom_target('func-precache-' + testname,
146f57213f8SDaniel P. Berrangé                               output: teststamp,
147f57213f8SDaniel P. Berrangé                               command: [python, testpath],
148f57213f8SDaniel P. Berrangé                               depend_files: files(testpath),
149f57213f8SDaniel P. Berrangé                               build_by_default: false,
150f57213f8SDaniel P. Berrangé                               env: test_precache_env)
151f57213f8SDaniel P. Berrangé      precache_all += precache
152f57213f8SDaniel P. Berrangé
153f57213f8SDaniel P. Berrangé      # Ideally we would add 'precache' to 'depends' here, such that
154f57213f8SDaniel P. Berrangé      # 'build_by_default: false' lets the pre-caching automatically
155f57213f8SDaniel P. Berrangé      # run immediately before the test runs. In practice this is
156f57213f8SDaniel P. Berrangé      # broken in meson, with it running the pre-caching in the normal
157f57213f8SDaniel P. Berrangé      # compile phase https://github.com/mesonbuild/meson/issues/2518
158f57213f8SDaniel P. Berrangé      # If the above bug ever gets fixed, when QEMU changes the min
159f57213f8SDaniel P. Berrangé      # meson version, add the 'depends' and remove the custom
160f57213f8SDaniel P. Berrangé      # 'run_target' logic below & in Makefile.include
161f57213f8SDaniel P. Berrangé      test('func-' + testname,
16214973778SThomas Huth           python,
16314973778SThomas Huth           depends: [test_deps, test_emulator, emulator_modules],
16414973778SThomas Huth           env: test_env,
165f57213f8SDaniel P. Berrangé           args: [testpath],
16614973778SThomas Huth           protocol: 'tap',
16714973778SThomas Huth           timeout: test_timeouts.get(test, 60),
16814973778SThomas Huth           priority: test_timeouts.get(test, 60),
16914973778SThomas Huth           suite: suites)
17014973778SThomas Huth    endforeach
17114973778SThomas Huth  endforeach
17214973778SThomas Huthendforeach
173f57213f8SDaniel P. Berrangé
174f57213f8SDaniel P. Berrangérun_target('precache-functional',
175f57213f8SDaniel P. Berrangé           depends: precache_all,
176f57213f8SDaniel P. Berrangé           command: ['true'])
177