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, 219a722825SAlex Bennée 'aarch64_virt' : 360, 229a722825SAlex Bennée 'aarch64_virt_gpu' : 480, 23f5ccd7e0SThomas Huth 'acpi_bits' : 420, 24e517cff7SCédric Le Goater 'arm_aspeed_palmetto' : 120, 255f2b9738SCédric Le Goater 'arm_aspeed_romulus' : 120, 263058b634SCédric Le Goater 'arm_aspeed_witherspoon' : 120, 27fe95724dSPeter Maydell 'arm_aspeed_ast2500' : 720, 28fe95724dSPeter Maydell 'arm_aspeed_ast2600' : 1200, 29*f0a6b3ecSPeter Maydell 'arm_aspeed_bletchley' : 480, 30fe95724dSPeter Maydell 'arm_aspeed_rainier' : 480, 31f5ccd7e0SThomas Huth 'arm_bpim2u' : 500, 32f5ccd7e0SThomas Huth 'arm_collie' : 180, 33d4d183afSThomas Huth 'arm_cubieboard' : 360, 34380f7268SThomas Huth 'arm_orangepi' : 540, 35799d6830SThomas Huth 'arm_quanta_gsj' : 240, 36d841f720SThomas Huth 'arm_raspi2' : 120, 378c63f9aaSPeter Maydell 'arm_replay' : 240, 38f5ccd7e0SThomas Huth 'arm_tuxrun' : 240, 39bc4d45b2SPeter Maydell 'arm_sx1' : 360, 40270d4a51SThomas Huth 'intel_iommu': 300, 41d841f720SThomas Huth 'mips_malta' : 120, 42350a998dSThomas Huth 'mipsel_replay' : 480, 43a31001b1SThomas Huth 'mips64el_replay' : 180, 444c0a2df8SThomas Huth 'netdev_ethtool' : 180, 45407a6883SThomas Huth 'ppc_40p' : 240, 4688c90719SThomas Huth 'ppc64_hv' : 1000, 47f5ccd7e0SThomas Huth 'ppc64_powernv' : 480, 48f5ccd7e0SThomas Huth 'ppc64_pseries' : 480, 49221620b7SThomas Huth 'ppc64_replay' : 210, 50f5ccd7e0SThomas Huth 'ppc64_tuxrun' : 420, 515e654086SCédric Le Goater 'ppc64_mac99' : 120, 52f5ccd7e0SThomas Huth 'riscv64_tuxrun' : 120, 53f5ccd7e0SThomas Huth 's390x_ccw_virtio' : 420, 5473a383dcSThomas Huth 'sh4_tuxrun' : 240, 551456e906SDaniel P. Berrangé 'virtio_balloon': 120, 560a8b4fd5SThomas Huth 'x86_64_kvm_xen' : 180, 570f31f0f5SThomas Huth 'x86_64_replay' : 480, 5814973778SThomas Huth} 5914973778SThomas Huth 6014973778SThomas Huthtests_generic_system = [ 61cce85725SThomas Huth 'empty_cpu_model', 62eeba3d73SThomas Huth 'info_usernet', 63eeba3d73SThomas Huth 'version', 64eeba3d73SThomas Huth] 65eeba3d73SThomas Huth 6614973778SThomas Huthtests_generic_linuxuser = [ 6714973778SThomas Huth] 6814973778SThomas Huth 6914973778SThomas Huthtests_generic_bsduser = [ 7014973778SThomas Huth] 7114973778SThomas Huth 72092fd648SThomas Huthtests_aarch64_system_quick = [ 73092fd648SThomas Huth 'migration', 74092fd648SThomas Huth] 75092fd648SThomas Huth 768f16cd80SPhilippe Mathieu-Daudétests_aarch64_system_thorough = [ 77c95309b2SCédric Le Goater 'aarch64_aspeed', 78471f7ff7SPhilippe Mathieu-Daudé 'aarch64_raspi3', 79547738beSPhilippe Mathieu-Daudé 'aarch64_raspi4', 804d75a374SThomas Huth 'aarch64_replay', 810d77c908SPierrick Bouvier 'aarch64_rme_virt', 820d77c908SPierrick Bouvier 'aarch64_rme_sbsaref', 838f16cd80SPhilippe Mathieu-Daudé 'aarch64_sbsaref', 849acd3884SThomas Huth 'aarch64_sbsaref_alpine', 859acd3884SThomas Huth 'aarch64_sbsaref_freebsd', 86156ee8b8SThomas Huth 'aarch64_tcg_plugins', 8737136902SThomas Huth 'aarch64_tuxrun', 881255f5e4SPhilippe Mathieu-Daudé 'aarch64_virt', 899a722825SAlex Bennée 'aarch64_virt_gpu', 9001466041SThomas Huth 'aarch64_xen', 91490d25e6SThomas Huth 'aarch64_xlnx_versal', 9269e4fbd0SThomas Huth 'multiprocess', 938f16cd80SPhilippe Mathieu-Daudé] 948f16cd80SPhilippe Mathieu-Daudé 95092fd648SThomas Huthtests_alpha_system_quick = [ 96092fd648SThomas Huth 'migration', 97092fd648SThomas Huth] 98092fd648SThomas Huth 999a76bc04SThomas Huthtests_alpha_system_thorough = [ 1009a76bc04SThomas Huth 'alpha_clipper', 10174728629SThomas Huth 'alpha_replay', 1029a76bc04SThomas Huth] 1039a76bc04SThomas Huth 104092fd648SThomas Huthtests_arm_system_quick = [ 105092fd648SThomas Huth 'migration', 106092fd648SThomas Huth] 107092fd648SThomas Huth 108e3fc99b1SThomas Huthtests_arm_system_thorough = [ 109e50c7285SCédric Le Goater 'arm_aspeed_ast1030', 110e517cff7SCédric Le Goater 'arm_aspeed_palmetto', 1115f2b9738SCédric Le Goater 'arm_aspeed_romulus', 1123058b634SCédric Le Goater 'arm_aspeed_witherspoon', 11308743dbaSCédric Le Goater 'arm_aspeed_ast2500', 114c7bc9cabSCédric Le Goater 'arm_aspeed_ast2600', 115b91a1d31SCédric Le Goater 'arm_aspeed_bletchley', 11638cd5c52SCédric Le Goater 'arm_aspeed_rainier', 117f7d6b772SThomas Huth 'arm_bpim2u', 118e3fc99b1SThomas Huth 'arm_canona1100', 119aff83583SPeter Maydell 'arm_collie', 120d4d183afSThomas Huth 'arm_cubieboard', 121bade2d51SThomas Huth 'arm_emcraft_sf2', 122ef83aea0SPhilippe Mathieu-Daudé 'arm_integratorcp', 123cb5f6ca8SThomas Huth 'arm_microbit', 124380f7268SThomas Huth 'arm_orangepi', 125799d6830SThomas Huth 'arm_quanta_gsj', 126165ab274SPhilippe Mathieu-Daudé 'arm_raspi2', 1278a145225SThomas Huth 'arm_replay', 12881e2926dSThomas Huth 'arm_smdkc210', 129bc4d45b2SPeter Maydell 'arm_sx1', 130c3cff727SThomas Huth 'arm_vexpress', 131a44b318fSThomas Huth 'arm_virt', 132de9f57a6SThomas Huth 'arm_tuxrun', 133e3fc99b1SThomas Huth] 134e3fc99b1SThomas Huth 13534917eadSPhilippe Mathieu-Daudétests_arm_linuxuser_thorough = [ 13634917eadSPhilippe Mathieu-Daudé 'arm_bflt', 13734917eadSPhilippe Mathieu-Daudé] 13834917eadSPhilippe Mathieu-Daudé 1394c0a2df8SThomas Huthtests_avr_system_thorough = [ 1404c0a2df8SThomas Huth 'avr_mega2560', 1414c0a2df8SThomas Huth] 1424c0a2df8SThomas Huth 143e4a407d2SPhilippe Mathieu-Daudétests_hppa_system_quick = [ 144e4a407d2SPhilippe Mathieu-Daudé 'hppa_seabios', 145e4a407d2SPhilippe Mathieu-Daudé] 146e4a407d2SPhilippe Mathieu-Daudé 147092fd648SThomas Huthtests_i386_system_quick = [ 148092fd648SThomas Huth 'migration', 149092fd648SThomas Huth] 150092fd648SThomas Huth 1514007fc94SThomas Huthtests_i386_system_thorough = [ 1524007fc94SThomas Huth 'i386_tuxrun', 1534007fc94SThomas Huth] 1544007fc94SThomas Huth 1554c0a2df8SThomas Huthtests_loongarch64_system_thorough = [ 1564c0a2df8SThomas Huth 'loongarch64_virt', 1574c0a2df8SThomas Huth] 1584c0a2df8SThomas Huth 159576fffbcSThomas Huthtests_m68k_system_thorough = [ 1609f989d65SThomas Huth 'm68k_mcf5208evb', 161c7f3663cSThomas Huth 'm68k_nextcube', 162ec971d85SThomas Huth 'm68k_replay', 163c7f3663cSThomas Huth 'm68k_q800', 1643356bb83SAlex Bennée 'm68k_tuxrun', 165576fffbcSThomas Huth] 166576fffbcSThomas Huth 167624fb343SThomas Huthtests_microblaze_system_thorough = [ 1686674fa9cSThomas Huth 'microblaze_replay', 169624fb343SThomas Huth 'microblaze_s3adsp1800' 170624fb343SThomas Huth] 171624fb343SThomas Huth 172624fb343SThomas Huthtests_microblazeel_system_thorough = [ 173624fb343SThomas Huth 'microblazeel_s3adsp1800' 174624fb343SThomas Huth] 175624fb343SThomas Huth 17679cb4a14SPhilippe Mathieu-Daudétests_mips_system_thorough = [ 17779cb4a14SPhilippe Mathieu-Daudé 'mips_malta', 178f194f0caSThomas Huth 'mips_replay', 17987cab1aeSThomas Huth 'mips_tuxrun', 18079cb4a14SPhilippe Mathieu-Daudé] 18179cb4a14SPhilippe Mathieu-Daudé 182a4b60becSPhilippe Mathieu-Daudétests_mipsel_system_thorough = [ 183a4b60becSPhilippe Mathieu-Daudé 'mipsel_malta', 184350a998dSThomas Huth 'mipsel_replay', 18555716a89SThomas Huth 'mipsel_tuxrun', 186a4b60becSPhilippe Mathieu-Daudé] 187a4b60becSPhilippe Mathieu-Daudé 188a01be218SThomas Huthtests_mips64_system_thorough = [ 189a01be218SThomas Huth 'mips64_tuxrun', 190a01be218SThomas Huth] 191a01be218SThomas Huth 1924c0a2df8SThomas Huthtests_mips64el_system_thorough = [ 1930d2a8acfSThomas Huth 'mips64el_fuloong2e', 1944c0a2df8SThomas Huth 'mips64el_loongson3v', 195fcf2658bSPhilippe Mathieu-Daudé 'mips64el_malta', 196f348229eSThomas Huth 'mips64el_replay', 197a2a2a5b0SThomas Huth 'mips64el_tuxrun', 1984c0a2df8SThomas Huth] 1994c0a2df8SThomas Huth 2000addb05aSThomas Huthtests_or1k_system_thorough = [ 20152ec5f51SThomas Huth 'or1k_replay', 2023a07875fSThomas Huth 'or1k_sim', 2033a07875fSThomas Huth] 2043a07875fSThomas Huth 2054c0a2df8SThomas Huthtests_ppc_system_quick = [ 206092fd648SThomas Huth 'migration', 2074c0a2df8SThomas Huth 'ppc_74xx', 2084c0a2df8SThomas Huth] 2094c0a2df8SThomas Huth 2104c0a2df8SThomas Huthtests_ppc_system_thorough = [ 211407a6883SThomas Huth 'ppc_40p', 212cef1becbSThomas Huth 'ppc_amiga', 213e3fc99b1SThomas Huth 'ppc_bamboo', 21412c0b407SThomas Huth 'ppc_mac', 215407a6883SThomas Huth 'ppc_mpc8544ds', 2169917e06cSThomas Huth 'ppc_replay', 21755727771SCédric Le Goater 'ppc_sam460ex', 2189ca8239aSThomas Huth 'ppc_tuxrun', 219407a6883SThomas Huth 'ppc_virtex_ml507', 220407a6883SThomas Huth] 221407a6883SThomas Huth 222092fd648SThomas Huthtests_ppc64_system_quick = [ 223092fd648SThomas Huth 'migration', 224092fd648SThomas Huth] 225092fd648SThomas Huth 226407a6883SThomas Huthtests_ppc64_system_thorough = [ 22753a62fdeSThomas Huth 'ppc64_e500', 22888c90719SThomas Huth 'ppc64_hv', 229407a6883SThomas Huth 'ppc64_powernv', 230407a6883SThomas Huth 'ppc64_pseries', 231221620b7SThomas Huth 'ppc64_replay', 232e6a401d7SThomas Huth 'ppc64_tuxrun', 2335e654086SCédric Le Goater 'ppc64_mac99', 234e3fc99b1SThomas Huth] 235e3fc99b1SThomas Huth 2366a564c8aSThomas Huthtests_riscv32_system_quick = [ 237092fd648SThomas Huth 'migration', 2386a564c8aSThomas Huth 'riscv_opensbi', 239d5674412SThomas Huth] 240d5674412SThomas Huth 24177bc76c7SThomas Huthtests_riscv32_system_thorough = [ 24277bc76c7SThomas Huth 'riscv32_tuxrun', 24377bc76c7SThomas Huth] 24477bc76c7SThomas Huth 2456a564c8aSThomas Huthtests_riscv64_system_quick = [ 246092fd648SThomas Huth 'migration', 2476a564c8aSThomas Huth 'riscv_opensbi', 2486a564c8aSThomas Huth] 2496a564c8aSThomas Huth 2507746a6c4SThomas Huthtests_riscv64_system_thorough = [ 2517746a6c4SThomas Huth 'riscv64_tuxrun', 2527746a6c4SThomas Huth] 2537746a6c4SThomas Huth 2546a564c8aSThomas Huthtests_rx_system_thorough = [ 2556a564c8aSThomas Huth 'rx_gdbsim', 2566a564c8aSThomas Huth] 2576a564c8aSThomas Huth 258e2e9fd25SThomas Huthtests_s390x_system_thorough = [ 259e2e9fd25SThomas Huth 's390x_ccw_virtio', 26050424852SThomas Huth 's390x_replay', 261e2e9fd25SThomas Huth 's390x_topology', 262e6a401d7SThomas Huth 's390x_tuxrun', 263e2e9fd25SThomas Huth] 264e2e9fd25SThomas Huth 265a94bfe1bSThomas Huthtests_sh4_system_thorough = [ 266a94bfe1bSThomas Huth 'sh4_r2d', 267c592ff35SThomas Huth 'sh4_tuxrun', 268a94bfe1bSThomas Huth] 269a94bfe1bSThomas Huth 27062728ddcSThomas Huthtests_sh4eb_system_thorough = [ 27162728ddcSThomas Huth 'sh4eb_r2d', 27262728ddcSThomas Huth] 273c592ff35SThomas Huth 274092fd648SThomas Huthtests_sparc_system_quick = [ 275092fd648SThomas Huth 'migration', 276092fd648SThomas Huth] 277092fd648SThomas Huth 278f90527d3SThomas Huthtests_sparc_system_thorough = [ 279a14dfd93SThomas Huth 'sparc_replay', 280f90527d3SThomas Huth 'sparc_sun4m', 281f90527d3SThomas Huth] 282f90527d3SThomas Huth 283092fd648SThomas Huthtests_sparc64_system_quick = [ 284092fd648SThomas Huth 'migration', 285092fd648SThomas Huth] 286092fd648SThomas Huth 287e3fc99b1SThomas Huthtests_sparc64_system_thorough = [ 288e3fc99b1SThomas Huth 'sparc64_sun4u', 289116667aaSThomas Huth 'sparc64_tuxrun', 2904c0a2df8SThomas Huth] 2914c0a2df8SThomas Huth 29214973778SThomas Huthtests_x86_64_system_quick = [ 293cce85725SThomas Huth 'cpu_queries', 294cce85725SThomas Huth 'mem_addr_space', 295092fd648SThomas Huth 'migration', 296cce85725SThomas Huth 'pc_cpu_hotplug_props', 297cce85725SThomas Huth 'virtio_version', 298be849ef7SThomas Huth 'x86_cpu_model_versions', 299c82bfaf4SThomas Huth 'vnc', 30014973778SThomas Huth] 30114973778SThomas Huth 30214973778SThomas Huthtests_x86_64_system_thorough = [ 30305caa062SThomas Huth 'acpi_bits', 304270d4a51SThomas Huth 'intel_iommu', 3058dcac1cfSThomas Huth 'linux_initrd', 30669e4fbd0SThomas Huth 'multiprocess', 3074c0a2df8SThomas Huth 'netdev_ethtool', 3081456e906SDaniel P. Berrangé 'virtio_balloon', 309239d08aaSThomas Huth 'virtio_gpu', 3105f6a260fSThomas Huth 'x86_64_hotplug_blk', 311bf850896SThomas Huth 'x86_64_hotplug_cpu', 3120a8b4fd5SThomas Huth 'x86_64_kvm_xen', 3130f31f0f5SThomas Huth 'x86_64_replay', 314270d4a51SThomas Huth 'x86_64_tuxrun', 31514973778SThomas Huth] 31614973778SThomas Huth 317d1939097SThomas Huthtests_xtensa_system_thorough = [ 318d1939097SThomas Huth 'xtensa_lx60', 3196e52e84dSThomas Huth 'xtensa_replay', 320d1939097SThomas Huth] 321d1939097SThomas Huth 322f57213f8SDaniel P. Berrangéprecache_all = [] 32314973778SThomas Huthforeach speed : ['quick', 'thorough'] 32414973778SThomas Huth foreach dir : target_dirs 32514973778SThomas Huth 32614973778SThomas Huth target_base = dir.split('-')[0] 32714973778SThomas Huth 32814973778SThomas Huth if dir.endswith('-softmmu') 32914973778SThomas Huth sysmode = 'system' 33014973778SThomas Huth test_emulator = emulators['qemu-system-' + target_base] 33114973778SThomas Huth elif dir.endswith('-linux-user') 33214973778SThomas Huth sysmode = 'linuxuser' 33314973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 33414973778SThomas Huth elif dir.endswith('-bsd-user') 33514973778SThomas Huth sysmode = 'bsduser' 33614973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 33714973778SThomas Huth else 33814973778SThomas Huth continue 33914973778SThomas Huth endif 34014973778SThomas Huth 34114973778SThomas Huth if speed == 'quick' 34214973778SThomas Huth suites = ['func-quick', 'func-' + target_base] 34314973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \ 34414973778SThomas Huth + get_variable('tests_generic_' + sysmode) 34514973778SThomas Huth else 34614973778SThomas Huth suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed] 34714973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, []) 34814973778SThomas Huth endif 34914973778SThomas Huth 35014973778SThomas Huth test_deps = roms 35114973778SThomas Huth test_env = environment() 35214973778SThomas Huth if have_tools 35314973778SThomas Huth test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img') 35414973778SThomas Huth test_deps += [qemu_img] 35514973778SThomas Huth endif 35614973778SThomas Huth test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path()) 35714973778SThomas Huth test_env.set('QEMU_BUILD_ROOT', meson.project_build_root()) 35814973778SThomas Huth test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 35914973778SThomas Huth meson.current_source_dir()) 36014973778SThomas Huth 36114973778SThomas Huth foreach test : target_tests 362f57213f8SDaniel P. Berrangé testname = '@0@-@1@'.format(target_base, test) 363f57213f8SDaniel P. Berrangé testfile = 'test_' + test + '.py' 364f57213f8SDaniel P. Berrangé testpath = meson.current_source_dir() / testfile 365f57213f8SDaniel P. Berrangé teststamp = testname + '.tstamp' 366f57213f8SDaniel P. Berrangé test_precache_env = environment() 367f57213f8SDaniel P. Berrangé test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp) 368f57213f8SDaniel P. Berrangé test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 369f57213f8SDaniel P. Berrangé meson.current_source_dir()) 370f57213f8SDaniel P. Berrangé precache = custom_target('func-precache-' + testname, 371f57213f8SDaniel P. Berrangé output: teststamp, 372f57213f8SDaniel P. Berrangé command: [python, testpath], 373f57213f8SDaniel P. Berrangé depend_files: files(testpath), 374f57213f8SDaniel P. Berrangé build_by_default: false, 375f57213f8SDaniel P. Berrangé env: test_precache_env) 376f57213f8SDaniel P. Berrangé precache_all += precache 377f57213f8SDaniel P. Berrangé 378f57213f8SDaniel P. Berrangé # Ideally we would add 'precache' to 'depends' here, such that 379f57213f8SDaniel P. Berrangé # 'build_by_default: false' lets the pre-caching automatically 380f57213f8SDaniel P. Berrangé # run immediately before the test runs. In practice this is 381f57213f8SDaniel P. Berrangé # broken in meson, with it running the pre-caching in the normal 382f57213f8SDaniel P. Berrangé # compile phase https://github.com/mesonbuild/meson/issues/2518 383f57213f8SDaniel P. Berrangé # If the above bug ever gets fixed, when QEMU changes the min 384f57213f8SDaniel P. Berrangé # meson version, add the 'depends' and remove the custom 385f57213f8SDaniel P. Berrangé # 'run_target' logic below & in Makefile.include 386f57213f8SDaniel P. Berrangé test('func-' + testname, 38714973778SThomas Huth python, 388892b06c4SPierrick Bouvier depends: [test_deps, test_emulator, emulator_modules, plugin_modules], 38914973778SThomas Huth env: test_env, 390f57213f8SDaniel P. Berrangé args: [testpath], 39114973778SThomas Huth protocol: 'tap', 392f5ccd7e0SThomas Huth timeout: test_timeouts.get(test, 90), 393f5ccd7e0SThomas Huth priority: test_timeouts.get(test, 90), 39414973778SThomas Huth suite: suites) 39514973778SThomas Huth endforeach 39614973778SThomas Huth endforeach 39714973778SThomas Huthendforeach 398f57213f8SDaniel P. Berrangé 399f57213f8SDaniel P. Berrangérun_target('precache-functional', 400f57213f8SDaniel P. Berrangé depends: precache_all, 401f57213f8SDaniel P. Berrangé command: ['true']) 402