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