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