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