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