xref: /qemu/tests/functional/meson.build (revision 7cea8fe35e5a67d23296b32dbe8e42ceb4e596a8)
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',
9379cb4a14SPhilippe Mathieu-Daudé]
9479cb4a14SPhilippe Mathieu-Daudé
95a4b60becSPhilippe Mathieu-Daudétests_mipsel_system_thorough = [
96a4b60becSPhilippe Mathieu-Daudé  'mipsel_malta',
97a4b60becSPhilippe Mathieu-Daudé]
98a4b60becSPhilippe Mathieu-Daudé
994c0a2df8SThomas Huthtests_mips64el_system_thorough = [
1000d2a8acfSThomas Huth  'mips64el_fuloong2e',
1014c0a2df8SThomas Huth  'mips64el_loongson3v',
102fcf2658bSPhilippe Mathieu-Daudé  'mips64el_malta',
1034c0a2df8SThomas Huth]
1044c0a2df8SThomas Huth
1050addb05aSThomas Huthtests_or1k_system_thorough = [
1063a07875fSThomas Huth  'or1k_sim',
1073a07875fSThomas Huth]
1083a07875fSThomas Huth
1094c0a2df8SThomas Huthtests_ppc_system_quick = [
1104c0a2df8SThomas Huth  'ppc_74xx',
1114c0a2df8SThomas Huth]
1124c0a2df8SThomas Huth
1134c0a2df8SThomas Huthtests_ppc_system_thorough = [
1144c0a2df8SThomas Huth  'ppc_405',
115407a6883SThomas Huth  'ppc_40p',
116cef1becbSThomas Huth  'ppc_amiga',
117e3fc99b1SThomas Huth  'ppc_bamboo',
11812c0b407SThomas Huth  'ppc_mac',
119407a6883SThomas Huth  'ppc_mpc8544ds',
120407a6883SThomas Huth  'ppc_virtex_ml507',
121407a6883SThomas Huth]
122407a6883SThomas Huth
123407a6883SThomas Huthtests_ppc64_system_thorough = [
12453a62fdeSThomas Huth  'ppc64_e500',
12588c90719SThomas Huth  'ppc64_hv',
126407a6883SThomas Huth  'ppc64_powernv',
127407a6883SThomas Huth  'ppc64_pseries',
128e3fc99b1SThomas Huth]
129e3fc99b1SThomas Huth
130d5674412SThomas Huthtests_rx_system_thorough = [
131d5674412SThomas Huth  'rx_gdbsim',
132d5674412SThomas Huth]
133d5674412SThomas Huth
13477bc76c7SThomas Huthtests_riscv32_system_thorough = [
13577bc76c7SThomas Huth  'riscv32_tuxrun',
13677bc76c7SThomas Huth]
13777bc76c7SThomas Huth
1387746a6c4SThomas Huthtests_riscv64_system_thorough = [
1397746a6c4SThomas Huth  'riscv64_tuxrun',
1407746a6c4SThomas Huth]
1417746a6c4SThomas Huth
142e2e9fd25SThomas Huthtests_s390x_system_thorough = [
143e2e9fd25SThomas Huth  's390x_ccw_virtio',
144e2e9fd25SThomas Huth  's390x_topology',
145e2e9fd25SThomas Huth]
146e2e9fd25SThomas Huth
147a94bfe1bSThomas Huthtests_sh4_system_thorough = [
148a94bfe1bSThomas Huth  'sh4_r2d',
149a94bfe1bSThomas Huth]
150a94bfe1bSThomas Huth
151f90527d3SThomas Huthtests_sparc_system_thorough = [
152f90527d3SThomas Huth  'sparc_sun4m',
153f90527d3SThomas Huth]
154f90527d3SThomas Huth
155e3fc99b1SThomas Huthtests_sparc64_system_thorough = [
156e3fc99b1SThomas Huth  'sparc64_sun4u',
157116667aaSThomas Huth  'sparc64_tuxrun',
1584c0a2df8SThomas Huth]
1594c0a2df8SThomas Huth
16014973778SThomas Huthtests_x86_64_system_quick = [
161cce85725SThomas Huth  'cpu_queries',
162cce85725SThomas Huth  'mem_addr_space',
163cce85725SThomas Huth  'pc_cpu_hotplug_props',
164cce85725SThomas Huth  'virtio_version',
165be849ef7SThomas Huth  'x86_cpu_model_versions',
16614973778SThomas Huth]
16714973778SThomas Huth
16814973778SThomas Huthtests_x86_64_system_thorough = [
16905caa062SThomas Huth  'acpi_bits',
170*7cea8fe3SThomas Huth  'x86_64_tuxrun',
1718dcac1cfSThomas Huth  'linux_initrd',
17269e4fbd0SThomas Huth  'multiprocess',
1734c0a2df8SThomas Huth  'netdev_ethtool',
174239d08aaSThomas Huth  'virtio_gpu',
17514973778SThomas Huth]
17614973778SThomas Huth
177d1939097SThomas Huthtests_xtensa_system_thorough = [
178d1939097SThomas Huth  'xtensa_lx60',
179d1939097SThomas Huth]
180d1939097SThomas Huth
181f57213f8SDaniel P. Berrangéprecache_all = []
18214973778SThomas Huthforeach speed : ['quick', 'thorough']
18314973778SThomas Huth  foreach dir : target_dirs
18414973778SThomas Huth
18514973778SThomas Huth    target_base = dir.split('-')[0]
18614973778SThomas Huth
18714973778SThomas Huth    if dir.endswith('-softmmu')
18814973778SThomas Huth      sysmode = 'system'
18914973778SThomas Huth      test_emulator = emulators['qemu-system-' + target_base]
19014973778SThomas Huth    elif dir.endswith('-linux-user')
19114973778SThomas Huth      sysmode = 'linuxuser'
19214973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
19314973778SThomas Huth    elif dir.endswith('-bsd-user')
19414973778SThomas Huth      sysmode = 'bsduser'
19514973778SThomas Huth      test_emulator = emulators['qemu-' + target_base]
19614973778SThomas Huth    else
19714973778SThomas Huth      continue
19814973778SThomas Huth    endif
19914973778SThomas Huth
20014973778SThomas Huth    if speed == 'quick'
20114973778SThomas Huth      suites = ['func-quick', 'func-' + target_base]
20214973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
20314973778SThomas Huth                     + get_variable('tests_generic_' + sysmode)
20414973778SThomas Huth    else
20514973778SThomas Huth      suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
20614973778SThomas Huth      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
20714973778SThomas Huth    endif
20814973778SThomas Huth
20914973778SThomas Huth    test_deps = roms
21014973778SThomas Huth    test_env = environment()
21114973778SThomas Huth    if have_tools
21214973778SThomas Huth      test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
21314973778SThomas Huth      test_deps += [qemu_img]
21414973778SThomas Huth    endif
21514973778SThomas Huth    test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
21614973778SThomas Huth    test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
21714973778SThomas Huth    test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
21814973778SThomas Huth                               meson.current_source_dir())
21914973778SThomas Huth
22014973778SThomas Huth    foreach test : target_tests
221f57213f8SDaniel P. Berrangé      testname = '@0@-@1@'.format(target_base, test)
222f57213f8SDaniel P. Berrangé      testfile = 'test_' + test + '.py'
223f57213f8SDaniel P. Berrangé      testpath = meson.current_source_dir() / testfile
224f57213f8SDaniel P. Berrangé      teststamp = testname + '.tstamp'
225f57213f8SDaniel P. Berrangé      test_precache_env = environment()
226f57213f8SDaniel P. Berrangé      test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
227f57213f8SDaniel P. Berrangé      test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
228f57213f8SDaniel P. Berrangé                                          meson.current_source_dir())
229f57213f8SDaniel P. Berrangé      precache = custom_target('func-precache-' + testname,
230f57213f8SDaniel P. Berrangé                               output: teststamp,
231f57213f8SDaniel P. Berrangé                               command: [python, testpath],
232f57213f8SDaniel P. Berrangé                               depend_files: files(testpath),
233f57213f8SDaniel P. Berrangé                               build_by_default: false,
234f57213f8SDaniel P. Berrangé                               env: test_precache_env)
235f57213f8SDaniel P. Berrangé      precache_all += precache
236f57213f8SDaniel P. Berrangé
237f57213f8SDaniel P. Berrangé      # Ideally we would add 'precache' to 'depends' here, such that
238f57213f8SDaniel P. Berrangé      # 'build_by_default: false' lets the pre-caching automatically
239f57213f8SDaniel P. Berrangé      # run immediately before the test runs. In practice this is
240f57213f8SDaniel P. Berrangé      # broken in meson, with it running the pre-caching in the normal
241f57213f8SDaniel P. Berrangé      # compile phase https://github.com/mesonbuild/meson/issues/2518
242f57213f8SDaniel P. Berrangé      # If the above bug ever gets fixed, when QEMU changes the min
243f57213f8SDaniel P. Berrangé      # meson version, add the 'depends' and remove the custom
244f57213f8SDaniel P. Berrangé      # 'run_target' logic below & in Makefile.include
245f57213f8SDaniel P. Berrangé      test('func-' + testname,
24614973778SThomas Huth           python,
24714973778SThomas Huth           depends: [test_deps, test_emulator, emulator_modules],
24814973778SThomas Huth           env: test_env,
249f57213f8SDaniel P. Berrangé           args: [testpath],
25014973778SThomas Huth           protocol: 'tap',
25114973778SThomas Huth           timeout: test_timeouts.get(test, 60),
25214973778SThomas Huth           priority: test_timeouts.get(test, 60),
25314973778SThomas Huth           suite: suites)
25414973778SThomas Huth    endforeach
25514973778SThomas Huth  endforeach
25614973778SThomas Huthendforeach
257f57213f8SDaniel P. Berrangé
258f57213f8SDaniel P. Berrangérun_target('precache-functional',
259f57213f8SDaniel P. Berrangé           depends: precache_all,
260f57213f8SDaniel P. Berrangé           command: ['true'])
261