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