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