xref: /openbmc/qemu/tests/functional/meson.build (revision 9903217a4ed013228d95d8b1876b6053b2bc5e95)
1# QEMU functional tests:
2# Tests that are put in the 'quick' category are run by default during
3# 'make check'. Everything that should not be run during 'make check'
4# (e.g. tests that fetch assets from the internet) should be put into
5# the 'thorough' category instead.
6
7# Most tests run too slow with TCI enabled, so skip the functional tests there
8if get_option('tcg_interpreter')
9  subdir_done()
10endif
11
12# Timeouts for individual tests that can be slow e.g. with debugging enabled
13test_timeouts = {
14}
15
16tests_generic_system = [
17  'empty_cpu_model',
18  'info_usernet',
19  'version',
20]
21
22tests_ppc_quick = [
23  'ppc_74xx',
24]
25
26tests_generic_linuxuser = [
27]
28
29tests_generic_bsduser = [
30]
31
32tests_x86_64_system_quick = [
33  'cpu_queries',
34  'mem_addr_space',
35  'pc_cpu_hotplug_props',
36  'virtio_version',
37]
38
39tests_x86_64_system_thorough = [
40]
41
42foreach speed : ['quick', 'thorough']
43  foreach dir : target_dirs
44
45    target_base = dir.split('-')[0]
46
47    if dir.endswith('-softmmu')
48      sysmode = 'system'
49      test_emulator = emulators['qemu-system-' + target_base]
50    elif dir.endswith('-linux-user')
51      sysmode = 'linuxuser'
52      test_emulator = emulators['qemu-' + target_base]
53    elif dir.endswith('-bsd-user')
54      sysmode = 'bsduser'
55      test_emulator = emulators['qemu-' + target_base]
56    else
57      continue
58    endif
59
60    if speed == 'quick'
61      suites = ['func-quick', 'func-' + target_base]
62      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
63                     + get_variable('tests_generic_' + sysmode)
64    else
65      suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
66      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
67    endif
68
69    test_deps = roms
70    test_env = environment()
71    if have_tools
72      test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
73      test_deps += [qemu_img]
74    endif
75    test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
76    test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
77    test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
78                               meson.current_source_dir())
79
80    foreach test : target_tests
81      test('func-@0@/@1@'.format(target_base, test),
82           python,
83           depends: [test_deps, test_emulator, emulator_modules],
84           env: test_env,
85           args: [meson.current_source_dir() / 'test_' + test + '.py'],
86           protocol: 'tap',
87           timeout: test_timeouts.get(test, 60),
88           priority: test_timeouts.get(test, 60),
89           suite: suites)
90    endforeach
91  endforeach
92endforeach
93