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