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