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