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 = { 144c0a2df8SThomas Huth 'netdev_ethtool' : 180, 15e2e9fd25SThomas Huth 's390x_ccw_virtio' : 180, 1614973778SThomas Huth} 1714973778SThomas Huth 1814973778SThomas Huthtests_generic_system = [ 19cce85725SThomas Huth 'empty_cpu_model', 20eeba3d73SThomas Huth 'info_usernet', 21eeba3d73SThomas Huth 'version', 22eeba3d73SThomas Huth] 23eeba3d73SThomas Huth 2414973778SThomas Huthtests_generic_linuxuser = [ 2514973778SThomas Huth] 2614973778SThomas Huth 2714973778SThomas Huthtests_generic_bsduser = [ 2814973778SThomas Huth] 2914973778SThomas Huth 30e3fc99b1SThomas Huthtests_arm_system_thorough = [ 31e3fc99b1SThomas Huth 'arm_canona1100', 32e3fc99b1SThomas Huth] 33e3fc99b1SThomas Huth 344c0a2df8SThomas Huthtests_avr_system_thorough = [ 354c0a2df8SThomas Huth 'avr_mega2560', 364c0a2df8SThomas Huth] 374c0a2df8SThomas Huth 384c0a2df8SThomas Huthtests_loongarch64_system_thorough = [ 394c0a2df8SThomas Huth 'loongarch64_virt', 404c0a2df8SThomas Huth] 414c0a2df8SThomas Huth 42624fb343SThomas Huthtests_microblaze_system_thorough = [ 43624fb343SThomas Huth 'microblaze_s3adsp1800' 44624fb343SThomas Huth] 45624fb343SThomas Huth 46624fb343SThomas Huthtests_microblazeel_system_thorough = [ 47624fb343SThomas Huth 'microblazeel_s3adsp1800' 48624fb343SThomas Huth] 49624fb343SThomas Huth 504c0a2df8SThomas Huthtests_mips64el_system_thorough = [ 514c0a2df8SThomas Huth 'mips64el_loongson3v', 524c0a2df8SThomas Huth] 534c0a2df8SThomas Huth 544c0a2df8SThomas Huthtests_ppc_system_quick = [ 554c0a2df8SThomas Huth 'ppc_74xx', 564c0a2df8SThomas Huth] 574c0a2df8SThomas Huth 584c0a2df8SThomas Huthtests_ppc_system_thorough = [ 594c0a2df8SThomas Huth 'ppc_405', 60e3fc99b1SThomas Huth 'ppc_bamboo', 61e3fc99b1SThomas Huth] 62e3fc99b1SThomas Huth 63e2e9fd25SThomas Huthtests_s390x_system_thorough = [ 64e2e9fd25SThomas Huth 's390x_ccw_virtio', 65e2e9fd25SThomas Huth 's390x_topology', 66e2e9fd25SThomas Huth] 67e2e9fd25SThomas Huth 68e3fc99b1SThomas Huthtests_sparc64_system_thorough = [ 69e3fc99b1SThomas Huth 'sparc64_sun4u', 704c0a2df8SThomas Huth] 714c0a2df8SThomas Huth 7214973778SThomas Huthtests_x86_64_system_quick = [ 73cce85725SThomas Huth 'cpu_queries', 74cce85725SThomas Huth 'mem_addr_space', 75cce85725SThomas Huth 'pc_cpu_hotplug_props', 76cce85725SThomas Huth 'virtio_version', 77be849ef7SThomas Huth 'x86_cpu_model_versions', 7814973778SThomas Huth] 7914973778SThomas Huth 8014973778SThomas Huthtests_x86_64_system_thorough = [ 814c0a2df8SThomas Huth 'netdev_ethtool', 82*239d08aaSThomas Huth 'virtio_gpu', 8314973778SThomas Huth] 8414973778SThomas Huth 85f57213f8SDaniel P. Berrangéprecache_all = [] 8614973778SThomas Huthforeach speed : ['quick', 'thorough'] 8714973778SThomas Huth foreach dir : target_dirs 8814973778SThomas Huth 8914973778SThomas Huth target_base = dir.split('-')[0] 9014973778SThomas Huth 9114973778SThomas Huth if dir.endswith('-softmmu') 9214973778SThomas Huth sysmode = 'system' 9314973778SThomas Huth test_emulator = emulators['qemu-system-' + target_base] 9414973778SThomas Huth elif dir.endswith('-linux-user') 9514973778SThomas Huth sysmode = 'linuxuser' 9614973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 9714973778SThomas Huth elif dir.endswith('-bsd-user') 9814973778SThomas Huth sysmode = 'bsduser' 9914973778SThomas Huth test_emulator = emulators['qemu-' + target_base] 10014973778SThomas Huth else 10114973778SThomas Huth continue 10214973778SThomas Huth endif 10314973778SThomas Huth 10414973778SThomas Huth if speed == 'quick' 10514973778SThomas Huth suites = ['func-quick', 'func-' + target_base] 10614973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \ 10714973778SThomas Huth + get_variable('tests_generic_' + sysmode) 10814973778SThomas Huth else 10914973778SThomas Huth suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed] 11014973778SThomas Huth target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, []) 11114973778SThomas Huth endif 11214973778SThomas Huth 11314973778SThomas Huth test_deps = roms 11414973778SThomas Huth test_env = environment() 11514973778SThomas Huth if have_tools 11614973778SThomas Huth test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img') 11714973778SThomas Huth test_deps += [qemu_img] 11814973778SThomas Huth endif 11914973778SThomas Huth test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path()) 12014973778SThomas Huth test_env.set('QEMU_BUILD_ROOT', meson.project_build_root()) 12114973778SThomas Huth test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 12214973778SThomas Huth meson.current_source_dir()) 12314973778SThomas Huth 12414973778SThomas Huth foreach test : target_tests 125f57213f8SDaniel P. Berrangé testname = '@0@-@1@'.format(target_base, test) 126f57213f8SDaniel P. Berrangé testfile = 'test_' + test + '.py' 127f57213f8SDaniel P. Berrangé testpath = meson.current_source_dir() / testfile 128f57213f8SDaniel P. Berrangé teststamp = testname + '.tstamp' 129f57213f8SDaniel P. Berrangé test_precache_env = environment() 130f57213f8SDaniel P. Berrangé test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp) 131f57213f8SDaniel P. Berrangé test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + 132f57213f8SDaniel P. Berrangé meson.current_source_dir()) 133f57213f8SDaniel P. Berrangé precache = custom_target('func-precache-' + testname, 134f57213f8SDaniel P. Berrangé output: teststamp, 135f57213f8SDaniel P. Berrangé command: [python, testpath], 136f57213f8SDaniel P. Berrangé depend_files: files(testpath), 137f57213f8SDaniel P. Berrangé build_by_default: false, 138f57213f8SDaniel P. Berrangé env: test_precache_env) 139f57213f8SDaniel P. Berrangé precache_all += precache 140f57213f8SDaniel P. Berrangé 141f57213f8SDaniel P. Berrangé # Ideally we would add 'precache' to 'depends' here, such that 142f57213f8SDaniel P. Berrangé # 'build_by_default: false' lets the pre-caching automatically 143f57213f8SDaniel P. Berrangé # run immediately before the test runs. In practice this is 144f57213f8SDaniel P. Berrangé # broken in meson, with it running the pre-caching in the normal 145f57213f8SDaniel P. Berrangé # compile phase https://github.com/mesonbuild/meson/issues/2518 146f57213f8SDaniel P. Berrangé # If the above bug ever gets fixed, when QEMU changes the min 147f57213f8SDaniel P. Berrangé # meson version, add the 'depends' and remove the custom 148f57213f8SDaniel P. Berrangé # 'run_target' logic below & in Makefile.include 149f57213f8SDaniel P. Berrangé test('func-' + testname, 15014973778SThomas Huth python, 15114973778SThomas Huth depends: [test_deps, test_emulator, emulator_modules], 15214973778SThomas Huth env: test_env, 153f57213f8SDaniel P. Berrangé args: [testpath], 15414973778SThomas Huth protocol: 'tap', 15514973778SThomas Huth timeout: test_timeouts.get(test, 60), 15614973778SThomas Huth priority: test_timeouts.get(test, 60), 15714973778SThomas Huth suite: suites) 15814973778SThomas Huth endforeach 15914973778SThomas Huth endforeach 16014973778SThomas Huthendforeach 161f57213f8SDaniel P. Berrangé 162f57213f8SDaniel P. Berrangérun_target('precache-functional', 163f57213f8SDaniel P. Berrangé depends: precache_all, 164f57213f8SDaniel P. Berrangé command: ['true']) 165