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', 428f16cd80SPhilippe Mathieu-Daudé] 438f16cd80SPhilippe Mathieu-Daudé 449a76bc04SThomas Huthtests_alpha_system_thorough = [ 459a76bc04SThomas Huth 'alpha_clipper', 469a76bc04SThomas Huth] 479a76bc04SThomas Huth 48e3fc99b1SThomas Huthtests_arm_system_thorough = [ 49e3fc99b1SThomas Huth 'arm_canona1100', 50ef83aea0SPhilippe Mathieu-Daudé 'arm_integratorcp', 51165ab274SPhilippe Mathieu-Daudé 'arm_raspi2', 52e3fc99b1SThomas Huth] 53e3fc99b1SThomas Huth 5434917eadSPhilippe Mathieu-Daudétests_arm_linuxuser_thorough = [ 5534917eadSPhilippe Mathieu-Daudé 'arm_bflt', 5634917eadSPhilippe Mathieu-Daudé] 5734917eadSPhilippe Mathieu-Daudé 584c0a2df8SThomas Huthtests_avr_system_thorough = [ 594c0a2df8SThomas Huth 'avr_mega2560', 604c0a2df8SThomas Huth] 614c0a2df8SThomas Huth 624c0a2df8SThomas Huthtests_loongarch64_system_thorough = [ 634c0a2df8SThomas Huth 'loongarch64_virt', 644c0a2df8SThomas Huth] 654c0a2df8SThomas Huth 66576fffbcSThomas Huthtests_m68k_system_thorough = [ 67*9f989d65SThomas Huth 'm68k_mcf5208evb', 68c7f3663cSThomas Huth 'm68k_nextcube', 69c7f3663cSThomas Huth 'm68k_q800', 70576fffbcSThomas Huth] 71576fffbcSThomas Huth 72624fb343SThomas Huthtests_microblaze_system_thorough = [ 73624fb343SThomas Huth 'microblaze_s3adsp1800' 74624fb343SThomas Huth] 75624fb343SThomas Huth 76624fb343SThomas Huthtests_microblazeel_system_thorough = [ 77624fb343SThomas Huth 'microblazeel_s3adsp1800' 78624fb343SThomas Huth] 79624fb343SThomas Huth 8079cb4a14SPhilippe Mathieu-Daudétests_mips_system_thorough = [ 8179cb4a14SPhilippe Mathieu-Daudé 'mips_malta', 8279cb4a14SPhilippe Mathieu-Daudé] 8379cb4a14SPhilippe Mathieu-Daudé 84a4b60becSPhilippe Mathieu-Daudétests_mipsel_system_thorough = [ 85a4b60becSPhilippe Mathieu-Daudé 'mipsel_malta', 86a4b60becSPhilippe Mathieu-Daudé] 87a4b60becSPhilippe Mathieu-Daudé 88bce9e484SPhilippe Mathieu-Daudétests_mips64el_system_quick = [ 89bce9e484SPhilippe Mathieu-Daudé 'mips64el_fuloong2e', 90bce9e484SPhilippe Mathieu-Daudé] 91bce9e484SPhilippe Mathieu-Daudé 924c0a2df8SThomas Huthtests_mips64el_system_thorough = [ 934c0a2df8SThomas Huth 'mips64el_loongson3v', 94fcf2658bSPhilippe Mathieu-Daudé 'mips64el_malta', 954c0a2df8SThomas Huth] 964c0a2df8SThomas Huth 974c0a2df8SThomas Huthtests_ppc_system_quick = [ 984c0a2df8SThomas Huth 'ppc_74xx', 994c0a2df8SThomas Huth] 1004c0a2df8SThomas Huth 1014c0a2df8SThomas Huthtests_ppc_system_thorough = [ 1024c0a2df8SThomas Huth 'ppc_405', 103407a6883SThomas Huth 'ppc_40p', 104cef1becbSThomas Huth 'ppc_amiga', 105e3fc99b1SThomas Huth 'ppc_bamboo', 106407a6883SThomas Huth 'ppc_mpc8544ds', 107407a6883SThomas Huth 'ppc_virtex_ml507', 108407a6883SThomas Huth] 109407a6883SThomas Huth 110407a6883SThomas Huthtests_ppc64_system_thorough = [ 11188c90719SThomas Huth 'ppc64_hv', 112407a6883SThomas Huth 'ppc64_powernv', 113407a6883SThomas Huth 'ppc64_pseries', 114e3fc99b1SThomas Huth] 115e3fc99b1SThomas Huth 116d5674412SThomas Huthtests_rx_system_thorough = [ 117d5674412SThomas Huth 'rx_gdbsim', 118d5674412SThomas Huth] 119d5674412SThomas Huth 120e2e9fd25SThomas Huthtests_s390x_system_thorough = [ 121e2e9fd25SThomas Huth 's390x_ccw_virtio', 122e2e9fd25SThomas Huth 's390x_topology', 123e2e9fd25SThomas Huth] 124e2e9fd25SThomas Huth 125e3fc99b1SThomas Huthtests_sparc64_system_thorough = [ 126e3fc99b1SThomas Huth 'sparc64_sun4u', 1274c0a2df8SThomas Huth] 1284c0a2df8SThomas Huth 12914973778SThomas Huthtests_x86_64_system_quick = [ 130cce85725SThomas Huth 'cpu_queries', 131cce85725SThomas Huth 'mem_addr_space', 132cce85725SThomas Huth 'pc_cpu_hotplug_props', 133cce85725SThomas Huth 'virtio_version', 134be849ef7SThomas Huth 'x86_cpu_model_versions', 13514973778SThomas Huth] 13614973778SThomas Huth 13714973778SThomas Huthtests_x86_64_system_thorough = [ 13805caa062SThomas Huth 'acpi_bits', 1398dcac1cfSThomas Huth 'linux_initrd', 1404c0a2df8SThomas Huth 'netdev_ethtool', 141239d08aaSThomas Huth 'virtio_gpu', 14214973778SThomas Huth] 14314973778SThomas Huth 144f57213f8SDaniel P. Berrangéprecache_all = [] 14514973778SThomas Huthforeach speed : ['quick', 'thorough'] 14614973778SThomas Huth foreach dir : target_dirs 14714973778SThomas Huth 14814973778SThomas Huth target_base = dir.split('-')[0] 14914973778SThomas Huth 15014973778SThomas Huth if dir.endswith('-softmmu') 15114973778SThomas Huth sysmode = 'system' 15214973778SThomas Huth test_emulator = emulators['qemu-system-' + target_base] 15314973778SThomas Huth elif dir.endswith('-linux-user') 15414973778SThomas Huth sysmode = 'linuxuser' 15514973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 15614973778SThomas Huth elif dir.endswith('-bsd-user') 15714973778SThomas Huth sysmode = 'bsduser' 15814973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 15914973778SThomas Huth else 16014973778SThomas Huth continue 16114973778SThomas Huth endif 16214973778SThomas Huth 16314973778SThomas Huth if speed == 'quick' 16414973778SThomas Huth suites = ['func-quick', 'func-' + target_base] 16514973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \ 16614973778SThomas Huth + get_variable('tests_generic_' + sysmode) 16714973778SThomas Huth else 16814973778SThomas Huth suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed] 16914973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, []) 17014973778SThomas Huth endif 17114973778SThomas Huth 17214973778SThomas Huth test_deps = roms 17314973778SThomas Huth test_env = environment() 17414973778SThomas Huth if have_tools 17514973778SThomas Huth test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img') 17614973778SThomas Huth test_deps += [qemu_img] 17714973778SThomas Huth endif 17814973778SThomas Huth test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path()) 17914973778SThomas Huth test_env.set('QEMU_BUILD_ROOT', meson.project_build_root()) 18014973778SThomas Huth test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 18114973778SThomas Huth meson.current_source_dir()) 18214973778SThomas Huth 18314973778SThomas Huth foreach test : target_tests 184f57213f8SDaniel P. Berrangé testname = '@0@-@1@'.format(target_base, test) 185f57213f8SDaniel P. Berrangé testfile = 'test_' + test + '.py' 186f57213f8SDaniel P. Berrangé testpath = meson.current_source_dir() / testfile 187f57213f8SDaniel P. Berrangé teststamp = testname + '.tstamp' 188f57213f8SDaniel P. Berrangé test_precache_env = environment() 189f57213f8SDaniel P. Berrangé test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp) 190f57213f8SDaniel P. Berrangé test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 191f57213f8SDaniel P. Berrangé meson.current_source_dir()) 192f57213f8SDaniel P. Berrangé precache = custom_target('func-precache-' + testname, 193f57213f8SDaniel P. Berrangé output: teststamp, 194f57213f8SDaniel P. Berrangé command: [python, testpath], 195f57213f8SDaniel P. Berrangé depend_files: files(testpath), 196f57213f8SDaniel P. Berrangé build_by_default: false, 197f57213f8SDaniel P. Berrangé env: test_precache_env) 198f57213f8SDaniel P. Berrangé precache_all += precache 199f57213f8SDaniel P. Berrangé 200f57213f8SDaniel P. Berrangé # Ideally we would add 'precache' to 'depends' here, such that 201f57213f8SDaniel P. Berrangé # 'build_by_default: false' lets the pre-caching automatically 202f57213f8SDaniel P. Berrangé # run immediately before the test runs. In practice this is 203f57213f8SDaniel P. Berrangé # broken in meson, with it running the pre-caching in the normal 204f57213f8SDaniel P. Berrangé # compile phase https://github.com/mesonbuild/meson/issues/2518 205f57213f8SDaniel P. Berrangé # If the above bug ever gets fixed, when QEMU changes the min 206f57213f8SDaniel P. Berrangé # meson version, add the 'depends' and remove the custom 207f57213f8SDaniel P. Berrangé # 'run_target' logic below & in Makefile.include 208f57213f8SDaniel P. Berrangé test('func-' + testname, 20914973778SThomas Huth python, 21014973778SThomas Huth depends: [test_deps, test_emulator, emulator_modules], 21114973778SThomas Huth env: test_env, 212f57213f8SDaniel P. Berrangé args: [testpath], 21314973778SThomas Huth protocol: 'tap', 21414973778SThomas Huth timeout: test_timeouts.get(test, 60), 21514973778SThomas Huth priority: test_timeouts.get(test, 60), 21614973778SThomas Huth suite: suites) 21714973778SThomas Huth endforeach 21814973778SThomas Huth endforeach 21914973778SThomas Huthendforeach 220f57213f8SDaniel P. Berrangé 221f57213f8SDaniel P. Berrangérun_target('precache-functional', 222f57213f8SDaniel P. Berrangé depends: precache_all, 223f57213f8SDaniel P. Berrangé command: ['true']) 224