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 = { 148f16cd80SPhilippe Mathieu-Daudé 'aarch64_sbsaref' : 600, 151255f5e4SPhilippe Mathieu-Daudé 'aarch64_virt' : 360, 1605caa062SThomas Huth 'acpi_bits' : 240, 174c0a2df8SThomas Huth 'netdev_ethtool' : 180, 18407a6883SThomas Huth 'ppc_40p' : 240, 1988c90719SThomas Huth 'ppc64_hv' : 1000, 20407a6883SThomas Huth 'ppc64_powernv' : 120, 21407a6883SThomas Huth 'ppc64_pseries' : 120, 22e2e9fd25SThomas Huth 's390x_ccw_virtio' : 180, 2314973778SThomas Huth} 2414973778SThomas Huth 2514973778SThomas Huthtests_generic_system = [ 26cce85725SThomas Huth 'empty_cpu_model', 27eeba3d73SThomas Huth 'info_usernet', 28eeba3d73SThomas Huth 'version', 29eeba3d73SThomas Huth] 30eeba3d73SThomas Huth 3114973778SThomas Huthtests_generic_linuxuser = [ 3214973778SThomas Huth] 3314973778SThomas Huth 3414973778SThomas Huthtests_generic_bsduser = [ 3514973778SThomas Huth] 3614973778SThomas Huth 378f16cd80SPhilippe Mathieu-Daudétests_aarch64_system_thorough = [ 38471f7ff7SPhilippe Mathieu-Daudé 'aarch64_raspi3', 39547738beSPhilippe Mathieu-Daudé 'aarch64_raspi4', 408f16cd80SPhilippe Mathieu-Daudé 'aarch64_sbsaref', 411255f5e4SPhilippe Mathieu-Daudé 'aarch64_virt', 4269e4fbd0SThomas Huth 'multiprocess', 438f16cd80SPhilippe Mathieu-Daudé] 448f16cd80SPhilippe Mathieu-Daudé 459a76bc04SThomas Huthtests_alpha_system_thorough = [ 469a76bc04SThomas Huth 'alpha_clipper', 479a76bc04SThomas Huth] 489a76bc04SThomas Huth 49e3fc99b1SThomas Huthtests_arm_system_thorough = [ 50e3fc99b1SThomas Huth 'arm_canona1100', 51ef83aea0SPhilippe Mathieu-Daudé 'arm_integratorcp', 52165ab274SPhilippe Mathieu-Daudé 'arm_raspi2', 53c3cff727SThomas Huth 'arm_vexpress', 54e3fc99b1SThomas Huth] 55e3fc99b1SThomas Huth 5634917eadSPhilippe Mathieu-Daudétests_arm_linuxuser_thorough = [ 5734917eadSPhilippe Mathieu-Daudé 'arm_bflt', 5834917eadSPhilippe Mathieu-Daudé] 5934917eadSPhilippe Mathieu-Daudé 604c0a2df8SThomas Huthtests_avr_system_thorough = [ 614c0a2df8SThomas Huth 'avr_mega2560', 624c0a2df8SThomas Huth] 634c0a2df8SThomas Huth 644c0a2df8SThomas Huthtests_loongarch64_system_thorough = [ 654c0a2df8SThomas Huth 'loongarch64_virt', 664c0a2df8SThomas Huth] 674c0a2df8SThomas Huth 68576fffbcSThomas Huthtests_m68k_system_thorough = [ 699f989d65SThomas Huth 'm68k_mcf5208evb', 70c7f3663cSThomas Huth 'm68k_nextcube', 71c7f3663cSThomas Huth 'm68k_q800', 72576fffbcSThomas Huth] 73576fffbcSThomas Huth 74624fb343SThomas Huthtests_microblaze_system_thorough = [ 75624fb343SThomas Huth 'microblaze_s3adsp1800' 76624fb343SThomas Huth] 77624fb343SThomas Huth 78624fb343SThomas Huthtests_microblazeel_system_thorough = [ 79624fb343SThomas Huth 'microblazeel_s3adsp1800' 80624fb343SThomas Huth] 81624fb343SThomas Huth 8279cb4a14SPhilippe Mathieu-Daudétests_mips_system_thorough = [ 8379cb4a14SPhilippe Mathieu-Daudé 'mips_malta', 8479cb4a14SPhilippe Mathieu-Daudé] 8579cb4a14SPhilippe Mathieu-Daudé 86a4b60becSPhilippe Mathieu-Daudétests_mipsel_system_thorough = [ 87a4b60becSPhilippe Mathieu-Daudé 'mipsel_malta', 88a4b60becSPhilippe Mathieu-Daudé] 89a4b60becSPhilippe Mathieu-Daudé 904c0a2df8SThomas Huthtests_mips64el_system_thorough = [ 910d2a8acfSThomas Huth 'mips64el_fuloong2e', 924c0a2df8SThomas Huth 'mips64el_loongson3v', 93fcf2658bSPhilippe Mathieu-Daudé 'mips64el_malta', 944c0a2df8SThomas Huth] 954c0a2df8SThomas Huth 963a07875fSThomas Huthtests_or1k_system_quick = [ 973a07875fSThomas Huth 'or1k_sim', 983a07875fSThomas Huth] 993a07875fSThomas Huth 1004c0a2df8SThomas Huthtests_ppc_system_quick = [ 1014c0a2df8SThomas Huth 'ppc_74xx', 1024c0a2df8SThomas Huth] 1034c0a2df8SThomas Huth 1044c0a2df8SThomas Huthtests_ppc_system_thorough = [ 1054c0a2df8SThomas Huth 'ppc_405', 106407a6883SThomas Huth 'ppc_40p', 107cef1becbSThomas Huth 'ppc_amiga', 108e3fc99b1SThomas Huth 'ppc_bamboo', 109407a6883SThomas Huth 'ppc_mpc8544ds', 110407a6883SThomas Huth 'ppc_virtex_ml507', 111407a6883SThomas Huth] 112407a6883SThomas Huth 113407a6883SThomas Huthtests_ppc64_system_thorough = [ 11488c90719SThomas Huth 'ppc64_hv', 115407a6883SThomas Huth 'ppc64_powernv', 116407a6883SThomas Huth 'ppc64_pseries', 117e3fc99b1SThomas Huth] 118e3fc99b1SThomas Huth 119d5674412SThomas Huthtests_rx_system_thorough = [ 120d5674412SThomas Huth 'rx_gdbsim', 121d5674412SThomas Huth] 122d5674412SThomas Huth 123e2e9fd25SThomas Huthtests_s390x_system_thorough = [ 124e2e9fd25SThomas Huth 's390x_ccw_virtio', 125e2e9fd25SThomas Huth 's390x_topology', 126e2e9fd25SThomas Huth] 127e2e9fd25SThomas Huth 128*f90527d3SThomas Huthtests_sparc_system_thorough = [ 129*f90527d3SThomas Huth 'sparc_sun4m', 130*f90527d3SThomas Huth] 131*f90527d3SThomas Huth 132e3fc99b1SThomas Huthtests_sparc64_system_thorough = [ 133e3fc99b1SThomas Huth 'sparc64_sun4u', 1344c0a2df8SThomas Huth] 1354c0a2df8SThomas Huth 13614973778SThomas Huthtests_x86_64_system_quick = [ 137cce85725SThomas Huth 'cpu_queries', 138cce85725SThomas Huth 'mem_addr_space', 139cce85725SThomas Huth 'pc_cpu_hotplug_props', 140cce85725SThomas Huth 'virtio_version', 141be849ef7SThomas Huth 'x86_cpu_model_versions', 14214973778SThomas Huth] 14314973778SThomas Huth 14414973778SThomas Huthtests_x86_64_system_thorough = [ 14505caa062SThomas Huth 'acpi_bits', 1468dcac1cfSThomas Huth 'linux_initrd', 14769e4fbd0SThomas Huth 'multiprocess', 1484c0a2df8SThomas Huth 'netdev_ethtool', 149239d08aaSThomas Huth 'virtio_gpu', 15014973778SThomas Huth] 15114973778SThomas Huth 152d1939097SThomas Huthtests_xtensa_system_thorough = [ 153d1939097SThomas Huth 'xtensa_lx60', 154d1939097SThomas Huth] 155d1939097SThomas Huth 156f57213f8SDaniel P. Berrangéprecache_all = [] 15714973778SThomas Huthforeach speed : ['quick', 'thorough'] 15814973778SThomas Huth foreach dir : target_dirs 15914973778SThomas Huth 16014973778SThomas Huth target_base = dir.split('-')[0] 16114973778SThomas Huth 16214973778SThomas Huth if dir.endswith('-softmmu') 16314973778SThomas Huth sysmode = 'system' 16414973778SThomas Huth test_emulator = emulators['qemu-system-' + target_base] 16514973778SThomas Huth elif dir.endswith('-linux-user') 16614973778SThomas Huth sysmode = 'linuxuser' 16714973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 16814973778SThomas Huth elif dir.endswith('-bsd-user') 16914973778SThomas Huth sysmode = 'bsduser' 17014973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 17114973778SThomas Huth else 17214973778SThomas Huth continue 17314973778SThomas Huth endif 17414973778SThomas Huth 17514973778SThomas Huth if speed == 'quick' 17614973778SThomas Huth suites = ['func-quick', 'func-' + target_base] 17714973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \ 17814973778SThomas Huth + get_variable('tests_generic_' + sysmode) 17914973778SThomas Huth else 18014973778SThomas Huth suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed] 18114973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, []) 18214973778SThomas Huth endif 18314973778SThomas Huth 18414973778SThomas Huth test_deps = roms 18514973778SThomas Huth test_env = environment() 18614973778SThomas Huth if have_tools 18714973778SThomas Huth test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img') 18814973778SThomas Huth test_deps += [qemu_img] 18914973778SThomas Huth endif 19014973778SThomas Huth test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path()) 19114973778SThomas Huth test_env.set('QEMU_BUILD_ROOT', meson.project_build_root()) 19214973778SThomas Huth test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 19314973778SThomas Huth meson.current_source_dir()) 19414973778SThomas Huth 19514973778SThomas Huth foreach test : target_tests 196f57213f8SDaniel P. Berrangé testname = '@0@-@1@'.format(target_base, test) 197f57213f8SDaniel P. Berrangé testfile = 'test_' + test + '.py' 198f57213f8SDaniel P. Berrangé testpath = meson.current_source_dir() / testfile 199f57213f8SDaniel P. Berrangé teststamp = testname + '.tstamp' 200f57213f8SDaniel P. Berrangé test_precache_env = environment() 201f57213f8SDaniel P. Berrangé test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp) 202f57213f8SDaniel P. Berrangé test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 203f57213f8SDaniel P. Berrangé meson.current_source_dir()) 204f57213f8SDaniel P. Berrangé precache = custom_target('func-precache-' + testname, 205f57213f8SDaniel P. Berrangé output: teststamp, 206f57213f8SDaniel P. Berrangé command: [python, testpath], 207f57213f8SDaniel P. Berrangé depend_files: files(testpath), 208f57213f8SDaniel P. Berrangé build_by_default: false, 209f57213f8SDaniel P. Berrangé env: test_precache_env) 210f57213f8SDaniel P. Berrangé precache_all += precache 211f57213f8SDaniel P. Berrangé 212f57213f8SDaniel P. Berrangé # Ideally we would add 'precache' to 'depends' here, such that 213f57213f8SDaniel P. Berrangé # 'build_by_default: false' lets the pre-caching automatically 214f57213f8SDaniel P. Berrangé # run immediately before the test runs. In practice this is 215f57213f8SDaniel P. Berrangé # broken in meson, with it running the pre-caching in the normal 216f57213f8SDaniel P. Berrangé # compile phase https://github.com/mesonbuild/meson/issues/2518 217f57213f8SDaniel P. Berrangé # If the above bug ever gets fixed, when QEMU changes the min 218f57213f8SDaniel P. Berrangé # meson version, add the 'depends' and remove the custom 219f57213f8SDaniel P. Berrangé # 'run_target' logic below & in Makefile.include 220f57213f8SDaniel P. Berrangé test('func-' + testname, 22114973778SThomas Huth python, 22214973778SThomas Huth depends: [test_deps, test_emulator, emulator_modules], 22314973778SThomas Huth env: test_env, 224f57213f8SDaniel P. Berrangé args: [testpath], 22514973778SThomas Huth protocol: 'tap', 22614973778SThomas Huth timeout: test_timeouts.get(test, 60), 22714973778SThomas Huth priority: test_timeouts.get(test, 60), 22814973778SThomas Huth suite: suites) 22914973778SThomas Huth endforeach 23014973778SThomas Huth endforeach 23114973778SThomas Huthendforeach 232f57213f8SDaniel P. Berrangé 233f57213f8SDaniel P. Berrangérun_target('precache-functional', 234f57213f8SDaniel P. Berrangé depends: precache_all, 235f57213f8SDaniel P. Berrangé command: ['true']) 236