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