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