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