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