#![allow(unused_imports)] use intel_gpu_uapi::*; use uapi::i915; use std::fs; use std::{fs::File, os::fd::{AsRawFd, RawFd}}; #[test] fn test_i915_uapi_get_version() { let node = i915::find_node().expect("Failed to find i915 fd"); let _drm_version = uapi::get_drm_version(node.fd.as_raw_fd()).expect("Failed to get drm version"); } #[test] fn test_i915_uapi_get_engines() { let node = i915::find_node().expect("Failed to find i915 fd"); let _engines = i915::get_engines(node.fd.as_raw_fd()).expect("Failed to get engines"); let fail_fd = File::open("/dev/null").expect("Failed to open /dev/null"); assert!(i915::get_engines(fail_fd.as_raw_fd()).is_none()); } #[test] fn test_i915_uapi_get_param_fail() { let fd = File::open("/dev/null").expect("Failed to open /dev/null"); let param = i915::get_param(fd.as_raw_fd(), native::I915_PARAM_CHIPSET_ID as i32); assert!(param.is_none()); } #[test] fn test_i915_uapi_native_engine_info() { let node = i915::find_node().expect("Failed to find i915 fd"); let engines = i915::get_engines(node.fd.as_raw_fd()).expect("Failed to get engines"); for engine in engines { let native_engine = engine.to_native(); let from_native = i915::EngineInfo::from_native(native_engine); assert_eq!(&engine, &from_native); } } #[test] fn test_i915_find_fd() { let fd = i915::find_fd().expect("Failed to find i915 fd"); let _drm_version = uapi::get_drm_version(fd.as_raw_fd()).expect("Failed to get drm version"); }