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, 169acd3884SThomas Huth 'aarch64_sbsaref_alpine' : 720, 179acd3884SThomas Huth 'aarch64_sbsaref_freebsd' : 720, 1837136902SThomas Huth 'aarch64_tuxrun' : 240, 19f5ccd7e0SThomas Huth 'aarch64_virt' : 720, 20f5ccd7e0SThomas Huth 'acpi_bits' : 420, 21e517cff7SCédric Le Goater 'arm_aspeed_palmetto' : 120, 225f2b9738SCédric Le Goater 'arm_aspeed_romulus' : 120, 23*08743dbaSCédric Le Goater 'arm_aspeed_ast2500' : 480, 24f04cb2d0SCédric Le Goater 'arm_aspeed' : 600, 25f5ccd7e0SThomas Huth 'arm_bpim2u' : 500, 26f5ccd7e0SThomas Huth 'arm_collie' : 180, 27380f7268SThomas Huth 'arm_orangepi' : 540, 28d841f720SThomas Huth 'arm_raspi2' : 120, 29f5ccd7e0SThomas Huth 'arm_tuxrun' : 240, 30bc4d45b2SPeter Maydell 'arm_sx1' : 360, 31d841f720SThomas Huth 'mips_malta' : 120, 324c0a2df8SThomas Huth 'netdev_ethtool' : 180, 33407a6883SThomas Huth 'ppc_40p' : 240, 3488c90719SThomas Huth 'ppc64_hv' : 1000, 35f5ccd7e0SThomas Huth 'ppc64_powernv' : 480, 36f5ccd7e0SThomas Huth 'ppc64_pseries' : 480, 37f5ccd7e0SThomas Huth 'ppc64_tuxrun' : 420, 38f5ccd7e0SThomas Huth 'riscv64_tuxrun' : 120, 39f5ccd7e0SThomas Huth 's390x_ccw_virtio' : 420, 4014973778SThomas Huth} 4114973778SThomas Huth 4214973778SThomas Huthtests_generic_system = [ 43cce85725SThomas Huth 'empty_cpu_model', 44eeba3d73SThomas Huth 'info_usernet', 45eeba3d73SThomas Huth 'version', 46eeba3d73SThomas Huth] 47eeba3d73SThomas Huth 4814973778SThomas Huthtests_generic_linuxuser = [ 4914973778SThomas Huth] 5014973778SThomas Huth 5114973778SThomas Huthtests_generic_bsduser = [ 5214973778SThomas Huth] 5314973778SThomas Huth 548f16cd80SPhilippe Mathieu-Daudétests_aarch64_system_thorough = [ 55c95309b2SCédric Le Goater 'aarch64_aspeed', 56471f7ff7SPhilippe Mathieu-Daudé 'aarch64_raspi3', 57547738beSPhilippe Mathieu-Daudé 'aarch64_raspi4', 588f16cd80SPhilippe Mathieu-Daudé 'aarch64_sbsaref', 599acd3884SThomas Huth 'aarch64_sbsaref_alpine', 609acd3884SThomas Huth 'aarch64_sbsaref_freebsd', 6137136902SThomas Huth 'aarch64_tuxrun', 621255f5e4SPhilippe Mathieu-Daudé 'aarch64_virt', 6369e4fbd0SThomas Huth 'multiprocess', 648f16cd80SPhilippe Mathieu-Daudé] 658f16cd80SPhilippe Mathieu-Daudé 669a76bc04SThomas Huthtests_alpha_system_thorough = [ 679a76bc04SThomas Huth 'alpha_clipper', 689a76bc04SThomas Huth] 699a76bc04SThomas Huth 70e3fc99b1SThomas Huthtests_arm_system_thorough = [ 71f04cb2d0SCédric Le Goater 'arm_aspeed', 72e50c7285SCédric Le Goater 'arm_aspeed_ast1030', 73e517cff7SCédric Le Goater 'arm_aspeed_palmetto', 745f2b9738SCédric Le Goater 'arm_aspeed_romulus', 75*08743dbaSCédric Le Goater 'arm_aspeed_ast2500', 76f7d6b772SThomas Huth 'arm_bpim2u', 77e3fc99b1SThomas Huth 'arm_canona1100', 78aff83583SPeter Maydell 'arm_collie', 79ef83aea0SPhilippe Mathieu-Daudé 'arm_integratorcp', 80380f7268SThomas Huth 'arm_orangepi', 81165ab274SPhilippe Mathieu-Daudé 'arm_raspi2', 82bc4d45b2SPeter Maydell 'arm_sx1', 83c3cff727SThomas Huth 'arm_vexpress', 84de9f57a6SThomas Huth 'arm_tuxrun', 85e3fc99b1SThomas Huth] 86e3fc99b1SThomas Huth 8734917eadSPhilippe Mathieu-Daudétests_arm_linuxuser_thorough = [ 8834917eadSPhilippe Mathieu-Daudé 'arm_bflt', 8934917eadSPhilippe Mathieu-Daudé] 9034917eadSPhilippe Mathieu-Daudé 914c0a2df8SThomas Huthtests_avr_system_thorough = [ 924c0a2df8SThomas Huth 'avr_mega2560', 934c0a2df8SThomas Huth] 944c0a2df8SThomas Huth 954007fc94SThomas Huthtests_i386_system_thorough = [ 964007fc94SThomas Huth 'i386_tuxrun', 974007fc94SThomas Huth] 984007fc94SThomas Huth 994c0a2df8SThomas Huthtests_loongarch64_system_thorough = [ 1004c0a2df8SThomas Huth 'loongarch64_virt', 1014c0a2df8SThomas Huth] 1024c0a2df8SThomas Huth 103576fffbcSThomas Huthtests_m68k_system_thorough = [ 1049f989d65SThomas Huth 'm68k_mcf5208evb', 105c7f3663cSThomas Huth 'm68k_nextcube', 106c7f3663cSThomas Huth 'm68k_q800', 107576fffbcSThomas Huth] 108576fffbcSThomas Huth 109624fb343SThomas Huthtests_microblaze_system_thorough = [ 110624fb343SThomas Huth 'microblaze_s3adsp1800' 111624fb343SThomas Huth] 112624fb343SThomas Huth 113624fb343SThomas Huthtests_microblazeel_system_thorough = [ 114624fb343SThomas Huth 'microblazeel_s3adsp1800' 115624fb343SThomas Huth] 116624fb343SThomas Huth 11779cb4a14SPhilippe Mathieu-Daudétests_mips_system_thorough = [ 11879cb4a14SPhilippe Mathieu-Daudé 'mips_malta', 11987cab1aeSThomas Huth 'mips_tuxrun', 12079cb4a14SPhilippe Mathieu-Daudé] 12179cb4a14SPhilippe Mathieu-Daudé 122a4b60becSPhilippe Mathieu-Daudétests_mipsel_system_thorough = [ 123a4b60becSPhilippe Mathieu-Daudé 'mipsel_malta', 12455716a89SThomas Huth 'mipsel_tuxrun', 125a4b60becSPhilippe Mathieu-Daudé] 126a4b60becSPhilippe Mathieu-Daudé 127a01be218SThomas Huthtests_mips64_system_thorough = [ 128a01be218SThomas Huth 'mips64_tuxrun', 129a01be218SThomas Huth] 130a01be218SThomas Huth 1314c0a2df8SThomas Huthtests_mips64el_system_thorough = [ 1320d2a8acfSThomas Huth 'mips64el_fuloong2e', 1334c0a2df8SThomas Huth 'mips64el_loongson3v', 134fcf2658bSPhilippe Mathieu-Daudé 'mips64el_malta', 135a2a2a5b0SThomas Huth 'mips64el_tuxrun', 1364c0a2df8SThomas Huth] 1374c0a2df8SThomas Huth 1380addb05aSThomas Huthtests_or1k_system_thorough = [ 1393a07875fSThomas Huth 'or1k_sim', 1403a07875fSThomas Huth] 1413a07875fSThomas Huth 1424c0a2df8SThomas Huthtests_ppc_system_quick = [ 1434c0a2df8SThomas Huth 'ppc_74xx', 1444c0a2df8SThomas Huth] 1454c0a2df8SThomas Huth 1464c0a2df8SThomas Huthtests_ppc_system_thorough = [ 1474c0a2df8SThomas Huth 'ppc_405', 148407a6883SThomas Huth 'ppc_40p', 149cef1becbSThomas Huth 'ppc_amiga', 150e3fc99b1SThomas Huth 'ppc_bamboo', 15112c0b407SThomas Huth 'ppc_mac', 152407a6883SThomas Huth 'ppc_mpc8544ds', 1539ca8239aSThomas Huth 'ppc_tuxrun', 154407a6883SThomas Huth 'ppc_virtex_ml507', 155407a6883SThomas Huth] 156407a6883SThomas Huth 157407a6883SThomas Huthtests_ppc64_system_thorough = [ 15853a62fdeSThomas Huth 'ppc64_e500', 15988c90719SThomas Huth 'ppc64_hv', 160407a6883SThomas Huth 'ppc64_powernv', 161407a6883SThomas Huth 'ppc64_pseries', 162e6a401d7SThomas Huth 'ppc64_tuxrun', 163e3fc99b1SThomas Huth] 164e3fc99b1SThomas Huth 1656a564c8aSThomas Huthtests_riscv32_system_quick = [ 1666a564c8aSThomas Huth 'riscv_opensbi', 167d5674412SThomas Huth] 168d5674412SThomas Huth 16977bc76c7SThomas Huthtests_riscv32_system_thorough = [ 17077bc76c7SThomas Huth 'riscv32_tuxrun', 17177bc76c7SThomas Huth] 17277bc76c7SThomas Huth 1736a564c8aSThomas Huthtests_riscv64_system_quick = [ 1746a564c8aSThomas Huth 'riscv_opensbi', 1756a564c8aSThomas Huth] 1766a564c8aSThomas Huth 1777746a6c4SThomas Huthtests_riscv64_system_thorough = [ 1787746a6c4SThomas Huth 'riscv64_tuxrun', 1797746a6c4SThomas Huth] 1807746a6c4SThomas Huth 1816a564c8aSThomas Huthtests_rx_system_thorough = [ 1826a564c8aSThomas Huth 'rx_gdbsim', 1836a564c8aSThomas Huth] 1846a564c8aSThomas Huth 185e2e9fd25SThomas Huthtests_s390x_system_thorough = [ 186e2e9fd25SThomas Huth 's390x_ccw_virtio', 187e2e9fd25SThomas Huth 's390x_topology', 188e6a401d7SThomas Huth 's390x_tuxrun', 189e2e9fd25SThomas Huth] 190e2e9fd25SThomas Huth 191a94bfe1bSThomas Huthtests_sh4_system_thorough = [ 192a94bfe1bSThomas Huth 'sh4_r2d', 193c592ff35SThomas Huth 'sh4_tuxrun', 194a94bfe1bSThomas Huth] 195a94bfe1bSThomas Huth 19662728ddcSThomas Huthtests_sh4eb_system_thorough = [ 19762728ddcSThomas Huth 'sh4eb_r2d', 19862728ddcSThomas Huth] 199c592ff35SThomas Huth 200f90527d3SThomas Huthtests_sparc_system_thorough = [ 201f90527d3SThomas Huth 'sparc_sun4m', 202f90527d3SThomas Huth] 203f90527d3SThomas Huth 204e3fc99b1SThomas Huthtests_sparc64_system_thorough = [ 205e3fc99b1SThomas Huth 'sparc64_sun4u', 206116667aaSThomas Huth 'sparc64_tuxrun', 2074c0a2df8SThomas Huth] 2084c0a2df8SThomas Huth 20914973778SThomas Huthtests_x86_64_system_quick = [ 210cce85725SThomas Huth 'cpu_queries', 211cce85725SThomas Huth 'mem_addr_space', 212cce85725SThomas Huth 'pc_cpu_hotplug_props', 213cce85725SThomas Huth 'virtio_version', 214be849ef7SThomas Huth 'x86_cpu_model_versions', 21514973778SThomas Huth] 21614973778SThomas Huth 21714973778SThomas Huthtests_x86_64_system_thorough = [ 21805caa062SThomas Huth 'acpi_bits', 2197cea8fe3SThomas Huth 'x86_64_tuxrun', 2208dcac1cfSThomas Huth 'linux_initrd', 22169e4fbd0SThomas Huth 'multiprocess', 2224c0a2df8SThomas Huth 'netdev_ethtool', 223239d08aaSThomas Huth 'virtio_gpu', 22414973778SThomas Huth] 22514973778SThomas Huth 226d1939097SThomas Huthtests_xtensa_system_thorough = [ 227d1939097SThomas Huth 'xtensa_lx60', 228d1939097SThomas Huth] 229d1939097SThomas Huth 230f57213f8SDaniel P. Berrangéprecache_all = [] 23114973778SThomas Huthforeach speed : ['quick', 'thorough'] 23214973778SThomas Huth foreach dir : target_dirs 23314973778SThomas Huth 23414973778SThomas Huth target_base = dir.split('-')[0] 23514973778SThomas Huth 23614973778SThomas Huth if dir.endswith('-softmmu') 23714973778SThomas Huth sysmode = 'system' 23814973778SThomas Huth test_emulator = emulators['qemu-system-' + target_base] 23914973778SThomas Huth elif dir.endswith('-linux-user') 24014973778SThomas Huth sysmode = 'linuxuser' 24114973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 24214973778SThomas Huth elif dir.endswith('-bsd-user') 24314973778SThomas Huth sysmode = 'bsduser' 24414973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 24514973778SThomas Huth else 24614973778SThomas Huth continue 24714973778SThomas Huth endif 24814973778SThomas Huth 24914973778SThomas Huth if speed == 'quick' 25014973778SThomas Huth suites = ['func-quick', 'func-' + target_base] 25114973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \ 25214973778SThomas Huth + get_variable('tests_generic_' + sysmode) 25314973778SThomas Huth else 25414973778SThomas Huth suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed] 25514973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, []) 25614973778SThomas Huth endif 25714973778SThomas Huth 25814973778SThomas Huth test_deps = roms 25914973778SThomas Huth test_env = environment() 26014973778SThomas Huth if have_tools 26114973778SThomas Huth test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img') 26214973778SThomas Huth test_deps += [qemu_img] 26314973778SThomas Huth endif 26414973778SThomas Huth test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path()) 26514973778SThomas Huth test_env.set('QEMU_BUILD_ROOT', meson.project_build_root()) 26614973778SThomas Huth test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 26714973778SThomas Huth meson.current_source_dir()) 26814973778SThomas Huth 26914973778SThomas Huth foreach test : target_tests 270f57213f8SDaniel P. Berrangé testname = '@0@-@1@'.format(target_base, test) 271f57213f8SDaniel P. Berrangé testfile = 'test_' + test + '.py' 272f57213f8SDaniel P. Berrangé testpath = meson.current_source_dir() / testfile 273f57213f8SDaniel P. Berrangé teststamp = testname + '.tstamp' 274f57213f8SDaniel P. Berrangé test_precache_env = environment() 275f57213f8SDaniel P. Berrangé test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp) 276f57213f8SDaniel P. Berrangé test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 277f57213f8SDaniel P. Berrangé meson.current_source_dir()) 278f57213f8SDaniel P. Berrangé precache = custom_target('func-precache-' + testname, 279f57213f8SDaniel P. Berrangé output: teststamp, 280f57213f8SDaniel P. Berrangé command: [python, testpath], 281f57213f8SDaniel P. Berrangé depend_files: files(testpath), 282f57213f8SDaniel P. Berrangé build_by_default: false, 283f57213f8SDaniel P. Berrangé env: test_precache_env) 284f57213f8SDaniel P. Berrangé precache_all += precache 285f57213f8SDaniel P. Berrangé 286f57213f8SDaniel P. Berrangé # Ideally we would add 'precache' to 'depends' here, such that 287f57213f8SDaniel P. Berrangé # 'build_by_default: false' lets the pre-caching automatically 288f57213f8SDaniel P. Berrangé # run immediately before the test runs. In practice this is 289f57213f8SDaniel P. Berrangé # broken in meson, with it running the pre-caching in the normal 290f57213f8SDaniel P. Berrangé # compile phase https://github.com/mesonbuild/meson/issues/2518 291f57213f8SDaniel P. Berrangé # If the above bug ever gets fixed, when QEMU changes the min 292f57213f8SDaniel P. Berrangé # meson version, add the 'depends' and remove the custom 293f57213f8SDaniel P. Berrangé # 'run_target' logic below & in Makefile.include 294f57213f8SDaniel P. Berrangé test('func-' + testname, 29514973778SThomas Huth python, 29614973778SThomas Huth depends: [test_deps, test_emulator, emulator_modules], 29714973778SThomas Huth env: test_env, 298f57213f8SDaniel P. Berrangé args: [testpath], 29914973778SThomas Huth protocol: 'tap', 300f5ccd7e0SThomas Huth timeout: test_timeouts.get(test, 90), 301f5ccd7e0SThomas Huth priority: test_timeouts.get(test, 90), 30214973778SThomas Huth suite: suites) 30314973778SThomas Huth endforeach 30414973778SThomas Huth endforeach 30514973778SThomas Huthendforeach 306f57213f8SDaniel P. Berrangé 307f57213f8SDaniel P. Berrangérun_target('precache-functional', 308f57213f8SDaniel P. Berrangé depends: precache_all, 309f57213f8SDaniel P. Berrangé command: ['true']) 310