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