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