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_sifive_u', 278 'riscv64_tuxrun', 279] 280 281tests_rx_system_thorough = [ 282 'rx_gdbsim', 283] 284 285tests_s390x_system_thorough = [ 286 's390x_ccw_virtio', 287 's390x_pxelinux', 288 's390x_replay', 289 's390x_topology', 290 's390x_tuxrun', 291] 292 293tests_sh4_system_thorough = [ 294 'sh4_r2d', 295 'sh4_tuxrun', 296] 297 298tests_sh4eb_system_thorough = [ 299 'sh4eb_r2d', 300] 301 302tests_sparc_system_quick = [ 303 'migration', 304] 305 306tests_sparc_system_thorough = [ 307 'sparc_replay', 308 'sparc_sun4m', 309] 310 311tests_sparc64_system_quick = [ 312 'migration', 313] 314 315tests_sparc64_system_thorough = [ 316 'sparc64_sun4u', 317 'sparc64_tuxrun', 318] 319 320tests_x86_64_system_quick = [ 321 'cpu_queries', 322 'mem_addr_space', 323 'migration', 324 'pc_cpu_hotplug_props', 325 'virtio_version', 326 'x86_cpu_model_versions', 327 'vnc', 328 'memlock', 329] 330 331tests_x86_64_system_thorough = [ 332 'acpi_bits', 333 'intel_iommu', 334 'linux_initrd', 335 'multiprocess', 336 'netdev_ethtool', 337 'virtio_balloon', 338 'virtio_gpu', 339 'x86_64_hotplug_blk', 340 'x86_64_hotplug_cpu', 341 'x86_64_kvm_xen', 342 'x86_64_replay', 343 'x86_64_reverse_debug', 344 'x86_64_tuxrun', 345] 346 347tests_xtensa_system_thorough = [ 348 'xtensa_lx60', 349 'xtensa_replay', 350] 351 352precache_all = [] 353foreach speed : ['quick', 'thorough'] 354 foreach dir : target_dirs 355 356 target_base = dir.split('-')[0] 357 358 if dir.endswith('-softmmu') 359 sysmode = 'system' 360 test_emulator = emulators['qemu-system-' + target_base] 361 elif dir.endswith('-linux-user') 362 sysmode = 'linuxuser' 363 test_emulator = emulators['qemu-' + target_base] 364 elif dir.endswith('-bsd-user') 365 sysmode = 'bsduser' 366 test_emulator = emulators['qemu-' + target_base] 367 else 368 continue 369 endif 370 371 if speed == 'quick' 372 suites = ['func-quick', 'func-' + target_base] 373 target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \ 374 + get_variable('tests_generic_' + sysmode) 375 else 376 suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed] 377 target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, []) 378 endif 379 380 test_deps = [roms, keymap_targets] 381 test_env = environment() 382 if have_tools 383 test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img') 384 test_deps += [qemu_img] 385 endif 386 test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path()) 387 test_env.set('QEMU_BUILD_ROOT', meson.project_build_root()) 388 test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 389 meson.current_source_dir()) 390 391 foreach test : target_tests 392 testname = '@0@-@1@'.format(target_base, test) 393 testfile = 'test_' + test + '.py' 394 testpath = meson.current_source_dir() / testfile 395 teststamp = testname + '.tstamp' 396 test_precache_env = environment() 397 test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp) 398 test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 399 meson.current_source_dir()) 400 precache = custom_target('func-precache-' + testname, 401 output: teststamp, 402 command: [python, testpath], 403 depend_files: files(testpath), 404 build_by_default: false, 405 env: test_precache_env) 406 precache_all += precache 407 408 # Ideally we would add 'precache' to 'depends' here, such that 409 # 'build_by_default: false' lets the pre-caching automatically 410 # run immediately before the test runs. In practice this is 411 # broken in meson, with it running the pre-caching in the normal 412 # compile phase https://github.com/mesonbuild/meson/issues/2518 413 # If the above bug ever gets fixed, when QEMU changes the min 414 # meson version, add the 'depends' and remove the custom 415 # 'run_target' logic below & in Makefile.include 416 test('func-' + testname, 417 python, 418 depends: [test_deps, test_emulator, emulator_modules, plugin_modules], 419 env: test_env, 420 args: [testpath], 421 protocol: 'tap', 422 timeout: test_timeouts.get(test, 90), 423 priority: test_timeouts.get(test, 90), 424 suite: suites) 425 endforeach 426 endforeach 427endforeach 428 429run_target('precache-functional', 430 depends: precache_all, 431 command: [python, '-c', '']) 432