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_405', 211 'ppc_40p', 212 'ppc_amiga', 213 'ppc_bamboo', 214 'ppc_mac', 215 'ppc_mpc8544ds', 216 'ppc_replay', 217 'ppc_sam460ex', 218 'ppc_tuxrun', 219 'ppc_virtex_ml507', 220] 221 222tests_ppc64_system_quick = [ 223 'migration', 224] 225 226tests_ppc64_system_thorough = [ 227 'ppc64_e500', 228 'ppc64_hv', 229 'ppc64_powernv', 230 'ppc64_pseries', 231 'ppc64_replay', 232 'ppc64_tuxrun', 233 'ppc64_mac99', 234] 235 236tests_riscv32_system_quick = [ 237 'migration', 238 'riscv_opensbi', 239] 240 241tests_riscv32_system_thorough = [ 242 'riscv32_tuxrun', 243] 244 245tests_riscv64_system_quick = [ 246 'migration', 247 'riscv_opensbi', 248] 249 250tests_riscv64_system_thorough = [ 251 'riscv64_tuxrun', 252] 253 254tests_rx_system_thorough = [ 255 'rx_gdbsim', 256] 257 258tests_s390x_system_thorough = [ 259 's390x_ccw_virtio', 260 's390x_replay', 261 's390x_topology', 262 's390x_tuxrun', 263] 264 265tests_sh4_system_thorough = [ 266 'sh4_r2d', 267 'sh4_tuxrun', 268] 269 270tests_sh4eb_system_thorough = [ 271 'sh4eb_r2d', 272] 273 274tests_sparc_system_quick = [ 275 'migration', 276] 277 278tests_sparc_system_thorough = [ 279 'sparc_replay', 280 'sparc_sun4m', 281] 282 283tests_sparc64_system_quick = [ 284 'migration', 285] 286 287tests_sparc64_system_thorough = [ 288 'sparc64_sun4u', 289 'sparc64_tuxrun', 290] 291 292tests_x86_64_system_quick = [ 293 'cpu_queries', 294 'mem_addr_space', 295 'migration', 296 'pc_cpu_hotplug_props', 297 'virtio_version', 298 'x86_cpu_model_versions', 299 'vnc', 300] 301 302tests_x86_64_system_thorough = [ 303 'acpi_bits', 304 'intel_iommu', 305 'linux_initrd', 306 'multiprocess', 307 'netdev_ethtool', 308 'virtio_balloon', 309 'virtio_gpu', 310 'x86_64_hotplug_blk', 311 'x86_64_hotplug_cpu', 312 'x86_64_kvm_xen', 313 'x86_64_replay', 314 'x86_64_tuxrun', 315] 316 317tests_xtensa_system_thorough = [ 318 'xtensa_lx60', 319 'xtensa_replay', 320] 321 322precache_all = [] 323foreach speed : ['quick', 'thorough'] 324 foreach dir : target_dirs 325 326 target_base = dir.split('-')[0] 327 328 if dir.endswith('-softmmu') 329 sysmode = 'system' 330 test_emulator = emulators['qemu-system-' + target_base] 331 elif dir.endswith('-linux-user') 332 sysmode = 'linuxuser' 333 test_emulator = emulators['qemu-' + target_base] 334 elif dir.endswith('-bsd-user') 335 sysmode = 'bsduser' 336 test_emulator = emulators['qemu-' + target_base] 337 else 338 continue 339 endif 340 341 if speed == 'quick' 342 suites = ['func-quick', 'func-' + target_base] 343 target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \ 344 + get_variable('tests_generic_' + sysmode) 345 else 346 suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed] 347 target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, []) 348 endif 349 350 test_deps = roms 351 test_env = environment() 352 if have_tools 353 test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img') 354 test_deps += [qemu_img] 355 endif 356 test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path()) 357 test_env.set('QEMU_BUILD_ROOT', meson.project_build_root()) 358 test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 359 meson.current_source_dir()) 360 361 foreach test : target_tests 362 testname = '@0@-@1@'.format(target_base, test) 363 testfile = 'test_' + test + '.py' 364 testpath = meson.current_source_dir() / testfile 365 teststamp = testname + '.tstamp' 366 test_precache_env = environment() 367 test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp) 368 test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 369 meson.current_source_dir()) 370 precache = custom_target('func-precache-' + testname, 371 output: teststamp, 372 command: [python, testpath], 373 depend_files: files(testpath), 374 build_by_default: false, 375 env: test_precache_env) 376 precache_all += precache 377 378 # Ideally we would add 'precache' to 'depends' here, such that 379 # 'build_by_default: false' lets the pre-caching automatically 380 # run immediately before the test runs. In practice this is 381 # broken in meson, with it running the pre-caching in the normal 382 # compile phase https://github.com/mesonbuild/meson/issues/2518 383 # If the above bug ever gets fixed, when QEMU changes the min 384 # meson version, add the 'depends' and remove the custom 385 # 'run_target' logic below & in Makefile.include 386 test('func-' + testname, 387 python, 388 depends: [test_deps, test_emulator, emulator_modules, plugin_modules], 389 env: test_env, 390 args: [testpath], 391 protocol: 'tap', 392 timeout: test_timeouts.get(test, 90), 393 priority: test_timeouts.get(test, 90), 394 suite: suites) 395 endforeach 396 endforeach 397endforeach 398 399run_target('precache-functional', 400 depends: precache_all, 401 command: ['true']) 402