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