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