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