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