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