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