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_stellaris', 141 'arm_sx1', 142 'arm_vexpress', 143 'arm_virt', 144 'arm_tuxrun', 145] 146 147tests_arm_linuxuser_thorough = [ 148 'arm_bflt', 149] 150 151tests_avr_system_thorough = [ 152 'avr_mega2560', 153 'avr_uno', 154] 155 156tests_hppa_system_quick = [ 157 'hppa_seabios', 158] 159 160tests_i386_system_quick = [ 161 'migration', 162] 163 164tests_i386_system_thorough = [ 165 'i386_replay', 166 'i386_tuxrun', 167] 168 169tests_loongarch64_system_thorough = [ 170 'loongarch64_virt', 171] 172 173tests_m68k_system_thorough = [ 174 'm68k_mcf5208evb', 175 'm68k_nextcube', 176 'm68k_replay', 177 'm68k_q800', 178 'm68k_tuxrun', 179] 180 181tests_microblaze_system_thorough = [ 182 'microblaze_replay', 183 'microblaze_s3adsp1800' 184] 185 186tests_microblazeel_system_thorough = [ 187 'microblazeel_s3adsp1800' 188] 189 190tests_mips_system_thorough = [ 191 'mips_malta', 192 'mips_replay', 193 'mips_tuxrun', 194] 195 196tests_mipsel_system_thorough = [ 197 'mipsel_malta', 198 'mipsel_replay', 199 'mipsel_tuxrun', 200] 201 202tests_mips64_system_thorough = [ 203 'mips64_malta', 204 'mips64_tuxrun', 205] 206 207tests_mips64el_system_thorough = [ 208 'mips64el_fuloong2e', 209 'mips64el_loongson3v', 210 'mips64el_malta', 211 'mips64el_replay', 212 'mips64el_tuxrun', 213] 214 215tests_or1k_system_thorough = [ 216 'or1k_replay', 217 'or1k_sim', 218] 219 220tests_ppc_system_quick = [ 221 'migration', 222 'ppc_74xx', 223] 224 225tests_ppc_system_thorough = [ 226 'ppc_40p', 227 'ppc_amiga', 228 'ppc_bamboo', 229 'ppc_mac', 230 'ppc_mpc8544ds', 231 'ppc_replay', 232 'ppc_sam460ex', 233 'ppc_tuxrun', 234 'ppc_virtex_ml507', 235] 236 237tests_ppc64_system_quick = [ 238 'migration', 239] 240 241tests_ppc64_system_thorough = [ 242 'ppc64_e500', 243 'ppc64_hv', 244 'ppc64_powernv', 245 'ppc64_pseries', 246 'ppc64_replay', 247 'ppc64_reverse_debug', 248 'ppc64_tuxrun', 249 'ppc64_mac99', 250] 251 252tests_riscv32_system_quick = [ 253 'migration', 254 'riscv_opensbi', 255] 256 257tests_riscv32_system_thorough = [ 258 'riscv32_tuxrun', 259] 260 261tests_riscv64_system_quick = [ 262 'migration', 263 'riscv_opensbi', 264] 265 266tests_riscv64_system_thorough = [ 267 'riscv64_tuxrun', 268] 269 270tests_rx_system_thorough = [ 271 'rx_gdbsim', 272] 273 274tests_s390x_system_thorough = [ 275 's390x_ccw_virtio', 276 's390x_replay', 277 's390x_topology', 278 's390x_tuxrun', 279] 280 281tests_sh4_system_thorough = [ 282 'sh4_r2d', 283 'sh4_tuxrun', 284] 285 286tests_sh4eb_system_thorough = [ 287 'sh4eb_r2d', 288] 289 290tests_sparc_system_quick = [ 291 'migration', 292] 293 294tests_sparc_system_thorough = [ 295 'sparc_replay', 296 'sparc_sun4m', 297] 298 299tests_sparc64_system_quick = [ 300 'migration', 301] 302 303tests_sparc64_system_thorough = [ 304 'sparc64_sun4u', 305 'sparc64_tuxrun', 306] 307 308tests_x86_64_system_quick = [ 309 'cpu_queries', 310 'mem_addr_space', 311 'migration', 312 'pc_cpu_hotplug_props', 313 'virtio_version', 314 'x86_cpu_model_versions', 315 'vnc', 316 'memlock', 317] 318 319tests_x86_64_system_thorough = [ 320 'acpi_bits', 321 'intel_iommu', 322 'linux_initrd', 323 'multiprocess', 324 'netdev_ethtool', 325 'virtio_balloon', 326 'virtio_gpu', 327 'x86_64_hotplug_blk', 328 'x86_64_hotplug_cpu', 329 'x86_64_kvm_xen', 330 'x86_64_replay', 331 'x86_64_reverse_debug', 332 'x86_64_tuxrun', 333] 334 335tests_xtensa_system_thorough = [ 336 'xtensa_lx60', 337 'xtensa_replay', 338] 339 340precache_all = [] 341foreach speed : ['quick', 'thorough'] 342 foreach dir : target_dirs 343 344 target_base = dir.split('-')[0] 345 346 if dir.endswith('-softmmu') 347 sysmode = 'system' 348 test_emulator = emulators['qemu-system-' + target_base] 349 elif dir.endswith('-linux-user') 350 sysmode = 'linuxuser' 351 test_emulator = emulators['qemu-' + target_base] 352 elif dir.endswith('-bsd-user') 353 sysmode = 'bsduser' 354 test_emulator = emulators['qemu-' + target_base] 355 else 356 continue 357 endif 358 359 if speed == 'quick' 360 suites = ['func-quick', 'func-' + target_base] 361 target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \ 362 + get_variable('tests_generic_' + sysmode) 363 else 364 suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed] 365 target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, []) 366 endif 367 368 test_deps = roms 369 test_env = environment() 370 if have_tools 371 test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img') 372 test_deps += [qemu_img] 373 endif 374 test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path()) 375 test_env.set('QEMU_BUILD_ROOT', meson.project_build_root()) 376 test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 377 meson.current_source_dir()) 378 379 foreach test : target_tests 380 testname = '@0@-@1@'.format(target_base, test) 381 testfile = 'test_' + test + '.py' 382 testpath = meson.current_source_dir() / testfile 383 teststamp = testname + '.tstamp' 384 test_precache_env = environment() 385 test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp) 386 test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 387 meson.current_source_dir()) 388 precache = custom_target('func-precache-' + testname, 389 output: teststamp, 390 command: [python, testpath], 391 depend_files: files(testpath), 392 build_by_default: false, 393 env: test_precache_env) 394 precache_all += precache 395 396 # Ideally we would add 'precache' to 'depends' here, such that 397 # 'build_by_default: false' lets the pre-caching automatically 398 # run immediately before the test runs. In practice this is 399 # broken in meson, with it running the pre-caching in the normal 400 # compile phase https://github.com/mesonbuild/meson/issues/2518 401 # If the above bug ever gets fixed, when QEMU changes the min 402 # meson version, add the 'depends' and remove the custom 403 # 'run_target' logic below & in Makefile.include 404 test('func-' + testname, 405 python, 406 depends: [test_deps, test_emulator, emulator_modules, plugin_modules], 407 env: test_env, 408 args: [testpath], 409 protocol: 'tap', 410 timeout: test_timeouts.get(test, 90), 411 priority: test_timeouts.get(test, 90), 412 suite: suites) 413 endforeach 414 endforeach 415endforeach 416 417run_target('precache-functional', 418 depends: precache_all, 419 command: [python, '-c', '']) 420