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, 384c0a2df8SThomas Huth 'netdev_ethtool' : 180, 39407a6883SThomas Huth 'ppc_40p' : 240, 4088c90719SThomas Huth 'ppc64_hv' : 1000, 41f5ccd7e0SThomas Huth 'ppc64_powernv' : 480, 42f5ccd7e0SThomas Huth 'ppc64_pseries' : 480, 43f5ccd7e0SThomas Huth 'ppc64_tuxrun' : 420, 44f5ccd7e0SThomas Huth 'riscv64_tuxrun' : 120, 45f5ccd7e0SThomas Huth 's390x_ccw_virtio' : 420, 4673a383dcSThomas Huth 'sh4_tuxrun' : 240, 470a8b4fd5SThomas Huth 'x86_64_kvm_xen' : 180, 4814973778SThomas Huth} 4914973778SThomas Huth 5014973778SThomas Huthtests_generic_system = [ 51cce85725SThomas Huth 'empty_cpu_model', 52eeba3d73SThomas Huth 'info_usernet', 53eeba3d73SThomas Huth 'version', 54eeba3d73SThomas Huth] 55eeba3d73SThomas Huth 5614973778SThomas Huthtests_generic_linuxuser = [ 5714973778SThomas Huth] 5814973778SThomas Huth 5914973778SThomas Huthtests_generic_bsduser = [ 6014973778SThomas Huth] 6114973778SThomas Huth 62092fd648SThomas Huthtests_aarch64_system_quick = [ 63092fd648SThomas Huth 'migration', 64092fd648SThomas Huth] 65092fd648SThomas Huth 668f16cd80SPhilippe Mathieu-Daudétests_aarch64_system_thorough = [ 67c95309b2SCédric Le Goater 'aarch64_aspeed', 68471f7ff7SPhilippe Mathieu-Daudé 'aarch64_raspi3', 69547738beSPhilippe Mathieu-Daudé 'aarch64_raspi4', 700d77c908SPierrick Bouvier 'aarch64_rme_virt', 710d77c908SPierrick Bouvier 'aarch64_rme_sbsaref', 728f16cd80SPhilippe Mathieu-Daudé 'aarch64_sbsaref', 739acd3884SThomas Huth 'aarch64_sbsaref_alpine', 749acd3884SThomas Huth 'aarch64_sbsaref_freebsd', 75*156ee8b8SThomas Huth 'aarch64_tcg_plugins', 7637136902SThomas Huth 'aarch64_tuxrun', 771255f5e4SPhilippe Mathieu-Daudé 'aarch64_virt', 78490d25e6SThomas Huth 'aarch64_xlnx_versal', 7969e4fbd0SThomas Huth 'multiprocess', 808f16cd80SPhilippe Mathieu-Daudé] 818f16cd80SPhilippe Mathieu-Daudé 82092fd648SThomas Huthtests_alpha_system_quick = [ 83092fd648SThomas Huth 'migration', 84092fd648SThomas Huth] 85092fd648SThomas Huth 869a76bc04SThomas Huthtests_alpha_system_thorough = [ 879a76bc04SThomas Huth 'alpha_clipper', 889a76bc04SThomas Huth] 899a76bc04SThomas Huth 90092fd648SThomas Huthtests_arm_system_quick = [ 91092fd648SThomas Huth 'migration', 92092fd648SThomas Huth] 93092fd648SThomas Huth 94e3fc99b1SThomas Huthtests_arm_system_thorough = [ 95e50c7285SCédric Le Goater 'arm_aspeed_ast1030', 96e517cff7SCédric Le Goater 'arm_aspeed_palmetto', 975f2b9738SCédric Le Goater 'arm_aspeed_romulus', 9808743dbaSCédric Le Goater 'arm_aspeed_ast2500', 99c7bc9cabSCédric Le Goater 'arm_aspeed_ast2600', 10038cd5c52SCédric Le Goater 'arm_aspeed_rainier', 101f7d6b772SThomas Huth 'arm_bpim2u', 102e3fc99b1SThomas Huth 'arm_canona1100', 103aff83583SPeter Maydell 'arm_collie', 104d4d183afSThomas Huth 'arm_cubieboard', 105bade2d51SThomas Huth 'arm_emcraft_sf2', 106ef83aea0SPhilippe Mathieu-Daudé 'arm_integratorcp', 107cb5f6ca8SThomas Huth 'arm_microbit', 108380f7268SThomas Huth 'arm_orangepi', 109799d6830SThomas Huth 'arm_quanta_gsj', 110165ab274SPhilippe Mathieu-Daudé 'arm_raspi2', 11181e2926dSThomas Huth 'arm_smdkc210', 112bc4d45b2SPeter Maydell 'arm_sx1', 113c3cff727SThomas Huth 'arm_vexpress', 114a44b318fSThomas Huth 'arm_virt', 115de9f57a6SThomas Huth 'arm_tuxrun', 116e3fc99b1SThomas Huth] 117e3fc99b1SThomas Huth 11834917eadSPhilippe Mathieu-Daudétests_arm_linuxuser_thorough = [ 11934917eadSPhilippe Mathieu-Daudé 'arm_bflt', 12034917eadSPhilippe Mathieu-Daudé] 12134917eadSPhilippe Mathieu-Daudé 1224c0a2df8SThomas Huthtests_avr_system_thorough = [ 1234c0a2df8SThomas Huth 'avr_mega2560', 1244c0a2df8SThomas Huth] 1254c0a2df8SThomas Huth 126e4a407d2SPhilippe Mathieu-Daudétests_hppa_system_quick = [ 127e4a407d2SPhilippe Mathieu-Daudé 'hppa_seabios', 128e4a407d2SPhilippe Mathieu-Daudé] 129e4a407d2SPhilippe Mathieu-Daudé 130092fd648SThomas Huthtests_i386_system_quick = [ 131092fd648SThomas Huth 'migration', 132092fd648SThomas Huth] 133092fd648SThomas Huth 1344007fc94SThomas Huthtests_i386_system_thorough = [ 1354007fc94SThomas Huth 'i386_tuxrun', 1364007fc94SThomas Huth] 1374007fc94SThomas Huth 1384c0a2df8SThomas Huthtests_loongarch64_system_thorough = [ 1394c0a2df8SThomas Huth 'loongarch64_virt', 1404c0a2df8SThomas Huth] 1414c0a2df8SThomas Huth 142576fffbcSThomas Huthtests_m68k_system_thorough = [ 1439f989d65SThomas Huth 'm68k_mcf5208evb', 144c7f3663cSThomas Huth 'm68k_nextcube', 145c7f3663cSThomas Huth 'm68k_q800', 1463356bb83SAlex Bennée 'm68k_tuxrun', 147576fffbcSThomas Huth] 148576fffbcSThomas Huth 149624fb343SThomas Huthtests_microblaze_system_thorough = [ 150624fb343SThomas Huth 'microblaze_s3adsp1800' 151624fb343SThomas Huth] 152624fb343SThomas Huth 153624fb343SThomas Huthtests_microblazeel_system_thorough = [ 154624fb343SThomas Huth 'microblazeel_s3adsp1800' 155624fb343SThomas Huth] 156624fb343SThomas Huth 15779cb4a14SPhilippe Mathieu-Daudétests_mips_system_thorough = [ 15879cb4a14SPhilippe Mathieu-Daudé 'mips_malta', 15987cab1aeSThomas Huth 'mips_tuxrun', 16079cb4a14SPhilippe Mathieu-Daudé] 16179cb4a14SPhilippe Mathieu-Daudé 162a4b60becSPhilippe Mathieu-Daudétests_mipsel_system_thorough = [ 163a4b60becSPhilippe Mathieu-Daudé 'mipsel_malta', 16455716a89SThomas Huth 'mipsel_tuxrun', 165a4b60becSPhilippe Mathieu-Daudé] 166a4b60becSPhilippe Mathieu-Daudé 167a01be218SThomas Huthtests_mips64_system_thorough = [ 168a01be218SThomas Huth 'mips64_tuxrun', 169a01be218SThomas Huth] 170a01be218SThomas Huth 1714c0a2df8SThomas Huthtests_mips64el_system_thorough = [ 1720d2a8acfSThomas Huth 'mips64el_fuloong2e', 1734c0a2df8SThomas Huth 'mips64el_loongson3v', 174fcf2658bSPhilippe Mathieu-Daudé 'mips64el_malta', 175a2a2a5b0SThomas Huth 'mips64el_tuxrun', 1764c0a2df8SThomas Huth] 1774c0a2df8SThomas Huth 1780addb05aSThomas Huthtests_or1k_system_thorough = [ 1793a07875fSThomas Huth 'or1k_sim', 1803a07875fSThomas Huth] 1813a07875fSThomas Huth 1824c0a2df8SThomas Huthtests_ppc_system_quick = [ 183092fd648SThomas Huth 'migration', 1844c0a2df8SThomas Huth 'ppc_74xx', 1854c0a2df8SThomas Huth] 1864c0a2df8SThomas Huth 1874c0a2df8SThomas Huthtests_ppc_system_thorough = [ 1884c0a2df8SThomas Huth 'ppc_405', 189407a6883SThomas Huth 'ppc_40p', 190cef1becbSThomas Huth 'ppc_amiga', 191e3fc99b1SThomas Huth 'ppc_bamboo', 19212c0b407SThomas Huth 'ppc_mac', 193407a6883SThomas Huth 'ppc_mpc8544ds', 1949ca8239aSThomas Huth 'ppc_tuxrun', 195407a6883SThomas Huth 'ppc_virtex_ml507', 196407a6883SThomas Huth] 197407a6883SThomas Huth 198092fd648SThomas Huthtests_ppc64_system_quick = [ 199092fd648SThomas Huth 'migration', 200092fd648SThomas Huth] 201092fd648SThomas Huth 202407a6883SThomas Huthtests_ppc64_system_thorough = [ 20353a62fdeSThomas Huth 'ppc64_e500', 20488c90719SThomas Huth 'ppc64_hv', 205407a6883SThomas Huth 'ppc64_powernv', 206407a6883SThomas Huth 'ppc64_pseries', 207e6a401d7SThomas Huth 'ppc64_tuxrun', 208e3fc99b1SThomas Huth] 209e3fc99b1SThomas Huth 2106a564c8aSThomas Huthtests_riscv32_system_quick = [ 211092fd648SThomas Huth 'migration', 2126a564c8aSThomas Huth 'riscv_opensbi', 213d5674412SThomas Huth] 214d5674412SThomas Huth 21577bc76c7SThomas Huthtests_riscv32_system_thorough = [ 21677bc76c7SThomas Huth 'riscv32_tuxrun', 21777bc76c7SThomas Huth] 21877bc76c7SThomas Huth 2196a564c8aSThomas Huthtests_riscv64_system_quick = [ 220092fd648SThomas Huth 'migration', 2216a564c8aSThomas Huth 'riscv_opensbi', 2226a564c8aSThomas Huth] 2236a564c8aSThomas Huth 2247746a6c4SThomas Huthtests_riscv64_system_thorough = [ 2257746a6c4SThomas Huth 'riscv64_tuxrun', 2267746a6c4SThomas Huth] 2277746a6c4SThomas Huth 2286a564c8aSThomas Huthtests_rx_system_thorough = [ 2296a564c8aSThomas Huth 'rx_gdbsim', 2306a564c8aSThomas Huth] 2316a564c8aSThomas Huth 232e2e9fd25SThomas Huthtests_s390x_system_thorough = [ 233e2e9fd25SThomas Huth 's390x_ccw_virtio', 234e2e9fd25SThomas Huth 's390x_topology', 235e6a401d7SThomas Huth 's390x_tuxrun', 236e2e9fd25SThomas Huth] 237e2e9fd25SThomas Huth 238a94bfe1bSThomas Huthtests_sh4_system_thorough = [ 239a94bfe1bSThomas Huth 'sh4_r2d', 240c592ff35SThomas Huth 'sh4_tuxrun', 241a94bfe1bSThomas Huth] 242a94bfe1bSThomas Huth 24362728ddcSThomas Huthtests_sh4eb_system_thorough = [ 24462728ddcSThomas Huth 'sh4eb_r2d', 24562728ddcSThomas Huth] 246c592ff35SThomas Huth 247092fd648SThomas Huthtests_sparc_system_quick = [ 248092fd648SThomas Huth 'migration', 249092fd648SThomas Huth] 250092fd648SThomas Huth 251f90527d3SThomas Huthtests_sparc_system_thorough = [ 252f90527d3SThomas Huth 'sparc_sun4m', 253f90527d3SThomas Huth] 254f90527d3SThomas Huth 255092fd648SThomas Huthtests_sparc64_system_quick = [ 256092fd648SThomas Huth 'migration', 257092fd648SThomas Huth] 258092fd648SThomas Huth 259e3fc99b1SThomas Huthtests_sparc64_system_thorough = [ 260e3fc99b1SThomas Huth 'sparc64_sun4u', 261116667aaSThomas Huth 'sparc64_tuxrun', 2624c0a2df8SThomas Huth] 2634c0a2df8SThomas Huth 26414973778SThomas Huthtests_x86_64_system_quick = [ 265cce85725SThomas Huth 'cpu_queries', 266cce85725SThomas Huth 'mem_addr_space', 267092fd648SThomas Huth 'migration', 268cce85725SThomas Huth 'pc_cpu_hotplug_props', 269cce85725SThomas Huth 'virtio_version', 270be849ef7SThomas Huth 'x86_cpu_model_versions', 271c82bfaf4SThomas Huth 'vnc', 27214973778SThomas Huth] 27314973778SThomas Huth 27414973778SThomas Huthtests_x86_64_system_thorough = [ 27505caa062SThomas Huth 'acpi_bits', 276270d4a51SThomas Huth 'intel_iommu', 2778dcac1cfSThomas Huth 'linux_initrd', 27869e4fbd0SThomas Huth 'multiprocess', 2794c0a2df8SThomas Huth 'netdev_ethtool', 280239d08aaSThomas Huth 'virtio_gpu', 281bf850896SThomas Huth 'x86_64_hotplug_cpu', 2820a8b4fd5SThomas Huth 'x86_64_kvm_xen', 283270d4a51SThomas Huth 'x86_64_tuxrun', 28414973778SThomas Huth] 28514973778SThomas Huth 286d1939097SThomas Huthtests_xtensa_system_thorough = [ 287d1939097SThomas Huth 'xtensa_lx60', 288d1939097SThomas Huth] 289d1939097SThomas Huth 290f57213f8SDaniel P. Berrangéprecache_all = [] 29114973778SThomas Huthforeach speed : ['quick', 'thorough'] 29214973778SThomas Huth foreach dir : target_dirs 29314973778SThomas Huth 29414973778SThomas Huth target_base = dir.split('-')[0] 29514973778SThomas Huth 29614973778SThomas Huth if dir.endswith('-softmmu') 29714973778SThomas Huth sysmode = 'system' 29814973778SThomas Huth test_emulator = emulators['qemu-system-' + target_base] 29914973778SThomas Huth elif dir.endswith('-linux-user') 30014973778SThomas Huth sysmode = 'linuxuser' 30114973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 30214973778SThomas Huth elif dir.endswith('-bsd-user') 30314973778SThomas Huth sysmode = 'bsduser' 30414973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 30514973778SThomas Huth else 30614973778SThomas Huth continue 30714973778SThomas Huth endif 30814973778SThomas Huth 30914973778SThomas Huth if speed == 'quick' 31014973778SThomas Huth suites = ['func-quick', 'func-' + target_base] 31114973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \ 31214973778SThomas Huth + get_variable('tests_generic_' + sysmode) 31314973778SThomas Huth else 31414973778SThomas Huth suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed] 31514973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, []) 31614973778SThomas Huth endif 31714973778SThomas Huth 31814973778SThomas Huth test_deps = roms 31914973778SThomas Huth test_env = environment() 32014973778SThomas Huth if have_tools 32114973778SThomas Huth test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img') 32214973778SThomas Huth test_deps += [qemu_img] 32314973778SThomas Huth endif 32414973778SThomas Huth test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path()) 32514973778SThomas Huth test_env.set('QEMU_BUILD_ROOT', meson.project_build_root()) 32614973778SThomas Huth test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 32714973778SThomas Huth meson.current_source_dir()) 32814973778SThomas Huth 32914973778SThomas Huth foreach test : target_tests 330f57213f8SDaniel P. Berrangé testname = '@0@-@1@'.format(target_base, test) 331f57213f8SDaniel P. Berrangé testfile = 'test_' + test + '.py' 332f57213f8SDaniel P. Berrangé testpath = meson.current_source_dir() / testfile 333f57213f8SDaniel P. Berrangé teststamp = testname + '.tstamp' 334f57213f8SDaniel P. Berrangé test_precache_env = environment() 335f57213f8SDaniel P. Berrangé test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp) 336f57213f8SDaniel P. Berrangé test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 337f57213f8SDaniel P. Berrangé meson.current_source_dir()) 338f57213f8SDaniel P. Berrangé precache = custom_target('func-precache-' + testname, 339f57213f8SDaniel P. Berrangé output: teststamp, 340f57213f8SDaniel P. Berrangé command: [python, testpath], 341f57213f8SDaniel P. Berrangé depend_files: files(testpath), 342f57213f8SDaniel P. Berrangé build_by_default: false, 343f57213f8SDaniel P. Berrangé env: test_precache_env) 344f57213f8SDaniel P. Berrangé precache_all += precache 345f57213f8SDaniel P. Berrangé 346f57213f8SDaniel P. Berrangé # Ideally we would add 'precache' to 'depends' here, such that 347f57213f8SDaniel P. Berrangé # 'build_by_default: false' lets the pre-caching automatically 348f57213f8SDaniel P. Berrangé # run immediately before the test runs. In practice this is 349f57213f8SDaniel P. Berrangé # broken in meson, with it running the pre-caching in the normal 350f57213f8SDaniel P. Berrangé # compile phase https://github.com/mesonbuild/meson/issues/2518 351f57213f8SDaniel P. Berrangé # If the above bug ever gets fixed, when QEMU changes the min 352f57213f8SDaniel P. Berrangé # meson version, add the 'depends' and remove the custom 353f57213f8SDaniel P. Berrangé # 'run_target' logic below & in Makefile.include 354f57213f8SDaniel P. Berrangé test('func-' + testname, 35514973778SThomas Huth python, 35614973778SThomas Huth depends: [test_deps, test_emulator, emulator_modules], 35714973778SThomas Huth env: test_env, 358f57213f8SDaniel P. Berrangé args: [testpath], 35914973778SThomas Huth protocol: 'tap', 360f5ccd7e0SThomas Huth timeout: test_timeouts.get(test, 90), 361f5ccd7e0SThomas Huth priority: test_timeouts.get(test, 90), 36214973778SThomas Huth suite: suites) 36314973778SThomas Huth endforeach 36414973778SThomas Huth endforeach 36514973778SThomas Huthendforeach 366f57213f8SDaniel P. Berrangé 367f57213f8SDaniel P. Berrangérun_target('precache-functional', 368f57213f8SDaniel P. Berrangé depends: precache_all, 369f57213f8SDaniel P. Berrangé command: ['true']) 370