mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-12 17:32:21 -04:00
manager: Add get/set_gpu_performance_level tests
This commit is contained in:
parent
9ddbc9997d
commit
3c62c57d52
2 changed files with 54 additions and 11 deletions
16
src/power.rs
16
src/power.rs
|
@ -197,6 +197,14 @@ pub async fn set_tdp_limit(limit: u32) -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub async fn setup_test() {
|
||||
let filename = path(GPU_PERFORMANCE_LEVEL_PATH);
|
||||
fs::create_dir_all(filename.parent().unwrap())
|
||||
.await
|
||||
.expect("create_dir_all");
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
@ -209,9 +217,7 @@ mod test {
|
|||
let h = testing::start();
|
||||
|
||||
let filename = path(GPU_PERFORMANCE_LEVEL_PATH);
|
||||
create_dir_all(filename.parent().unwrap())
|
||||
.await
|
||||
.expect("create_dir_all");
|
||||
setup_test().await;
|
||||
assert!(get_gpu_performance_level().await.is_err());
|
||||
|
||||
write(filename.as_path(), "auto\n").await.expect("write");
|
||||
|
@ -255,9 +261,7 @@ mod test {
|
|||
let h = testing::start();
|
||||
|
||||
let filename = path(GPU_PERFORMANCE_LEVEL_PATH);
|
||||
create_dir_all(filename.parent().unwrap())
|
||||
.await
|
||||
.expect("create_dir_all");
|
||||
setup_test().await;
|
||||
|
||||
set_gpu_performance_level(GPUPerformanceLevel::Auto)
|
||||
.await
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue