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