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 = { 14*8f16cd80SPhilippe Mathieu-Daudé 'aarch64_sbsaref' : 600, 1505caa062SThomas Huth 'acpi_bits' : 240, 164c0a2df8SThomas Huth 'netdev_ethtool' : 180, 17407a6883SThomas Huth 'ppc_40p' : 240, 1888c90719SThomas Huth 'ppc64_hv' : 1000, 19407a6883SThomas Huth 'ppc64_powernv' : 120, 20407a6883SThomas Huth 'ppc64_pseries' : 120, 21e2e9fd25SThomas Huth 's390x_ccw_virtio' : 180, 2214973778SThomas Huth} 2314973778SThomas Huth 2414973778SThomas Huthtests_generic_system = [ 25cce85725SThomas Huth 'empty_cpu_model', 26eeba3d73SThomas Huth 'info_usernet', 27eeba3d73SThomas Huth 'version', 28eeba3d73SThomas Huth] 29eeba3d73SThomas Huth 3014973778SThomas Huthtests_generic_linuxuser = [ 3114973778SThomas Huth] 3214973778SThomas Huth 3314973778SThomas Huthtests_generic_bsduser = [ 3414973778SThomas Huth] 3514973778SThomas Huth 36*8f16cd80SPhilippe Mathieu-Daudétests_aarch64_system_thorough = [ 37*8f16cd80SPhilippe Mathieu-Daudé 'aarch64_sbsaref', 38*8f16cd80SPhilippe Mathieu-Daudé] 39*8f16cd80SPhilippe Mathieu-Daudé 40e3fc99b1SThomas Huthtests_arm_system_thorough = [ 41e3fc99b1SThomas Huth 'arm_canona1100', 42ef83aea0SPhilippe Mathieu-Daudé 'arm_integratorcp', 43e3fc99b1SThomas Huth] 44e3fc99b1SThomas Huth 454c0a2df8SThomas Huthtests_avr_system_thorough = [ 464c0a2df8SThomas Huth 'avr_mega2560', 474c0a2df8SThomas Huth] 484c0a2df8SThomas Huth 494c0a2df8SThomas Huthtests_loongarch64_system_thorough = [ 504c0a2df8SThomas Huth 'loongarch64_virt', 514c0a2df8SThomas Huth] 524c0a2df8SThomas Huth 53576fffbcSThomas Huthtests_m68k_system_thorough = [ 54576fffbcSThomas Huth 'm68k_nextcube' 55576fffbcSThomas Huth] 56576fffbcSThomas Huth 57624fb343SThomas Huthtests_microblaze_system_thorough = [ 58624fb343SThomas Huth 'microblaze_s3adsp1800' 59624fb343SThomas Huth] 60624fb343SThomas Huth 61624fb343SThomas Huthtests_microblazeel_system_thorough = [ 62624fb343SThomas Huth 'microblazeel_s3adsp1800' 63624fb343SThomas Huth] 64624fb343SThomas Huth 654c0a2df8SThomas Huthtests_mips64el_system_thorough = [ 664c0a2df8SThomas Huth 'mips64el_loongson3v', 674c0a2df8SThomas Huth] 684c0a2df8SThomas Huth 694c0a2df8SThomas Huthtests_ppc_system_quick = [ 704c0a2df8SThomas Huth 'ppc_74xx', 714c0a2df8SThomas Huth] 724c0a2df8SThomas Huth 734c0a2df8SThomas Huthtests_ppc_system_thorough = [ 744c0a2df8SThomas Huth 'ppc_405', 75407a6883SThomas Huth 'ppc_40p', 76cef1becbSThomas Huth 'ppc_amiga', 77e3fc99b1SThomas Huth 'ppc_bamboo', 78407a6883SThomas Huth 'ppc_mpc8544ds', 79407a6883SThomas Huth 'ppc_virtex_ml507', 80407a6883SThomas Huth] 81407a6883SThomas Huth 82407a6883SThomas Huthtests_ppc64_system_thorough = [ 8388c90719SThomas Huth 'ppc64_hv', 84407a6883SThomas Huth 'ppc64_powernv', 85407a6883SThomas Huth 'ppc64_pseries', 86e3fc99b1SThomas Huth] 87e3fc99b1SThomas Huth 88d5674412SThomas Huthtests_rx_system_thorough = [ 89d5674412SThomas Huth 'rx_gdbsim', 90d5674412SThomas Huth] 91d5674412SThomas Huth 92e2e9fd25SThomas Huthtests_s390x_system_thorough = [ 93e2e9fd25SThomas Huth 's390x_ccw_virtio', 94e2e9fd25SThomas Huth 's390x_topology', 95e2e9fd25SThomas Huth] 96e2e9fd25SThomas Huth 97e3fc99b1SThomas Huthtests_sparc64_system_thorough = [ 98e3fc99b1SThomas Huth 'sparc64_sun4u', 994c0a2df8SThomas Huth] 1004c0a2df8SThomas Huth 10114973778SThomas Huthtests_x86_64_system_quick = [ 102cce85725SThomas Huth 'cpu_queries', 103cce85725SThomas Huth 'mem_addr_space', 104cce85725SThomas Huth 'pc_cpu_hotplug_props', 105cce85725SThomas Huth 'virtio_version', 106be849ef7SThomas Huth 'x86_cpu_model_versions', 10714973778SThomas Huth] 10814973778SThomas Huth 10914973778SThomas Huthtests_x86_64_system_thorough = [ 11005caa062SThomas Huth 'acpi_bits', 1118dcac1cfSThomas Huth 'linux_initrd', 1124c0a2df8SThomas Huth 'netdev_ethtool', 113239d08aaSThomas Huth 'virtio_gpu', 11414973778SThomas Huth] 11514973778SThomas Huth 116f57213f8SDaniel P. Berrangéprecache_all = [] 11714973778SThomas Huthforeach speed : ['quick', 'thorough'] 11814973778SThomas Huth foreach dir : target_dirs 11914973778SThomas Huth 12014973778SThomas Huth target_base = dir.split('-')[0] 12114973778SThomas Huth 12214973778SThomas Huth if dir.endswith('-softmmu') 12314973778SThomas Huth sysmode = 'system' 12414973778SThomas Huth test_emulator = emulators['qemu-system-' + target_base] 12514973778SThomas Huth elif dir.endswith('-linux-user') 12614973778SThomas Huth sysmode = 'linuxuser' 12714973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 12814973778SThomas Huth elif dir.endswith('-bsd-user') 12914973778SThomas Huth sysmode = 'bsduser' 13014973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 13114973778SThomas Huth else 13214973778SThomas Huth continue 13314973778SThomas Huth endif 13414973778SThomas Huth 13514973778SThomas Huth if speed == 'quick' 13614973778SThomas Huth suites = ['func-quick', 'func-' + target_base] 13714973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \ 13814973778SThomas Huth + get_variable('tests_generic_' + sysmode) 13914973778SThomas Huth else 14014973778SThomas Huth suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed] 14114973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, []) 14214973778SThomas Huth endif 14314973778SThomas Huth 14414973778SThomas Huth test_deps = roms 14514973778SThomas Huth test_env = environment() 14614973778SThomas Huth if have_tools 14714973778SThomas Huth test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img') 14814973778SThomas Huth test_deps += [qemu_img] 14914973778SThomas Huth endif 15014973778SThomas Huth test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path()) 15114973778SThomas Huth test_env.set('QEMU_BUILD_ROOT', meson.project_build_root()) 15214973778SThomas Huth test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 15314973778SThomas Huth meson.current_source_dir()) 15414973778SThomas Huth 15514973778SThomas Huth foreach test : target_tests 156f57213f8SDaniel P. Berrangé testname = '@0@-@1@'.format(target_base, test) 157f57213f8SDaniel P. Berrangé testfile = 'test_' + test + '.py' 158f57213f8SDaniel P. Berrangé testpath = meson.current_source_dir() / testfile 159f57213f8SDaniel P. Berrangé teststamp = testname + '.tstamp' 160f57213f8SDaniel P. Berrangé test_precache_env = environment() 161f57213f8SDaniel P. Berrangé test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp) 162f57213f8SDaniel P. Berrangé test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 163f57213f8SDaniel P. Berrangé meson.current_source_dir()) 164f57213f8SDaniel P. Berrangé precache = custom_target('func-precache-' + testname, 165f57213f8SDaniel P. Berrangé output: teststamp, 166f57213f8SDaniel P. Berrangé command: [python, testpath], 167f57213f8SDaniel P. Berrangé depend_files: files(testpath), 168f57213f8SDaniel P. Berrangé build_by_default: false, 169f57213f8SDaniel P. Berrangé env: test_precache_env) 170f57213f8SDaniel P. Berrangé precache_all += precache 171f57213f8SDaniel P. Berrangé 172f57213f8SDaniel P. Berrangé # Ideally we would add 'precache' to 'depends' here, such that 173f57213f8SDaniel P. Berrangé # 'build_by_default: false' lets the pre-caching automatically 174f57213f8SDaniel P. Berrangé # run immediately before the test runs. In practice this is 175f57213f8SDaniel P. Berrangé # broken in meson, with it running the pre-caching in the normal 176f57213f8SDaniel P. Berrangé # compile phase https://github.com/mesonbuild/meson/issues/2518 177f57213f8SDaniel P. Berrangé # If the above bug ever gets fixed, when QEMU changes the min 178f57213f8SDaniel P. Berrangé # meson version, add the 'depends' and remove the custom 179f57213f8SDaniel P. Berrangé # 'run_target' logic below & in Makefile.include 180f57213f8SDaniel P. Berrangé test('func-' + testname, 18114973778SThomas Huth python, 18214973778SThomas Huth depends: [test_deps, test_emulator, emulator_modules], 18314973778SThomas Huth env: test_env, 184f57213f8SDaniel P. Berrangé args: [testpath], 18514973778SThomas Huth protocol: 'tap', 18614973778SThomas Huth timeout: test_timeouts.get(test, 60), 18714973778SThomas Huth priority: test_timeouts.get(test, 60), 18814973778SThomas Huth suite: suites) 18914973778SThomas Huth endforeach 19014973778SThomas Huth endforeach 19114973778SThomas Huthendforeach 192f57213f8SDaniel P. Berrangé 193f57213f8SDaniel P. Berrangérun_target('precache-functional', 194f57213f8SDaniel P. Berrangé depends: precache_all, 195f57213f8SDaniel P. Berrangé command: ['true']) 196