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