xref: /openbmc/qemu/tests/functional/meson.build (revision 9e4cc917)
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  'aarch64_raspi4' : 120,
15  'aarch64_sbsaref' : 600,
16  'aarch64_virt' : 360,
17  'acpi_bits' : 240,
18  'arm_aspeed' : 600,
19  'arm_raspi2' : 120,
20  'arm_tuxrun' : 120,
21  'arm_sx1' : 360,
22  'mips_malta' : 120,
23  'netdev_ethtool' : 180,
24  'ppc_40p' : 240,
25  'ppc64_hv' : 1000,
26  'ppc64_powernv' : 240,
27  'ppc64_pseries' : 240,
28  's390x_ccw_virtio' : 240,
29}
30
31tests_generic_system = [
32  'empty_cpu_model',
33  'info_usernet',
34  'version',
35]
36
37tests_generic_linuxuser = [
38]
39
40tests_generic_bsduser = [
41]
42
43tests_aarch64_system_thorough = [
44  'aarch64_raspi3',
45  'aarch64_raspi4',
46  'aarch64_sbsaref',
47  'aarch64_virt',
48  'multiprocess',
49]
50
51tests_alpha_system_thorough = [
52  'alpha_clipper',
53]
54
55tests_arm_system_thorough = [
56  'arm_aspeed',
57  'arm_canona1100',
58  'arm_collie',
59  'arm_integratorcp',
60  'arm_raspi2',
61  'arm_sx1',
62  'arm_vexpress',
63  'arm_tuxrun',
64]
65
66tests_arm_linuxuser_thorough = [
67  'arm_bflt',
68]
69
70tests_avr_system_thorough = [
71  'avr_mega2560',
72]
73
74tests_i386_system_thorough = [
75  'i386_tuxrun',
76]
77
78tests_loongarch64_system_thorough = [
79  'loongarch64_virt',
80]
81
82tests_m68k_system_thorough = [
83  'm68k_mcf5208evb',
84  'm68k_nextcube',
85  'm68k_q800',
86]
87
88tests_microblaze_system_thorough = [
89  'microblaze_s3adsp1800'
90]
91
92tests_microblazeel_system_thorough = [
93  'microblazeel_s3adsp1800'
94]
95
96tests_mips_system_thorough = [
97  'mips_malta',
98  'mips_tuxrun',
99]
100
101tests_mipsel_system_thorough = [
102  'mipsel_malta',
103  'mipsel_tuxrun',
104]
105
106tests_mips64_system_thorough = [
107  'mips64_tuxrun',
108]
109
110tests_mips64el_system_thorough = [
111  'mips64el_fuloong2e',
112  'mips64el_loongson3v',
113  'mips64el_malta',
114  'mips64el_tuxrun',
115]
116
117tests_or1k_system_thorough = [
118  'or1k_sim',
119]
120
121tests_ppc_system_quick = [
122  'ppc_74xx',
123]
124
125tests_ppc_system_thorough = [
126  'ppc_405',
127  'ppc_40p',
128  'ppc_amiga',
129  'ppc_bamboo',
130  'ppc_mac',
131  'ppc_mpc8544ds',
132  'ppc_tuxrun',
133  'ppc_virtex_ml507',
134]
135
136tests_ppc64_system_thorough = [
137  'ppc64_e500',
138  'ppc64_hv',
139  'ppc64_powernv',
140  'ppc64_pseries',
141]
142
143tests_rx_system_thorough = [
144  'rx_gdbsim',
145]
146
147tests_riscv32_system_thorough = [
148  'riscv32_tuxrun',
149]
150
151tests_riscv64_system_thorough = [
152  'riscv64_tuxrun',
153]
154
155tests_s390x_system_thorough = [
156  's390x_ccw_virtio',
157  's390x_topology',
158]
159
160tests_sh4_system_thorough = [
161  'sh4_r2d',
162  'sh4_tuxrun',
163]
164
165
166tests_sparc_system_thorough = [
167  'sparc_sun4m',
168]
169
170tests_sparc64_system_thorough = [
171  'sparc64_sun4u',
172  'sparc64_tuxrun',
173]
174
175tests_x86_64_system_quick = [
176  'cpu_queries',
177  'mem_addr_space',
178  'pc_cpu_hotplug_props',
179  'virtio_version',
180  'x86_cpu_model_versions',
181]
182
183tests_x86_64_system_thorough = [
184  'acpi_bits',
185  'x86_64_tuxrun',
186  'linux_initrd',
187  'multiprocess',
188  'netdev_ethtool',
189  'virtio_gpu',
190]
191
192tests_xtensa_system_thorough = [
193  'xtensa_lx60',
194]
195
196precache_all = []
197foreach speed : ['quick', 'thorough']
198  foreach dir : target_dirs
199
200    target_base = dir.split('-')[0]
201
202    if dir.endswith('-softmmu')
203      sysmode = 'system'
204      test_emulator = emulators['qemu-system-' + target_base]
205    elif dir.endswith('-linux-user')
206      sysmode = 'linuxuser'
207      test_emulator = emulators['qemu-' + target_base]
208    elif dir.endswith('-bsd-user')
209      sysmode = 'bsduser'
210      test_emulator = emulators['qemu-' + target_base]
211    else
212      continue
213    endif
214
215    if speed == 'quick'
216      suites = ['func-quick', 'func-' + target_base]
217      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
218                     + get_variable('tests_generic_' + sysmode)
219    else
220      suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
221      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
222    endif
223
224    test_deps = roms
225    test_env = environment()
226    if have_tools
227      test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
228      test_deps += [qemu_img]
229    endif
230    test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
231    test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
232    test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
233                               meson.current_source_dir())
234
235    foreach test : target_tests
236      testname = '@0@-@1@'.format(target_base, test)
237      testfile = 'test_' + test + '.py'
238      testpath = meson.current_source_dir() / testfile
239      teststamp = testname + '.tstamp'
240      test_precache_env = environment()
241      test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
242      test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
243                                          meson.current_source_dir())
244      precache = custom_target('func-precache-' + testname,
245                               output: teststamp,
246                               command: [python, testpath],
247                               depend_files: files(testpath),
248                               build_by_default: false,
249                               env: test_precache_env)
250      precache_all += precache
251
252      # Ideally we would add 'precache' to 'depends' here, such that
253      # 'build_by_default: false' lets the pre-caching automatically
254      # run immediately before the test runs. In practice this is
255      # broken in meson, with it running the pre-caching in the normal
256      # compile phase https://github.com/mesonbuild/meson/issues/2518
257      # If the above bug ever gets fixed, when QEMU changes the min
258      # meson version, add the 'depends' and remove the custom
259      # 'run_target' logic below & in Makefile.include
260      test('func-' + testname,
261           python,
262           depends: [test_deps, test_emulator, emulator_modules],
263           env: test_env,
264           args: [testpath],
265           protocol: 'tap',
266           timeout: test_timeouts.get(test, 60),
267           priority: test_timeouts.get(test, 60),
268           suite: suites)
269    endforeach
270  endforeach
271endforeach
272
273run_target('precache-functional',
274           depends: precache_all,
275           command: ['true'])
276