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, 18fe95724dSPeter Maydell 'aarch64_sbsaref_alpine' : 1200, 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, 25fe95724dSPeter Maydell 'arm_aspeed_ast2500' : 720, 26fe95724dSPeter Maydell 'arm_aspeed_ast2600' : 1200, 27fe95724dSPeter Maydell 'arm_aspeed_rainier' : 480, 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, 39*a31001b1SThomas Huth 'mips64el_replay' : 180, 404c0a2df8SThomas Huth 'netdev_ethtool' : 180, 41407a6883SThomas Huth 'ppc_40p' : 240, 4288c90719SThomas Huth 'ppc64_hv' : 1000, 43f5ccd7e0SThomas Huth 'ppc64_powernv' : 480, 44f5ccd7e0SThomas Huth 'ppc64_pseries' : 480, 45221620b7SThomas Huth 'ppc64_replay' : 210, 46f5ccd7e0SThomas Huth 'ppc64_tuxrun' : 420, 475e654086SCédric Le Goater 'ppc64_mac99' : 120, 48f5ccd7e0SThomas Huth 'riscv64_tuxrun' : 120, 49f5ccd7e0SThomas Huth 's390x_ccw_virtio' : 420, 5073a383dcSThomas Huth 'sh4_tuxrun' : 240, 511456e906SDaniel P. Berrangé 'virtio_balloon': 120, 520a8b4fd5SThomas Huth 'x86_64_kvm_xen' : 180, 530f31f0f5SThomas Huth 'x86_64_replay' : 480, 5414973778SThomas Huth} 5514973778SThomas Huth 5614973778SThomas Huthtests_generic_system = [ 57cce85725SThomas Huth 'empty_cpu_model', 58eeba3d73SThomas Huth 'info_usernet', 59eeba3d73SThomas Huth 'version', 60eeba3d73SThomas Huth] 61eeba3d73SThomas Huth 6214973778SThomas Huthtests_generic_linuxuser = [ 6314973778SThomas Huth] 6414973778SThomas Huth 6514973778SThomas Huthtests_generic_bsduser = [ 6614973778SThomas Huth] 6714973778SThomas Huth 68092fd648SThomas Huthtests_aarch64_system_quick = [ 69092fd648SThomas Huth 'migration', 70092fd648SThomas Huth] 71092fd648SThomas Huth 728f16cd80SPhilippe Mathieu-Daudétests_aarch64_system_thorough = [ 73c95309b2SCédric Le Goater 'aarch64_aspeed', 74471f7ff7SPhilippe Mathieu-Daudé 'aarch64_raspi3', 75547738beSPhilippe Mathieu-Daudé 'aarch64_raspi4', 764d75a374SThomas Huth 'aarch64_replay', 770d77c908SPierrick Bouvier 'aarch64_rme_virt', 780d77c908SPierrick Bouvier 'aarch64_rme_sbsaref', 798f16cd80SPhilippe Mathieu-Daudé 'aarch64_sbsaref', 809acd3884SThomas Huth 'aarch64_sbsaref_alpine', 819acd3884SThomas Huth 'aarch64_sbsaref_freebsd', 82156ee8b8SThomas Huth 'aarch64_tcg_plugins', 8337136902SThomas Huth 'aarch64_tuxrun', 841255f5e4SPhilippe Mathieu-Daudé 'aarch64_virt', 8501466041SThomas Huth 'aarch64_xen', 86490d25e6SThomas Huth 'aarch64_xlnx_versal', 8769e4fbd0SThomas Huth 'multiprocess', 888f16cd80SPhilippe Mathieu-Daudé] 898f16cd80SPhilippe Mathieu-Daudé 90092fd648SThomas Huthtests_alpha_system_quick = [ 91092fd648SThomas Huth 'migration', 92092fd648SThomas Huth] 93092fd648SThomas Huth 949a76bc04SThomas Huthtests_alpha_system_thorough = [ 959a76bc04SThomas Huth 'alpha_clipper', 9674728629SThomas Huth 'alpha_replay', 979a76bc04SThomas Huth] 989a76bc04SThomas Huth 99092fd648SThomas Huthtests_arm_system_quick = [ 100092fd648SThomas Huth 'migration', 101092fd648SThomas Huth] 102092fd648SThomas Huth 103e3fc99b1SThomas Huthtests_arm_system_thorough = [ 104e50c7285SCédric Le Goater 'arm_aspeed_ast1030', 105e517cff7SCédric Le Goater 'arm_aspeed_palmetto', 1065f2b9738SCédric Le Goater 'arm_aspeed_romulus', 10708743dbaSCédric Le Goater 'arm_aspeed_ast2500', 108c7bc9cabSCédric Le Goater 'arm_aspeed_ast2600', 10938cd5c52SCédric Le Goater 'arm_aspeed_rainier', 110f7d6b772SThomas Huth 'arm_bpim2u', 111e3fc99b1SThomas Huth 'arm_canona1100', 112aff83583SPeter Maydell 'arm_collie', 113d4d183afSThomas Huth 'arm_cubieboard', 114bade2d51SThomas Huth 'arm_emcraft_sf2', 115ef83aea0SPhilippe Mathieu-Daudé 'arm_integratorcp', 116cb5f6ca8SThomas Huth 'arm_microbit', 117380f7268SThomas Huth 'arm_orangepi', 118799d6830SThomas Huth 'arm_quanta_gsj', 119165ab274SPhilippe Mathieu-Daudé 'arm_raspi2', 1208a145225SThomas Huth 'arm_replay', 12181e2926dSThomas Huth 'arm_smdkc210', 122bc4d45b2SPeter Maydell 'arm_sx1', 123c3cff727SThomas Huth 'arm_vexpress', 124a44b318fSThomas Huth 'arm_virt', 125de9f57a6SThomas Huth 'arm_tuxrun', 126e3fc99b1SThomas Huth] 127e3fc99b1SThomas Huth 12834917eadSPhilippe Mathieu-Daudétests_arm_linuxuser_thorough = [ 12934917eadSPhilippe Mathieu-Daudé 'arm_bflt', 13034917eadSPhilippe Mathieu-Daudé] 13134917eadSPhilippe Mathieu-Daudé 1324c0a2df8SThomas Huthtests_avr_system_thorough = [ 1334c0a2df8SThomas Huth 'avr_mega2560', 1344c0a2df8SThomas Huth] 1354c0a2df8SThomas Huth 136e4a407d2SPhilippe Mathieu-Daudétests_hppa_system_quick = [ 137e4a407d2SPhilippe Mathieu-Daudé 'hppa_seabios', 138e4a407d2SPhilippe Mathieu-Daudé] 139e4a407d2SPhilippe Mathieu-Daudé 140092fd648SThomas Huthtests_i386_system_quick = [ 141092fd648SThomas Huth 'migration', 142092fd648SThomas Huth] 143092fd648SThomas Huth 1444007fc94SThomas Huthtests_i386_system_thorough = [ 1454007fc94SThomas Huth 'i386_tuxrun', 1464007fc94SThomas Huth] 1474007fc94SThomas Huth 1484c0a2df8SThomas Huthtests_loongarch64_system_thorough = [ 1494c0a2df8SThomas Huth 'loongarch64_virt', 1504c0a2df8SThomas Huth] 1514c0a2df8SThomas Huth 152576fffbcSThomas Huthtests_m68k_system_thorough = [ 1539f989d65SThomas Huth 'm68k_mcf5208evb', 154c7f3663cSThomas Huth 'm68k_nextcube', 155ec971d85SThomas Huth 'm68k_replay', 156c7f3663cSThomas Huth 'm68k_q800', 1573356bb83SAlex Bennée 'm68k_tuxrun', 158576fffbcSThomas Huth] 159576fffbcSThomas Huth 160624fb343SThomas Huthtests_microblaze_system_thorough = [ 1616674fa9cSThomas Huth 'microblaze_replay', 162624fb343SThomas Huth 'microblaze_s3adsp1800' 163624fb343SThomas Huth] 164624fb343SThomas Huth 165624fb343SThomas Huthtests_microblazeel_system_thorough = [ 166624fb343SThomas Huth 'microblazeel_s3adsp1800' 167624fb343SThomas Huth] 168624fb343SThomas Huth 16979cb4a14SPhilippe Mathieu-Daudétests_mips_system_thorough = [ 17079cb4a14SPhilippe Mathieu-Daudé 'mips_malta', 171f194f0caSThomas Huth 'mips_replay', 17287cab1aeSThomas Huth 'mips_tuxrun', 17379cb4a14SPhilippe Mathieu-Daudé] 17479cb4a14SPhilippe Mathieu-Daudé 175a4b60becSPhilippe Mathieu-Daudétests_mipsel_system_thorough = [ 176a4b60becSPhilippe Mathieu-Daudé 'mipsel_malta', 177350a998dSThomas Huth 'mipsel_replay', 17855716a89SThomas Huth 'mipsel_tuxrun', 179a4b60becSPhilippe Mathieu-Daudé] 180a4b60becSPhilippe Mathieu-Daudé 181a01be218SThomas Huthtests_mips64_system_thorough = [ 182a01be218SThomas Huth 'mips64_tuxrun', 183a01be218SThomas Huth] 184a01be218SThomas Huth 1854c0a2df8SThomas Huthtests_mips64el_system_thorough = [ 1860d2a8acfSThomas Huth 'mips64el_fuloong2e', 1874c0a2df8SThomas Huth 'mips64el_loongson3v', 188fcf2658bSPhilippe Mathieu-Daudé 'mips64el_malta', 189f348229eSThomas Huth 'mips64el_replay', 190a2a2a5b0SThomas Huth 'mips64el_tuxrun', 1914c0a2df8SThomas Huth] 1924c0a2df8SThomas Huth 1930addb05aSThomas Huthtests_or1k_system_thorough = [ 19452ec5f51SThomas Huth 'or1k_replay', 1953a07875fSThomas Huth 'or1k_sim', 1963a07875fSThomas Huth] 1973a07875fSThomas Huth 1984c0a2df8SThomas Huthtests_ppc_system_quick = [ 199092fd648SThomas Huth 'migration', 2004c0a2df8SThomas Huth 'ppc_74xx', 2014c0a2df8SThomas Huth] 2024c0a2df8SThomas Huth 2034c0a2df8SThomas Huthtests_ppc_system_thorough = [ 2044c0a2df8SThomas Huth 'ppc_405', 205407a6883SThomas Huth 'ppc_40p', 206cef1becbSThomas Huth 'ppc_amiga', 207e3fc99b1SThomas Huth 'ppc_bamboo', 20812c0b407SThomas Huth 'ppc_mac', 209407a6883SThomas Huth 'ppc_mpc8544ds', 2109917e06cSThomas Huth 'ppc_replay', 21155727771SCédric Le Goater 'ppc_sam460ex', 2129ca8239aSThomas Huth 'ppc_tuxrun', 213407a6883SThomas Huth 'ppc_virtex_ml507', 214407a6883SThomas Huth] 215407a6883SThomas Huth 216092fd648SThomas Huthtests_ppc64_system_quick = [ 217092fd648SThomas Huth 'migration', 218092fd648SThomas Huth] 219092fd648SThomas Huth 220407a6883SThomas Huthtests_ppc64_system_thorough = [ 22153a62fdeSThomas Huth 'ppc64_e500', 22288c90719SThomas Huth 'ppc64_hv', 223407a6883SThomas Huth 'ppc64_powernv', 224407a6883SThomas Huth 'ppc64_pseries', 225221620b7SThomas Huth 'ppc64_replay', 226e6a401d7SThomas Huth 'ppc64_tuxrun', 2275e654086SCédric Le Goater 'ppc64_mac99', 228e3fc99b1SThomas Huth] 229e3fc99b1SThomas Huth 2306a564c8aSThomas Huthtests_riscv32_system_quick = [ 231092fd648SThomas Huth 'migration', 2326a564c8aSThomas Huth 'riscv_opensbi', 233d5674412SThomas Huth] 234d5674412SThomas Huth 23577bc76c7SThomas Huthtests_riscv32_system_thorough = [ 23677bc76c7SThomas Huth 'riscv32_tuxrun', 23777bc76c7SThomas Huth] 23877bc76c7SThomas Huth 2396a564c8aSThomas Huthtests_riscv64_system_quick = [ 240092fd648SThomas Huth 'migration', 2416a564c8aSThomas Huth 'riscv_opensbi', 2426a564c8aSThomas Huth] 2436a564c8aSThomas Huth 2447746a6c4SThomas Huthtests_riscv64_system_thorough = [ 2457746a6c4SThomas Huth 'riscv64_tuxrun', 2467746a6c4SThomas Huth] 2477746a6c4SThomas Huth 2486a564c8aSThomas Huthtests_rx_system_thorough = [ 2496a564c8aSThomas Huth 'rx_gdbsim', 2506a564c8aSThomas Huth] 2516a564c8aSThomas Huth 252e2e9fd25SThomas Huthtests_s390x_system_thorough = [ 253e2e9fd25SThomas Huth 's390x_ccw_virtio', 25450424852SThomas Huth 's390x_replay', 255e2e9fd25SThomas Huth 's390x_topology', 256e6a401d7SThomas Huth 's390x_tuxrun', 257e2e9fd25SThomas Huth] 258e2e9fd25SThomas Huth 259a94bfe1bSThomas Huthtests_sh4_system_thorough = [ 260a94bfe1bSThomas Huth 'sh4_r2d', 261c592ff35SThomas Huth 'sh4_tuxrun', 262a94bfe1bSThomas Huth] 263a94bfe1bSThomas Huth 26462728ddcSThomas Huthtests_sh4eb_system_thorough = [ 26562728ddcSThomas Huth 'sh4eb_r2d', 26662728ddcSThomas Huth] 267c592ff35SThomas Huth 268092fd648SThomas Huthtests_sparc_system_quick = [ 269092fd648SThomas Huth 'migration', 270092fd648SThomas Huth] 271092fd648SThomas Huth 272f90527d3SThomas Huthtests_sparc_system_thorough = [ 273a14dfd93SThomas Huth 'sparc_replay', 274f90527d3SThomas Huth 'sparc_sun4m', 275f90527d3SThomas Huth] 276f90527d3SThomas Huth 277092fd648SThomas Huthtests_sparc64_system_quick = [ 278092fd648SThomas Huth 'migration', 279092fd648SThomas Huth] 280092fd648SThomas Huth 281e3fc99b1SThomas Huthtests_sparc64_system_thorough = [ 282e3fc99b1SThomas Huth 'sparc64_sun4u', 283116667aaSThomas Huth 'sparc64_tuxrun', 2844c0a2df8SThomas Huth] 2854c0a2df8SThomas Huth 28614973778SThomas Huthtests_x86_64_system_quick = [ 287cce85725SThomas Huth 'cpu_queries', 288cce85725SThomas Huth 'mem_addr_space', 289092fd648SThomas Huth 'migration', 290cce85725SThomas Huth 'pc_cpu_hotplug_props', 291cce85725SThomas Huth 'virtio_version', 292be849ef7SThomas Huth 'x86_cpu_model_versions', 293c82bfaf4SThomas Huth 'vnc', 29414973778SThomas Huth] 29514973778SThomas Huth 29614973778SThomas Huthtests_x86_64_system_thorough = [ 29705caa062SThomas Huth 'acpi_bits', 298270d4a51SThomas Huth 'intel_iommu', 2998dcac1cfSThomas Huth 'linux_initrd', 30069e4fbd0SThomas Huth 'multiprocess', 3014c0a2df8SThomas Huth 'netdev_ethtool', 3021456e906SDaniel P. Berrangé 'virtio_balloon', 303239d08aaSThomas Huth 'virtio_gpu', 3045f6a260fSThomas Huth 'x86_64_hotplug_blk', 305bf850896SThomas Huth 'x86_64_hotplug_cpu', 3060a8b4fd5SThomas Huth 'x86_64_kvm_xen', 3070f31f0f5SThomas Huth 'x86_64_replay', 308270d4a51SThomas Huth 'x86_64_tuxrun', 30914973778SThomas Huth] 31014973778SThomas Huth 311d1939097SThomas Huthtests_xtensa_system_thorough = [ 312d1939097SThomas Huth 'xtensa_lx60', 3136e52e84dSThomas Huth 'xtensa_replay', 314d1939097SThomas Huth] 315d1939097SThomas Huth 316f57213f8SDaniel P. Berrangéprecache_all = [] 31714973778SThomas Huthforeach speed : ['quick', 'thorough'] 31814973778SThomas Huth foreach dir : target_dirs 31914973778SThomas Huth 32014973778SThomas Huth target_base = dir.split('-')[0] 32114973778SThomas Huth 32214973778SThomas Huth if dir.endswith('-softmmu') 32314973778SThomas Huth sysmode = 'system' 32414973778SThomas Huth test_emulator = emulators['qemu-system-' + target_base] 32514973778SThomas Huth elif dir.endswith('-linux-user') 32614973778SThomas Huth sysmode = 'linuxuser' 32714973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 32814973778SThomas Huth elif dir.endswith('-bsd-user') 32914973778SThomas Huth sysmode = 'bsduser' 33014973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 33114973778SThomas Huth else 33214973778SThomas Huth continue 33314973778SThomas Huth endif 33414973778SThomas Huth 33514973778SThomas Huth if speed == 'quick' 33614973778SThomas Huth suites = ['func-quick', 'func-' + target_base] 33714973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \ 33814973778SThomas Huth + get_variable('tests_generic_' + sysmode) 33914973778SThomas Huth else 34014973778SThomas Huth suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed] 34114973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, []) 34214973778SThomas Huth endif 34314973778SThomas Huth 34414973778SThomas Huth test_deps = roms 34514973778SThomas Huth test_env = environment() 34614973778SThomas Huth if have_tools 34714973778SThomas Huth test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img') 34814973778SThomas Huth test_deps += [qemu_img] 34914973778SThomas Huth endif 35014973778SThomas Huth test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path()) 35114973778SThomas Huth test_env.set('QEMU_BUILD_ROOT', meson.project_build_root()) 35214973778SThomas Huth test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 35314973778SThomas Huth meson.current_source_dir()) 35414973778SThomas Huth 35514973778SThomas Huth foreach test : target_tests 356f57213f8SDaniel P. Berrangé testname = '@0@-@1@'.format(target_base, test) 357f57213f8SDaniel P. Berrangé testfile = 'test_' + test + '.py' 358f57213f8SDaniel P. Berrangé testpath = meson.current_source_dir() / testfile 359f57213f8SDaniel P. Berrangé teststamp = testname + '.tstamp' 360f57213f8SDaniel P. Berrangé test_precache_env = environment() 361f57213f8SDaniel P. Berrangé test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp) 362f57213f8SDaniel P. Berrangé test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 363f57213f8SDaniel P. Berrangé meson.current_source_dir()) 364f57213f8SDaniel P. Berrangé precache = custom_target('func-precache-' + testname, 365f57213f8SDaniel P. Berrangé output: teststamp, 366f57213f8SDaniel P. Berrangé command: [python, testpath], 367f57213f8SDaniel P. Berrangé depend_files: files(testpath), 368f57213f8SDaniel P. Berrangé build_by_default: false, 369f57213f8SDaniel P. Berrangé env: test_precache_env) 370f57213f8SDaniel P. Berrangé precache_all += precache 371f57213f8SDaniel P. Berrangé 372f57213f8SDaniel P. Berrangé # Ideally we would add 'precache' to 'depends' here, such that 373f57213f8SDaniel P. Berrangé # 'build_by_default: false' lets the pre-caching automatically 374f57213f8SDaniel P. Berrangé # run immediately before the test runs. In practice this is 375f57213f8SDaniel P. Berrangé # broken in meson, with it running the pre-caching in the normal 376f57213f8SDaniel P. Berrangé # compile phase https://github.com/mesonbuild/meson/issues/2518 377f57213f8SDaniel P. Berrangé # If the above bug ever gets fixed, when QEMU changes the min 378f57213f8SDaniel P. Berrangé # meson version, add the 'depends' and remove the custom 379f57213f8SDaniel P. Berrangé # 'run_target' logic below & in Makefile.include 380f57213f8SDaniel P. Berrangé test('func-' + testname, 38114973778SThomas Huth python, 38214973778SThomas Huth depends: [test_deps, test_emulator, emulator_modules], 38314973778SThomas Huth env: test_env, 384f57213f8SDaniel P. Berrangé args: [testpath], 38514973778SThomas Huth protocol: 'tap', 386f5ccd7e0SThomas Huth timeout: test_timeouts.get(test, 90), 387f5ccd7e0SThomas Huth priority: test_timeouts.get(test, 90), 38814973778SThomas Huth suite: suites) 38914973778SThomas Huth endforeach 39014973778SThomas Huth endforeach 39114973778SThomas Huthendforeach 392f57213f8SDaniel P. Berrangé 393f57213f8SDaniel P. Berrangérun_target('precache-functional', 394f57213f8SDaniel P. Berrangé depends: precache_all, 395f57213f8SDaniel P. Berrangé command: ['true']) 396