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