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