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