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