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