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