114973778SThomas Huth# QEMU functional tests: 214973778SThomas Huth# Tests that are put in the 'quick' category are run by default during 314973778SThomas Huth# 'make check'. Everything that should not be run during 'make check' 414973778SThomas Huth# (e.g. tests that fetch assets from the internet) should be put into 514973778SThomas Huth# the 'thorough' category instead. 614973778SThomas Huth 714973778SThomas Huth# Most tests run too slow with TCI enabled, so skip the functional tests there 814973778SThomas Huthif get_option('tcg_interpreter') 914973778SThomas Huth subdir_done() 1014973778SThomas Huthendif 1114973778SThomas Huth 1214973778SThomas Huth# Timeouts for individual tests that can be slow e.g. with debugging enabled 1314973778SThomas Huthtest_timeouts = { 14c95309b2SCédric Le Goater 'aarch64_aspeed' : 600, 15f5ccd7e0SThomas Huth 'aarch64_raspi4' : 480, 160d77c908SPierrick Bouvier 'aarch64_rme_virt' : 1200, 170d77c908SPierrick Bouvier 'aarch64_rme_sbsaref' : 1200, 189acd3884SThomas Huth 'aarch64_sbsaref_alpine' : 720, 199acd3884SThomas Huth 'aarch64_sbsaref_freebsd' : 720, 2037136902SThomas Huth 'aarch64_tuxrun' : 240, 21f5ccd7e0SThomas Huth 'aarch64_virt' : 720, 22f5ccd7e0SThomas Huth 'acpi_bits' : 420, 23e517cff7SCédric Le Goater 'arm_aspeed_palmetto' : 120, 245f2b9738SCédric Le Goater 'arm_aspeed_romulus' : 120, 2508743dbaSCédric Le Goater 'arm_aspeed_ast2500' : 480, 26c7bc9cabSCédric Le Goater 'arm_aspeed_ast2600' : 720, 2738cd5c52SCédric Le Goater 'arm_aspeed_rainier' : 240, 28f5ccd7e0SThomas Huth 'arm_bpim2u' : 500, 29f5ccd7e0SThomas Huth 'arm_collie' : 180, 30d4d183afSThomas Huth 'arm_cubieboard' : 360, 31380f7268SThomas Huth 'arm_orangepi' : 540, 32799d6830SThomas Huth 'arm_quanta_gsj' : 240, 33d841f720SThomas Huth 'arm_raspi2' : 120, 34f5ccd7e0SThomas Huth 'arm_tuxrun' : 240, 35bc4d45b2SPeter Maydell 'arm_sx1' : 360, 36270d4a51SThomas Huth 'intel_iommu': 300, 37d841f720SThomas Huth 'mips_malta' : 120, 38350a998dSThomas Huth 'mipsel_replay' : 480, 394c0a2df8SThomas Huth 'netdev_ethtool' : 180, 40407a6883SThomas Huth 'ppc_40p' : 240, 4188c90719SThomas Huth 'ppc64_hv' : 1000, 42f5ccd7e0SThomas Huth 'ppc64_powernv' : 480, 43f5ccd7e0SThomas Huth 'ppc64_pseries' : 480, 44f5ccd7e0SThomas Huth 'ppc64_tuxrun' : 420, 455e654086SCédric Le Goater 'ppc64_mac99' : 120, 46f5ccd7e0SThomas Huth 'riscv64_tuxrun' : 120, 47f5ccd7e0SThomas Huth 's390x_ccw_virtio' : 420, 4873a383dcSThomas Huth 'sh4_tuxrun' : 240, 490a8b4fd5SThomas Huth 'x86_64_kvm_xen' : 180, 5014973778SThomas Huth} 5114973778SThomas Huth 5214973778SThomas Huthtests_generic_system = [ 53cce85725SThomas Huth 'empty_cpu_model', 54eeba3d73SThomas Huth 'info_usernet', 55eeba3d73SThomas Huth 'version', 56eeba3d73SThomas Huth] 57eeba3d73SThomas Huth 5814973778SThomas Huthtests_generic_linuxuser = [ 5914973778SThomas Huth] 6014973778SThomas Huth 6114973778SThomas Huthtests_generic_bsduser = [ 6214973778SThomas Huth] 6314973778SThomas Huth 64092fd648SThomas Huthtests_aarch64_system_quick = [ 65092fd648SThomas Huth 'migration', 66092fd648SThomas Huth] 67092fd648SThomas Huth 688f16cd80SPhilippe Mathieu-Daudétests_aarch64_system_thorough = [ 69c95309b2SCédric Le Goater 'aarch64_aspeed', 70471f7ff7SPhilippe Mathieu-Daudé 'aarch64_raspi3', 71547738beSPhilippe Mathieu-Daudé 'aarch64_raspi4', 720d77c908SPierrick Bouvier 'aarch64_rme_virt', 730d77c908SPierrick Bouvier 'aarch64_rme_sbsaref', 748f16cd80SPhilippe Mathieu-Daudé 'aarch64_sbsaref', 759acd3884SThomas Huth 'aarch64_sbsaref_alpine', 769acd3884SThomas Huth 'aarch64_sbsaref_freebsd', 77156ee8b8SThomas Huth 'aarch64_tcg_plugins', 7837136902SThomas Huth 'aarch64_tuxrun', 791255f5e4SPhilippe Mathieu-Daudé 'aarch64_virt', 80490d25e6SThomas Huth 'aarch64_xlnx_versal', 8169e4fbd0SThomas Huth 'multiprocess', 828f16cd80SPhilippe Mathieu-Daudé] 838f16cd80SPhilippe Mathieu-Daudé 84092fd648SThomas Huthtests_alpha_system_quick = [ 85092fd648SThomas Huth 'migration', 86092fd648SThomas Huth] 87092fd648SThomas Huth 889a76bc04SThomas Huthtests_alpha_system_thorough = [ 899a76bc04SThomas Huth 'alpha_clipper', 909a76bc04SThomas Huth] 919a76bc04SThomas Huth 92092fd648SThomas Huthtests_arm_system_quick = [ 93092fd648SThomas Huth 'migration', 94092fd648SThomas Huth] 95092fd648SThomas Huth 96e3fc99b1SThomas Huthtests_arm_system_thorough = [ 97e50c7285SCédric Le Goater 'arm_aspeed_ast1030', 98e517cff7SCédric Le Goater 'arm_aspeed_palmetto', 995f2b9738SCédric Le Goater 'arm_aspeed_romulus', 10008743dbaSCédric Le Goater 'arm_aspeed_ast2500', 101c7bc9cabSCédric Le Goater 'arm_aspeed_ast2600', 10238cd5c52SCédric Le Goater 'arm_aspeed_rainier', 103f7d6b772SThomas Huth 'arm_bpim2u', 104e3fc99b1SThomas Huth 'arm_canona1100', 105aff83583SPeter Maydell 'arm_collie', 106d4d183afSThomas Huth 'arm_cubieboard', 107bade2d51SThomas Huth 'arm_emcraft_sf2', 108ef83aea0SPhilippe Mathieu-Daudé 'arm_integratorcp', 109cb5f6ca8SThomas Huth 'arm_microbit', 110380f7268SThomas Huth 'arm_orangepi', 111799d6830SThomas Huth 'arm_quanta_gsj', 112165ab274SPhilippe Mathieu-Daudé 'arm_raspi2', 11381e2926dSThomas Huth 'arm_smdkc210', 114bc4d45b2SPeter Maydell 'arm_sx1', 115c3cff727SThomas Huth 'arm_vexpress', 116a44b318fSThomas Huth 'arm_virt', 117de9f57a6SThomas Huth 'arm_tuxrun', 118e3fc99b1SThomas Huth] 119e3fc99b1SThomas Huth 12034917eadSPhilippe Mathieu-Daudétests_arm_linuxuser_thorough = [ 12134917eadSPhilippe Mathieu-Daudé 'arm_bflt', 12234917eadSPhilippe Mathieu-Daudé] 12334917eadSPhilippe Mathieu-Daudé 1244c0a2df8SThomas Huthtests_avr_system_thorough = [ 1254c0a2df8SThomas Huth 'avr_mega2560', 1264c0a2df8SThomas Huth] 1274c0a2df8SThomas Huth 128e4a407d2SPhilippe Mathieu-Daudétests_hppa_system_quick = [ 129e4a407d2SPhilippe Mathieu-Daudé 'hppa_seabios', 130e4a407d2SPhilippe Mathieu-Daudé] 131e4a407d2SPhilippe Mathieu-Daudé 132092fd648SThomas Huthtests_i386_system_quick = [ 133092fd648SThomas Huth 'migration', 134092fd648SThomas Huth] 135092fd648SThomas Huth 1364007fc94SThomas Huthtests_i386_system_thorough = [ 1374007fc94SThomas Huth 'i386_tuxrun', 1384007fc94SThomas Huth] 1394007fc94SThomas Huth 1404c0a2df8SThomas Huthtests_loongarch64_system_thorough = [ 1414c0a2df8SThomas Huth 'loongarch64_virt', 1424c0a2df8SThomas Huth] 1434c0a2df8SThomas Huth 144576fffbcSThomas Huthtests_m68k_system_thorough = [ 1459f989d65SThomas Huth 'm68k_mcf5208evb', 146c7f3663cSThomas Huth 'm68k_nextcube', 147c7f3663cSThomas Huth 'm68k_q800', 1483356bb83SAlex Bennée 'm68k_tuxrun', 149576fffbcSThomas Huth] 150576fffbcSThomas Huth 151624fb343SThomas Huthtests_microblaze_system_thorough = [ 152624fb343SThomas Huth 'microblaze_s3adsp1800' 153624fb343SThomas Huth] 154624fb343SThomas Huth 155624fb343SThomas Huthtests_microblazeel_system_thorough = [ 156624fb343SThomas Huth 'microblazeel_s3adsp1800' 157624fb343SThomas Huth] 158624fb343SThomas Huth 15979cb4a14SPhilippe Mathieu-Daudétests_mips_system_thorough = [ 16079cb4a14SPhilippe Mathieu-Daudé 'mips_malta', 161*f194f0caSThomas Huth 'mips_replay', 16287cab1aeSThomas Huth 'mips_tuxrun', 16379cb4a14SPhilippe Mathieu-Daudé] 16479cb4a14SPhilippe Mathieu-Daudé 165a4b60becSPhilippe Mathieu-Daudétests_mipsel_system_thorough = [ 166a4b60becSPhilippe Mathieu-Daudé 'mipsel_malta', 167350a998dSThomas Huth 'mipsel_replay', 16855716a89SThomas Huth 'mipsel_tuxrun', 169a4b60becSPhilippe Mathieu-Daudé] 170a4b60becSPhilippe Mathieu-Daudé 171a01be218SThomas Huthtests_mips64_system_thorough = [ 172a01be218SThomas Huth 'mips64_tuxrun', 173a01be218SThomas Huth] 174a01be218SThomas Huth 1754c0a2df8SThomas Huthtests_mips64el_system_thorough = [ 1760d2a8acfSThomas Huth 'mips64el_fuloong2e', 1774c0a2df8SThomas Huth 'mips64el_loongson3v', 178fcf2658bSPhilippe Mathieu-Daudé 'mips64el_malta', 179f348229eSThomas Huth 'mips64el_replay', 180a2a2a5b0SThomas Huth 'mips64el_tuxrun', 1814c0a2df8SThomas Huth] 1824c0a2df8SThomas Huth 1830addb05aSThomas Huthtests_or1k_system_thorough = [ 1843a07875fSThomas Huth 'or1k_sim', 1853a07875fSThomas Huth] 1863a07875fSThomas Huth 1874c0a2df8SThomas Huthtests_ppc_system_quick = [ 188092fd648SThomas Huth 'migration', 1894c0a2df8SThomas Huth 'ppc_74xx', 1904c0a2df8SThomas Huth] 1914c0a2df8SThomas Huth 1924c0a2df8SThomas Huthtests_ppc_system_thorough = [ 1934c0a2df8SThomas Huth 'ppc_405', 194407a6883SThomas Huth 'ppc_40p', 195cef1becbSThomas Huth 'ppc_amiga', 196e3fc99b1SThomas Huth 'ppc_bamboo', 19712c0b407SThomas Huth 'ppc_mac', 198407a6883SThomas Huth 'ppc_mpc8544ds', 1999ca8239aSThomas Huth 'ppc_tuxrun', 200407a6883SThomas Huth 'ppc_virtex_ml507', 201407a6883SThomas Huth] 202407a6883SThomas Huth 203092fd648SThomas Huthtests_ppc64_system_quick = [ 204092fd648SThomas Huth 'migration', 205092fd648SThomas Huth] 206092fd648SThomas Huth 207407a6883SThomas Huthtests_ppc64_system_thorough = [ 20853a62fdeSThomas Huth 'ppc64_e500', 20988c90719SThomas Huth 'ppc64_hv', 210407a6883SThomas Huth 'ppc64_powernv', 211407a6883SThomas Huth 'ppc64_pseries', 212e6a401d7SThomas Huth 'ppc64_tuxrun', 2135e654086SCédric Le Goater 'ppc64_mac99', 214e3fc99b1SThomas Huth] 215e3fc99b1SThomas Huth 2166a564c8aSThomas Huthtests_riscv32_system_quick = [ 217092fd648SThomas Huth 'migration', 2186a564c8aSThomas Huth 'riscv_opensbi', 219d5674412SThomas Huth] 220d5674412SThomas Huth 22177bc76c7SThomas Huthtests_riscv32_system_thorough = [ 22277bc76c7SThomas Huth 'riscv32_tuxrun', 22377bc76c7SThomas Huth] 22477bc76c7SThomas Huth 2256a564c8aSThomas Huthtests_riscv64_system_quick = [ 226092fd648SThomas Huth 'migration', 2276a564c8aSThomas Huth 'riscv_opensbi', 2286a564c8aSThomas Huth] 2296a564c8aSThomas Huth 2307746a6c4SThomas Huthtests_riscv64_system_thorough = [ 2317746a6c4SThomas Huth 'riscv64_tuxrun', 2327746a6c4SThomas Huth] 2337746a6c4SThomas Huth 2346a564c8aSThomas Huthtests_rx_system_thorough = [ 2356a564c8aSThomas Huth 'rx_gdbsim', 2366a564c8aSThomas Huth] 2376a564c8aSThomas Huth 238e2e9fd25SThomas Huthtests_s390x_system_thorough = [ 239e2e9fd25SThomas Huth 's390x_ccw_virtio', 240e2e9fd25SThomas Huth 's390x_topology', 241e6a401d7SThomas Huth 's390x_tuxrun', 242e2e9fd25SThomas Huth] 243e2e9fd25SThomas Huth 244a94bfe1bSThomas Huthtests_sh4_system_thorough = [ 245a94bfe1bSThomas Huth 'sh4_r2d', 246c592ff35SThomas Huth 'sh4_tuxrun', 247a94bfe1bSThomas Huth] 248a94bfe1bSThomas Huth 24962728ddcSThomas Huthtests_sh4eb_system_thorough = [ 25062728ddcSThomas Huth 'sh4eb_r2d', 25162728ddcSThomas Huth] 252c592ff35SThomas Huth 253092fd648SThomas Huthtests_sparc_system_quick = [ 254092fd648SThomas Huth 'migration', 255092fd648SThomas Huth] 256092fd648SThomas Huth 257f90527d3SThomas Huthtests_sparc_system_thorough = [ 258f90527d3SThomas Huth 'sparc_sun4m', 259f90527d3SThomas Huth] 260f90527d3SThomas Huth 261092fd648SThomas Huthtests_sparc64_system_quick = [ 262092fd648SThomas Huth 'migration', 263092fd648SThomas Huth] 264092fd648SThomas Huth 265e3fc99b1SThomas Huthtests_sparc64_system_thorough = [ 266e3fc99b1SThomas Huth 'sparc64_sun4u', 267116667aaSThomas Huth 'sparc64_tuxrun', 2684c0a2df8SThomas Huth] 2694c0a2df8SThomas Huth 27014973778SThomas Huthtests_x86_64_system_quick = [ 271cce85725SThomas Huth 'cpu_queries', 272cce85725SThomas Huth 'mem_addr_space', 273092fd648SThomas Huth 'migration', 274cce85725SThomas Huth 'pc_cpu_hotplug_props', 275cce85725SThomas Huth 'virtio_version', 276be849ef7SThomas Huth 'x86_cpu_model_versions', 277c82bfaf4SThomas Huth 'vnc', 27814973778SThomas Huth] 27914973778SThomas Huth 28014973778SThomas Huthtests_x86_64_system_thorough = [ 28105caa062SThomas Huth 'acpi_bits', 282270d4a51SThomas Huth 'intel_iommu', 2838dcac1cfSThomas Huth 'linux_initrd', 28469e4fbd0SThomas Huth 'multiprocess', 2854c0a2df8SThomas Huth 'netdev_ethtool', 286239d08aaSThomas Huth 'virtio_gpu', 287bf850896SThomas Huth 'x86_64_hotplug_cpu', 2880a8b4fd5SThomas Huth 'x86_64_kvm_xen', 289270d4a51SThomas Huth 'x86_64_tuxrun', 29014973778SThomas Huth] 29114973778SThomas Huth 292d1939097SThomas Huthtests_xtensa_system_thorough = [ 293d1939097SThomas Huth 'xtensa_lx60', 294d1939097SThomas Huth] 295d1939097SThomas Huth 296f57213f8SDaniel P. Berrangéprecache_all = [] 29714973778SThomas Huthforeach speed : ['quick', 'thorough'] 29814973778SThomas Huth foreach dir : target_dirs 29914973778SThomas Huth 30014973778SThomas Huth target_base = dir.split('-')[0] 30114973778SThomas Huth 30214973778SThomas Huth if dir.endswith('-softmmu') 30314973778SThomas Huth sysmode = 'system' 30414973778SThomas Huth test_emulator = emulators['qemu-system-' + target_base] 30514973778SThomas Huth elif dir.endswith('-linux-user') 30614973778SThomas Huth sysmode = 'linuxuser' 30714973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 30814973778SThomas Huth elif dir.endswith('-bsd-user') 30914973778SThomas Huth sysmode = 'bsduser' 31014973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 31114973778SThomas Huth else 31214973778SThomas Huth continue 31314973778SThomas Huth endif 31414973778SThomas Huth 31514973778SThomas Huth if speed == 'quick' 31614973778SThomas Huth suites = ['func-quick', 'func-' + target_base] 31714973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \ 31814973778SThomas Huth + get_variable('tests_generic_' + sysmode) 31914973778SThomas Huth else 32014973778SThomas Huth suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed] 32114973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, []) 32214973778SThomas Huth endif 32314973778SThomas Huth 32414973778SThomas Huth test_deps = roms 32514973778SThomas Huth test_env = environment() 32614973778SThomas Huth if have_tools 32714973778SThomas Huth test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img') 32814973778SThomas Huth test_deps += [qemu_img] 32914973778SThomas Huth endif 33014973778SThomas Huth test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path()) 33114973778SThomas Huth test_env.set('QEMU_BUILD_ROOT', meson.project_build_root()) 33214973778SThomas Huth test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 33314973778SThomas Huth meson.current_source_dir()) 33414973778SThomas Huth 33514973778SThomas Huth foreach test : target_tests 336f57213f8SDaniel P. Berrangé testname = '@0@-@1@'.format(target_base, test) 337f57213f8SDaniel P. Berrangé testfile = 'test_' + test + '.py' 338f57213f8SDaniel P. Berrangé testpath = meson.current_source_dir() / testfile 339f57213f8SDaniel P. Berrangé teststamp = testname + '.tstamp' 340f57213f8SDaniel P. Berrangé test_precache_env = environment() 341f57213f8SDaniel P. Berrangé test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp) 342f57213f8SDaniel P. Berrangé test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 343f57213f8SDaniel P. Berrangé meson.current_source_dir()) 344f57213f8SDaniel P. Berrangé precache = custom_target('func-precache-' + testname, 345f57213f8SDaniel P. Berrangé output: teststamp, 346f57213f8SDaniel P. Berrangé command: [python, testpath], 347f57213f8SDaniel P. Berrangé depend_files: files(testpath), 348f57213f8SDaniel P. Berrangé build_by_default: false, 349f57213f8SDaniel P. Berrangé env: test_precache_env) 350f57213f8SDaniel P. Berrangé precache_all += precache 351f57213f8SDaniel P. Berrangé 352f57213f8SDaniel P. Berrangé # Ideally we would add 'precache' to 'depends' here, such that 353f57213f8SDaniel P. Berrangé # 'build_by_default: false' lets the pre-caching automatically 354f57213f8SDaniel P. Berrangé # run immediately before the test runs. In practice this is 355f57213f8SDaniel P. Berrangé # broken in meson, with it running the pre-caching in the normal 356f57213f8SDaniel P. Berrangé # compile phase https://github.com/mesonbuild/meson/issues/2518 357f57213f8SDaniel P. Berrangé # If the above bug ever gets fixed, when QEMU changes the min 358f57213f8SDaniel P. Berrangé # meson version, add the 'depends' and remove the custom 359f57213f8SDaniel P. Berrangé # 'run_target' logic below & in Makefile.include 360f57213f8SDaniel P. Berrangé test('func-' + testname, 36114973778SThomas Huth python, 36214973778SThomas Huth depends: [test_deps, test_emulator, emulator_modules], 36314973778SThomas Huth env: test_env, 364f57213f8SDaniel P. Berrangé args: [testpath], 36514973778SThomas Huth protocol: 'tap', 366f5ccd7e0SThomas Huth timeout: test_timeouts.get(test, 90), 367f5ccd7e0SThomas Huth priority: test_timeouts.get(test, 90), 36814973778SThomas Huth suite: suites) 36914973778SThomas Huth endforeach 37014973778SThomas Huth endforeach 37114973778SThomas Huthendforeach 372f57213f8SDaniel P. Berrangé 373f57213f8SDaniel P. Berrangérun_target('precache-functional', 374f57213f8SDaniel P. Berrangé depends: precache_all, 375f57213f8SDaniel P. Berrangé command: ['true']) 376