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, 44221620b7SThomas Huth 'ppc64_replay' : 210, 45f5ccd7e0SThomas Huth 'ppc64_tuxrun' : 420, 465e654086SCédric Le Goater 'ppc64_mac99' : 120, 47f5ccd7e0SThomas Huth 'riscv64_tuxrun' : 120, 48f5ccd7e0SThomas Huth 's390x_ccw_virtio' : 420, 4973a383dcSThomas Huth 'sh4_tuxrun' : 240, 501456e906SDaniel P. Berrangé 'virtio_balloon': 120, 510a8b4fd5SThomas Huth 'x86_64_kvm_xen' : 180, 5214973778SThomas Huth} 5314973778SThomas Huth 5414973778SThomas Huthtests_generic_system = [ 55cce85725SThomas Huth 'empty_cpu_model', 56eeba3d73SThomas Huth 'info_usernet', 57eeba3d73SThomas Huth 'version', 58eeba3d73SThomas Huth] 59eeba3d73SThomas Huth 6014973778SThomas Huthtests_generic_linuxuser = [ 6114973778SThomas Huth] 6214973778SThomas Huth 6314973778SThomas Huthtests_generic_bsduser = [ 6414973778SThomas Huth] 6514973778SThomas Huth 66092fd648SThomas Huthtests_aarch64_system_quick = [ 67092fd648SThomas Huth 'migration', 68092fd648SThomas Huth] 69092fd648SThomas Huth 708f16cd80SPhilippe Mathieu-Daudétests_aarch64_system_thorough = [ 71c95309b2SCédric Le Goater 'aarch64_aspeed', 72471f7ff7SPhilippe Mathieu-Daudé 'aarch64_raspi3', 73547738beSPhilippe Mathieu-Daudé 'aarch64_raspi4', 740d77c908SPierrick Bouvier 'aarch64_rme_virt', 750d77c908SPierrick Bouvier 'aarch64_rme_sbsaref', 768f16cd80SPhilippe Mathieu-Daudé 'aarch64_sbsaref', 779acd3884SThomas Huth 'aarch64_sbsaref_alpine', 789acd3884SThomas Huth 'aarch64_sbsaref_freebsd', 79156ee8b8SThomas Huth 'aarch64_tcg_plugins', 8037136902SThomas Huth 'aarch64_tuxrun', 811255f5e4SPhilippe Mathieu-Daudé 'aarch64_virt', 8201466041SThomas Huth 'aarch64_xen', 83490d25e6SThomas Huth 'aarch64_xlnx_versal', 8469e4fbd0SThomas Huth 'multiprocess', 858f16cd80SPhilippe Mathieu-Daudé] 868f16cd80SPhilippe Mathieu-Daudé 87092fd648SThomas Huthtests_alpha_system_quick = [ 88092fd648SThomas Huth 'migration', 89092fd648SThomas Huth] 90092fd648SThomas Huth 919a76bc04SThomas Huthtests_alpha_system_thorough = [ 929a76bc04SThomas Huth 'alpha_clipper', 939a76bc04SThomas Huth] 949a76bc04SThomas Huth 95092fd648SThomas Huthtests_arm_system_quick = [ 96092fd648SThomas Huth 'migration', 97092fd648SThomas Huth] 98092fd648SThomas Huth 99e3fc99b1SThomas Huthtests_arm_system_thorough = [ 100e50c7285SCédric Le Goater 'arm_aspeed_ast1030', 101e517cff7SCédric Le Goater 'arm_aspeed_palmetto', 1025f2b9738SCédric Le Goater 'arm_aspeed_romulus', 10308743dbaSCédric Le Goater 'arm_aspeed_ast2500', 104c7bc9cabSCédric Le Goater 'arm_aspeed_ast2600', 10538cd5c52SCédric Le Goater 'arm_aspeed_rainier', 106f7d6b772SThomas Huth 'arm_bpim2u', 107e3fc99b1SThomas Huth 'arm_canona1100', 108aff83583SPeter Maydell 'arm_collie', 109d4d183afSThomas Huth 'arm_cubieboard', 110bade2d51SThomas Huth 'arm_emcraft_sf2', 111ef83aea0SPhilippe Mathieu-Daudé 'arm_integratorcp', 112cb5f6ca8SThomas Huth 'arm_microbit', 113380f7268SThomas Huth 'arm_orangepi', 114799d6830SThomas Huth 'arm_quanta_gsj', 115165ab274SPhilippe Mathieu-Daudé 'arm_raspi2', 11681e2926dSThomas Huth 'arm_smdkc210', 117bc4d45b2SPeter Maydell 'arm_sx1', 118c3cff727SThomas Huth 'arm_vexpress', 119a44b318fSThomas Huth 'arm_virt', 120de9f57a6SThomas Huth 'arm_tuxrun', 121e3fc99b1SThomas Huth] 122e3fc99b1SThomas Huth 12334917eadSPhilippe Mathieu-Daudétests_arm_linuxuser_thorough = [ 12434917eadSPhilippe Mathieu-Daudé 'arm_bflt', 12534917eadSPhilippe Mathieu-Daudé] 12634917eadSPhilippe Mathieu-Daudé 1274c0a2df8SThomas Huthtests_avr_system_thorough = [ 1284c0a2df8SThomas Huth 'avr_mega2560', 1294c0a2df8SThomas Huth] 1304c0a2df8SThomas Huth 131e4a407d2SPhilippe Mathieu-Daudétests_hppa_system_quick = [ 132e4a407d2SPhilippe Mathieu-Daudé 'hppa_seabios', 133e4a407d2SPhilippe Mathieu-Daudé] 134e4a407d2SPhilippe Mathieu-Daudé 135092fd648SThomas Huthtests_i386_system_quick = [ 136092fd648SThomas Huth 'migration', 137092fd648SThomas Huth] 138092fd648SThomas Huth 1394007fc94SThomas Huthtests_i386_system_thorough = [ 1404007fc94SThomas Huth 'i386_tuxrun', 1414007fc94SThomas Huth] 1424007fc94SThomas Huth 1434c0a2df8SThomas Huthtests_loongarch64_system_thorough = [ 1444c0a2df8SThomas Huth 'loongarch64_virt', 1454c0a2df8SThomas Huth] 1464c0a2df8SThomas Huth 147576fffbcSThomas Huthtests_m68k_system_thorough = [ 1489f989d65SThomas Huth 'm68k_mcf5208evb', 149c7f3663cSThomas Huth 'm68k_nextcube', 150c7f3663cSThomas Huth 'm68k_q800', 1513356bb83SAlex Bennée 'm68k_tuxrun', 152576fffbcSThomas Huth] 153576fffbcSThomas Huth 154624fb343SThomas Huthtests_microblaze_system_thorough = [ 155*6674fa9cSThomas Huth 'microblaze_replay', 156624fb343SThomas Huth 'microblaze_s3adsp1800' 157624fb343SThomas Huth] 158624fb343SThomas Huth 159624fb343SThomas Huthtests_microblazeel_system_thorough = [ 160624fb343SThomas Huth 'microblazeel_s3adsp1800' 161624fb343SThomas Huth] 162624fb343SThomas Huth 16379cb4a14SPhilippe Mathieu-Daudétests_mips_system_thorough = [ 16479cb4a14SPhilippe Mathieu-Daudé 'mips_malta', 165f194f0caSThomas Huth 'mips_replay', 16687cab1aeSThomas Huth 'mips_tuxrun', 16779cb4a14SPhilippe Mathieu-Daudé] 16879cb4a14SPhilippe Mathieu-Daudé 169a4b60becSPhilippe Mathieu-Daudétests_mipsel_system_thorough = [ 170a4b60becSPhilippe Mathieu-Daudé 'mipsel_malta', 171350a998dSThomas Huth 'mipsel_replay', 17255716a89SThomas Huth 'mipsel_tuxrun', 173a4b60becSPhilippe Mathieu-Daudé] 174a4b60becSPhilippe Mathieu-Daudé 175a01be218SThomas Huthtests_mips64_system_thorough = [ 176a01be218SThomas Huth 'mips64_tuxrun', 177a01be218SThomas Huth] 178a01be218SThomas Huth 1794c0a2df8SThomas Huthtests_mips64el_system_thorough = [ 1800d2a8acfSThomas Huth 'mips64el_fuloong2e', 1814c0a2df8SThomas Huth 'mips64el_loongson3v', 182fcf2658bSPhilippe Mathieu-Daudé 'mips64el_malta', 183f348229eSThomas Huth 'mips64el_replay', 184a2a2a5b0SThomas Huth 'mips64el_tuxrun', 1854c0a2df8SThomas Huth] 1864c0a2df8SThomas Huth 1870addb05aSThomas Huthtests_or1k_system_thorough = [ 18852ec5f51SThomas Huth 'or1k_replay', 1893a07875fSThomas Huth 'or1k_sim', 1903a07875fSThomas Huth] 1913a07875fSThomas Huth 1924c0a2df8SThomas Huthtests_ppc_system_quick = [ 193092fd648SThomas Huth 'migration', 1944c0a2df8SThomas Huth 'ppc_74xx', 1954c0a2df8SThomas Huth] 1964c0a2df8SThomas Huth 1974c0a2df8SThomas Huthtests_ppc_system_thorough = [ 1984c0a2df8SThomas Huth 'ppc_405', 199407a6883SThomas Huth 'ppc_40p', 200cef1becbSThomas Huth 'ppc_amiga', 201e3fc99b1SThomas Huth 'ppc_bamboo', 20212c0b407SThomas Huth 'ppc_mac', 203407a6883SThomas Huth 'ppc_mpc8544ds', 2049917e06cSThomas Huth 'ppc_replay', 20555727771SCédric Le Goater 'ppc_sam460ex', 2069ca8239aSThomas Huth 'ppc_tuxrun', 207407a6883SThomas Huth 'ppc_virtex_ml507', 208407a6883SThomas Huth] 209407a6883SThomas Huth 210092fd648SThomas Huthtests_ppc64_system_quick = [ 211092fd648SThomas Huth 'migration', 212092fd648SThomas Huth] 213092fd648SThomas Huth 214407a6883SThomas Huthtests_ppc64_system_thorough = [ 21553a62fdeSThomas Huth 'ppc64_e500', 21688c90719SThomas Huth 'ppc64_hv', 217407a6883SThomas Huth 'ppc64_powernv', 218407a6883SThomas Huth 'ppc64_pseries', 219221620b7SThomas Huth 'ppc64_replay', 220e6a401d7SThomas Huth 'ppc64_tuxrun', 2215e654086SCédric Le Goater 'ppc64_mac99', 222e3fc99b1SThomas Huth] 223e3fc99b1SThomas Huth 2246a564c8aSThomas Huthtests_riscv32_system_quick = [ 225092fd648SThomas Huth 'migration', 2266a564c8aSThomas Huth 'riscv_opensbi', 227d5674412SThomas Huth] 228d5674412SThomas Huth 22977bc76c7SThomas Huthtests_riscv32_system_thorough = [ 23077bc76c7SThomas Huth 'riscv32_tuxrun', 23177bc76c7SThomas Huth] 23277bc76c7SThomas Huth 2336a564c8aSThomas Huthtests_riscv64_system_quick = [ 234092fd648SThomas Huth 'migration', 2356a564c8aSThomas Huth 'riscv_opensbi', 2366a564c8aSThomas Huth] 2376a564c8aSThomas Huth 2387746a6c4SThomas Huthtests_riscv64_system_thorough = [ 2397746a6c4SThomas Huth 'riscv64_tuxrun', 2407746a6c4SThomas Huth] 2417746a6c4SThomas Huth 2426a564c8aSThomas Huthtests_rx_system_thorough = [ 2436a564c8aSThomas Huth 'rx_gdbsim', 2446a564c8aSThomas Huth] 2456a564c8aSThomas Huth 246e2e9fd25SThomas Huthtests_s390x_system_thorough = [ 247e2e9fd25SThomas Huth 's390x_ccw_virtio', 248e2e9fd25SThomas Huth 's390x_topology', 249e6a401d7SThomas Huth 's390x_tuxrun', 250e2e9fd25SThomas Huth] 251e2e9fd25SThomas Huth 252a94bfe1bSThomas Huthtests_sh4_system_thorough = [ 253a94bfe1bSThomas Huth 'sh4_r2d', 254c592ff35SThomas Huth 'sh4_tuxrun', 255a94bfe1bSThomas Huth] 256a94bfe1bSThomas Huth 25762728ddcSThomas Huthtests_sh4eb_system_thorough = [ 25862728ddcSThomas Huth 'sh4eb_r2d', 25962728ddcSThomas Huth] 260c592ff35SThomas Huth 261092fd648SThomas Huthtests_sparc_system_quick = [ 262092fd648SThomas Huth 'migration', 263092fd648SThomas Huth] 264092fd648SThomas Huth 265f90527d3SThomas Huthtests_sparc_system_thorough = [ 266a14dfd93SThomas Huth 'sparc_replay', 267f90527d3SThomas Huth 'sparc_sun4m', 268f90527d3SThomas Huth] 269f90527d3SThomas Huth 270092fd648SThomas Huthtests_sparc64_system_quick = [ 271092fd648SThomas Huth 'migration', 272092fd648SThomas Huth] 273092fd648SThomas Huth 274e3fc99b1SThomas Huthtests_sparc64_system_thorough = [ 275e3fc99b1SThomas Huth 'sparc64_sun4u', 276116667aaSThomas Huth 'sparc64_tuxrun', 2774c0a2df8SThomas Huth] 2784c0a2df8SThomas Huth 27914973778SThomas Huthtests_x86_64_system_quick = [ 280cce85725SThomas Huth 'cpu_queries', 281cce85725SThomas Huth 'mem_addr_space', 282092fd648SThomas Huth 'migration', 283cce85725SThomas Huth 'pc_cpu_hotplug_props', 284cce85725SThomas Huth 'virtio_version', 285be849ef7SThomas Huth 'x86_cpu_model_versions', 286c82bfaf4SThomas Huth 'vnc', 28714973778SThomas Huth] 28814973778SThomas Huth 28914973778SThomas Huthtests_x86_64_system_thorough = [ 29005caa062SThomas Huth 'acpi_bits', 291270d4a51SThomas Huth 'intel_iommu', 2928dcac1cfSThomas Huth 'linux_initrd', 29369e4fbd0SThomas Huth 'multiprocess', 2944c0a2df8SThomas Huth 'netdev_ethtool', 2951456e906SDaniel P. Berrangé 'virtio_balloon', 296239d08aaSThomas Huth 'virtio_gpu', 2975f6a260fSThomas Huth 'x86_64_hotplug_blk', 298bf850896SThomas Huth 'x86_64_hotplug_cpu', 2990a8b4fd5SThomas Huth 'x86_64_kvm_xen', 300270d4a51SThomas Huth 'x86_64_tuxrun', 30114973778SThomas Huth] 30214973778SThomas Huth 303d1939097SThomas Huthtests_xtensa_system_thorough = [ 304d1939097SThomas Huth 'xtensa_lx60', 3056e52e84dSThomas Huth 'xtensa_replay', 306d1939097SThomas Huth] 307d1939097SThomas Huth 308f57213f8SDaniel P. Berrangéprecache_all = [] 30914973778SThomas Huthforeach speed : ['quick', 'thorough'] 31014973778SThomas Huth foreach dir : target_dirs 31114973778SThomas Huth 31214973778SThomas Huth target_base = dir.split('-')[0] 31314973778SThomas Huth 31414973778SThomas Huth if dir.endswith('-softmmu') 31514973778SThomas Huth sysmode = 'system' 31614973778SThomas Huth test_emulator = emulators['qemu-system-' + target_base] 31714973778SThomas Huth elif dir.endswith('-linux-user') 31814973778SThomas Huth sysmode = 'linuxuser' 31914973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 32014973778SThomas Huth elif dir.endswith('-bsd-user') 32114973778SThomas Huth sysmode = 'bsduser' 32214973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 32314973778SThomas Huth else 32414973778SThomas Huth continue 32514973778SThomas Huth endif 32614973778SThomas Huth 32714973778SThomas Huth if speed == 'quick' 32814973778SThomas Huth suites = ['func-quick', 'func-' + target_base] 32914973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \ 33014973778SThomas Huth + get_variable('tests_generic_' + sysmode) 33114973778SThomas Huth else 33214973778SThomas Huth suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed] 33314973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, []) 33414973778SThomas Huth endif 33514973778SThomas Huth 33614973778SThomas Huth test_deps = roms 33714973778SThomas Huth test_env = environment() 33814973778SThomas Huth if have_tools 33914973778SThomas Huth test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img') 34014973778SThomas Huth test_deps += [qemu_img] 34114973778SThomas Huth endif 34214973778SThomas Huth test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path()) 34314973778SThomas Huth test_env.set('QEMU_BUILD_ROOT', meson.project_build_root()) 34414973778SThomas Huth test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 34514973778SThomas Huth meson.current_source_dir()) 34614973778SThomas Huth 34714973778SThomas Huth foreach test : target_tests 348f57213f8SDaniel P. Berrangé testname = '@0@-@1@'.format(target_base, test) 349f57213f8SDaniel P. Berrangé testfile = 'test_' + test + '.py' 350f57213f8SDaniel P. Berrangé testpath = meson.current_source_dir() / testfile 351f57213f8SDaniel P. Berrangé teststamp = testname + '.tstamp' 352f57213f8SDaniel P. Berrangé test_precache_env = environment() 353f57213f8SDaniel P. Berrangé test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp) 354f57213f8SDaniel P. Berrangé test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 355f57213f8SDaniel P. Berrangé meson.current_source_dir()) 356f57213f8SDaniel P. Berrangé precache = custom_target('func-precache-' + testname, 357f57213f8SDaniel P. Berrangé output: teststamp, 358f57213f8SDaniel P. Berrangé command: [python, testpath], 359f57213f8SDaniel P. Berrangé depend_files: files(testpath), 360f57213f8SDaniel P. Berrangé build_by_default: false, 361f57213f8SDaniel P. Berrangé env: test_precache_env) 362f57213f8SDaniel P. Berrangé precache_all += precache 363f57213f8SDaniel P. Berrangé 364f57213f8SDaniel P. Berrangé # Ideally we would add 'precache' to 'depends' here, such that 365f57213f8SDaniel P. Berrangé # 'build_by_default: false' lets the pre-caching automatically 366f57213f8SDaniel P. Berrangé # run immediately before the test runs. In practice this is 367f57213f8SDaniel P. Berrangé # broken in meson, with it running the pre-caching in the normal 368f57213f8SDaniel P. Berrangé # compile phase https://github.com/mesonbuild/meson/issues/2518 369f57213f8SDaniel P. Berrangé # If the above bug ever gets fixed, when QEMU changes the min 370f57213f8SDaniel P. Berrangé # meson version, add the 'depends' and remove the custom 371f57213f8SDaniel P. Berrangé # 'run_target' logic below & in Makefile.include 372f57213f8SDaniel P. Berrangé test('func-' + testname, 37314973778SThomas Huth python, 37414973778SThomas Huth depends: [test_deps, test_emulator, emulator_modules], 37514973778SThomas Huth env: test_env, 376f57213f8SDaniel P. Berrangé args: [testpath], 37714973778SThomas Huth protocol: 'tap', 378f5ccd7e0SThomas Huth timeout: test_timeouts.get(test, 90), 379f5ccd7e0SThomas Huth priority: test_timeouts.get(test, 90), 38014973778SThomas Huth suite: suites) 38114973778SThomas Huth endforeach 38214973778SThomas Huth endforeach 38314973778SThomas Huthendforeach 384f57213f8SDaniel P. Berrangé 385f57213f8SDaniel P. Berrangérun_target('precache-functional', 386f57213f8SDaniel P. Berrangé depends: precache_all, 387f57213f8SDaniel P. Berrangé command: ['true']) 388