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