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