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