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