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