mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-08 07:30:36 -04:00
Clean up flaky tests to be more reliable
This commit is contained in:
parent
a54e3d0c55
commit
39ea3b0d41
3 changed files with 202 additions and 104 deletions
|
@ -303,11 +303,20 @@ impl Service for Inhibitor {
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::testing;
|
use crate::testing;
|
||||||
use std::fs::{create_dir_all, read_to_string, remove_file, write, File};
|
use tokio::fs::{create_dir_all, read_to_string, remove_file, symlink, write, File};
|
||||||
use std::os::unix::fs::symlink;
|
|
||||||
|
|
||||||
async fn nyield(time: u64) {
|
async fn try_read(path: &Path, expected: &str) -> bool {
|
||||||
sleep(Duration::from_millis(time)).await;
|
tokio::select! {
|
||||||
|
res = async move {
|
||||||
|
loop {
|
||||||
|
match read_to_string(path).await {
|
||||||
|
Ok(e) if e == expected => break true,
|
||||||
|
_ => sleep(Duration::from_millis(1)).await,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} => res,
|
||||||
|
_ = sleep(Duration::from_millis(500)) => false,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
@ -317,9 +326,15 @@ mod test {
|
||||||
let hid = HidNode::new(0);
|
let hid = HidNode::new(0);
|
||||||
let sys_base = hid.sys_base();
|
let sys_base = hid.sys_base();
|
||||||
|
|
||||||
create_dir_all(sys_base.join("input/input0/foo0")).expect("foo0");
|
create_dir_all(sys_base.join("input/input0/foo0"))
|
||||||
create_dir_all(sys_base.join("input/input1/bar0")).expect("bar0");
|
.await
|
||||||
create_dir_all(sys_base.join("input/input2/mouse0")).expect("mouse0");
|
.expect("foo0");
|
||||||
|
create_dir_all(sys_base.join("input/input1/bar0"))
|
||||||
|
.await
|
||||||
|
.expect("bar0");
|
||||||
|
create_dir_all(sys_base.join("input/input2/mouse0"))
|
||||||
|
.await
|
||||||
|
.expect("mouse0");
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
hid.get_nodes().await.expect("get_nodes"),
|
hid.get_nodes().await.expect("get_nodes"),
|
||||||
|
@ -341,19 +356,45 @@ mod test {
|
||||||
HidNode::new(6),
|
HidNode::new(6),
|
||||||
];
|
];
|
||||||
|
|
||||||
create_dir_all(hids[0].sys_base().join("input/input0/foo0")).expect("foo0");
|
create_dir_all(hids[0].sys_base().join("input/input0/foo0"))
|
||||||
symlink("foo", hids[0].sys_base().join("driver")).expect("hidraw0");
|
.await
|
||||||
create_dir_all(hids[1].sys_base().join("input/input1/mouse0")).expect("mouse0");
|
.expect("foo0");
|
||||||
symlink("foo", hids[1].sys_base().join("driver")).expect("hidraw1");
|
symlink("foo", hids[0].sys_base().join("driver"))
|
||||||
create_dir_all(hids[2].sys_base().join("input/input2/foo1")).expect("foo1");
|
.await
|
||||||
symlink("sony", hids[2].sys_base().join("driver")).expect("hidraw2");
|
.expect("hidraw0");
|
||||||
create_dir_all(hids[3].sys_base().join("input/input3/mouse1")).expect("mouse1");
|
create_dir_all(hids[1].sys_base().join("input/input1/mouse0"))
|
||||||
symlink("sony", hids[3].sys_base().join("driver")).expect("hidraw3");
|
.await
|
||||||
create_dir_all(hids[4].sys_base().join("input/input4/foo2")).expect("foo2");
|
.expect("mouse0");
|
||||||
symlink("playstation", hids[4].sys_base().join("driver")).expect("hidraw4");
|
symlink("foo", hids[1].sys_base().join("driver"))
|
||||||
create_dir_all(hids[5].sys_base().join("input/input5/mouse2")).expect("mouse2");
|
.await
|
||||||
symlink("playstation", hids[5].sys_base().join("driver")).expect("hidraw5");
|
.expect("hidraw1");
|
||||||
create_dir_all(hids[6].sys_base().join("input/input6/mouse3")).expect("mouse3");
|
create_dir_all(hids[2].sys_base().join("input/input2/foo1"))
|
||||||
|
.await
|
||||||
|
.expect("foo1");
|
||||||
|
symlink("sony", hids[2].sys_base().join("driver"))
|
||||||
|
.await
|
||||||
|
.expect("hidraw2");
|
||||||
|
create_dir_all(hids[3].sys_base().join("input/input3/mouse1"))
|
||||||
|
.await
|
||||||
|
.expect("mouse1");
|
||||||
|
symlink("sony", hids[3].sys_base().join("driver"))
|
||||||
|
.await
|
||||||
|
.expect("hidraw3");
|
||||||
|
create_dir_all(hids[4].sys_base().join("input/input4/foo2"))
|
||||||
|
.await
|
||||||
|
.expect("foo2");
|
||||||
|
symlink("playstation", hids[4].sys_base().join("driver"))
|
||||||
|
.await
|
||||||
|
.expect("hidraw4");
|
||||||
|
create_dir_all(hids[5].sys_base().join("input/input5/mouse2"))
|
||||||
|
.await
|
||||||
|
.expect("mouse2");
|
||||||
|
symlink("playstation", hids[5].sys_base().join("driver"))
|
||||||
|
.await
|
||||||
|
.expect("hidraw5");
|
||||||
|
create_dir_all(hids[6].sys_base().join("input/input6/mouse3"))
|
||||||
|
.await
|
||||||
|
.expect("mouse3");
|
||||||
|
|
||||||
assert!(!hids[0].can_inhibit().await);
|
assert!(!hids[0].can_inhibit().await);
|
||||||
assert!(!hids[1].can_inhibit().await);
|
assert!(!hids[1].can_inhibit().await);
|
||||||
|
@ -371,19 +412,27 @@ mod test {
|
||||||
let hid = HidNode::new(0);
|
let hid = HidNode::new(0);
|
||||||
let sys_base = hid.sys_base();
|
let sys_base = hid.sys_base();
|
||||||
|
|
||||||
create_dir_all(sys_base.join("input/input0/mouse0")).expect("mouse0");
|
create_dir_all(sys_base.join("input/input0/mouse0"))
|
||||||
symlink("sony", sys_base.join("driver")).expect("hidraw0");
|
.await
|
||||||
|
.expect("mouse0");
|
||||||
|
symlink("sony", sys_base.join("driver"))
|
||||||
|
.await
|
||||||
|
.expect("hidraw0");
|
||||||
|
|
||||||
assert!(hid.can_inhibit().await);
|
assert!(hid.can_inhibit().await);
|
||||||
|
|
||||||
hid.inhibit().await.expect("inhibit");
|
hid.inhibit().await.expect("inhibit");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
read_to_string(sys_base.join("input/input0/inhibited")).expect("inhibited"),
|
read_to_string(sys_base.join("input/input0/inhibited"))
|
||||||
|
.await
|
||||||
|
.expect("inhibited"),
|
||||||
"1\n"
|
"1\n"
|
||||||
);
|
);
|
||||||
hid.uninhibit().await.expect("uninhibit");
|
hid.uninhibit().await.expect("uninhibit");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
read_to_string(sys_base.join("input/input0/inhibited")).expect("inhibited"),
|
read_to_string(sys_base.join("input/input0/inhibited"))
|
||||||
|
.await
|
||||||
|
.expect("inhibited"),
|
||||||
"0\n"
|
"0\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -395,21 +444,33 @@ mod test {
|
||||||
let hid = HidNode::new(0);
|
let hid = HidNode::new(0);
|
||||||
let sys_base = hid.sys_base();
|
let sys_base = hid.sys_base();
|
||||||
|
|
||||||
create_dir_all(sys_base.join("input/input0/mouse0")).expect("mouse0");
|
create_dir_all(sys_base.join("input/input0/mouse0"))
|
||||||
create_dir_all(sys_base.join("input/input0/inhibited")).expect("inhibited");
|
.await
|
||||||
create_dir_all(sys_base.join("input/input1/mouse1")).expect("mouse0");
|
.expect("mouse0");
|
||||||
symlink("sony", sys_base.join("driver")).expect("hidraw0");
|
create_dir_all(sys_base.join("input/input0/inhibited"))
|
||||||
|
.await
|
||||||
|
.expect("inhibited");
|
||||||
|
create_dir_all(sys_base.join("input/input1/mouse1"))
|
||||||
|
.await
|
||||||
|
.expect("mouse0");
|
||||||
|
symlink("sony", sys_base.join("driver"))
|
||||||
|
.await
|
||||||
|
.expect("hidraw0");
|
||||||
|
|
||||||
assert!(hid.can_inhibit().await);
|
assert!(hid.can_inhibit().await);
|
||||||
|
|
||||||
assert!(hid.inhibit().await.is_err());
|
assert!(hid.inhibit().await.is_err());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
read_to_string(sys_base.join("input/input1/inhibited")).expect("inhibited"),
|
read_to_string(sys_base.join("input/input1/inhibited"))
|
||||||
|
.await
|
||||||
|
.expect("inhibited"),
|
||||||
"1\n"
|
"1\n"
|
||||||
);
|
);
|
||||||
assert!(hid.uninhibit().await.is_err());
|
assert!(hid.uninhibit().await.is_err());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
read_to_string(sys_base.join("input/input1/inhibited")).expect("inhibited"),
|
read_to_string(sys_base.join("input/input1/inhibited"))
|
||||||
|
.await
|
||||||
|
.expect("inhibited"),
|
||||||
"0\n"
|
"0\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -422,31 +483,49 @@ mod test {
|
||||||
let hid = HidNode::new(0);
|
let hid = HidNode::new(0);
|
||||||
let sys_base = hid.sys_base();
|
let sys_base = hid.sys_base();
|
||||||
|
|
||||||
create_dir_all(sys_base.join("input/input0/mouse0")).expect("mouse0");
|
create_dir_all(sys_base.join("input/input0/mouse0"))
|
||||||
symlink("sony", sys_base.join("driver")).expect("hidraw0");
|
.await
|
||||||
create_dir_all(path.join("proc/1/fd")).expect("fd");
|
.expect("mouse0");
|
||||||
|
symlink("sony", sys_base.join("driver"))
|
||||||
|
.await
|
||||||
|
.expect("hidraw0");
|
||||||
|
create_dir_all(path.join("proc/1/fd")).await.expect("fd");
|
||||||
|
|
||||||
symlink(hid.hidraw(), path.join("proc/1/fd/3")).expect("symlink");
|
symlink(hid.hidraw(), path.join("proc/1/fd/3"))
|
||||||
write(path.join("proc/1/comm"), "steam\n").expect("comm");
|
.await
|
||||||
|
.expect("symlink");
|
||||||
|
write(path.join("proc/1/comm"), "steam\n")
|
||||||
|
.await
|
||||||
|
.expect("comm");
|
||||||
|
|
||||||
hid.check().await.expect("check");
|
hid.check().await.expect("check");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
read_to_string(sys_base.join("input/input0/inhibited")).expect("inhibited"),
|
read_to_string(sys_base.join("input/input0/inhibited"))
|
||||||
|
.await
|
||||||
|
.expect("inhibited"),
|
||||||
"1\n"
|
"1\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
write(path.join("proc/1/comm"), "epic\n").expect("comm");
|
write(path.join("proc/1/comm"), "epic\n")
|
||||||
|
.await
|
||||||
|
.expect("comm");
|
||||||
hid.check().await.expect("check");
|
hid.check().await.expect("check");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
read_to_string(sys_base.join("input/input0/inhibited")).expect("inhibited"),
|
read_to_string(sys_base.join("input/input0/inhibited"))
|
||||||
|
.await
|
||||||
|
.expect("inhibited"),
|
||||||
"0\n"
|
"0\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
remove_file(path.join("proc/1/fd/3")).expect("rm");
|
remove_file(path.join("proc/1/fd/3")).await.expect("rm");
|
||||||
write(path.join("proc/1/comm"), "steam\n").expect("comm");
|
write(path.join("proc/1/comm"), "steam\n")
|
||||||
|
.await
|
||||||
|
.expect("comm");
|
||||||
hid.check().await.expect("check");
|
hid.check().await.expect("check");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
read_to_string(sys_base.join("input/input0/inhibited")).expect("inhibited"),
|
read_to_string(sys_base.join("input/input0/inhibited"))
|
||||||
|
.await
|
||||||
|
.expect("inhibited"),
|
||||||
"0\n"
|
"0\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -459,25 +538,37 @@ mod test {
|
||||||
let hid = HidNode::new(0);
|
let hid = HidNode::new(0);
|
||||||
let sys_base = hid.sys_base();
|
let sys_base = hid.sys_base();
|
||||||
|
|
||||||
create_dir_all(path.join("dev")).expect("dev");
|
create_dir_all(path.join("dev")).await.expect("dev");
|
||||||
create_dir_all(sys_base.join("input/input0/mouse0")).expect("mouse0");
|
create_dir_all(sys_base.join("input/input0/mouse0"))
|
||||||
write(hid.hidraw(), "").expect("hidraw");
|
.await
|
||||||
symlink("sony", sys_base.join("driver")).expect("driver");
|
.expect("mouse0");
|
||||||
create_dir_all(path.join("proc/1/fd")).expect("fd");
|
write(hid.hidraw(), "").await.expect("hidraw");
|
||||||
symlink(hid.hidraw(), path.join("proc/1/fd/3")).expect("symlink");
|
symlink("sony", sys_base.join("driver"))
|
||||||
write(path.join("proc/1/comm"), "steam\n").expect("comm");
|
.await
|
||||||
|
.expect("driver");
|
||||||
|
create_dir_all(path.join("proc/1/fd")).await.expect("fd");
|
||||||
|
symlink(hid.hidraw(), path.join("proc/1/fd/3"))
|
||||||
|
.await
|
||||||
|
.expect("symlink");
|
||||||
|
write(path.join("proc/1/comm"), "steam\n")
|
||||||
|
.await
|
||||||
|
.expect("comm");
|
||||||
|
|
||||||
let mut inhibitor = Inhibitor::init().await.expect("init");
|
let mut inhibitor = Inhibitor::init().await.expect("init");
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
read_to_string(sys_base.join("input/input0/inhibited")).expect("inhibited"),
|
read_to_string(sys_base.join("input/input0/inhibited"))
|
||||||
|
.await
|
||||||
|
.expect("inhibited"),
|
||||||
"1\n"
|
"1\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
inhibitor.shutdown().await.expect("stop");
|
inhibitor.shutdown().await.expect("stop");
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
read_to_string(sys_base.join("input/input0/inhibited")).expect("inhibited"),
|
read_to_string(sys_base.join("input/input0/inhibited"))
|
||||||
|
.await
|
||||||
|
.expect("inhibited"),
|
||||||
"0\n"
|
"0\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -490,39 +581,40 @@ mod test {
|
||||||
let hid = HidNode::new(0);
|
let hid = HidNode::new(0);
|
||||||
let sys_base = hid.sys_base();
|
let sys_base = hid.sys_base();
|
||||||
|
|
||||||
create_dir_all(path.join("dev")).expect("dev");
|
create_dir_all(path.join("dev")).await.expect("dev");
|
||||||
create_dir_all(sys_base.join("input/input0/mouse0")).expect("mouse0");
|
create_dir_all(sys_base.join("input/input0/mouse0"))
|
||||||
File::create(hid.hidraw()).expect("hidraw");
|
.await
|
||||||
symlink("sony", sys_base.join("driver")).expect("driver");
|
.expect("mouse0");
|
||||||
create_dir_all(path.join("proc/1/fd")).expect("fd");
|
File::create(hid.hidraw()).await.expect("hidraw");
|
||||||
write(path.join("proc/1/comm"), "steam\n").expect("comm");
|
symlink("sony", sys_base.join("driver"))
|
||||||
|
.await
|
||||||
|
.expect("driver");
|
||||||
|
create_dir_all(path.join("proc/1/fd")).await.expect("fd");
|
||||||
|
write(path.join("proc/1/comm"), "steam\n")
|
||||||
|
.await
|
||||||
|
.expect("comm");
|
||||||
|
|
||||||
let mut inhibitor = Inhibitor::init().await.expect("init");
|
let mut inhibitor = Inhibitor::init().await.expect("init");
|
||||||
let task = tokio::spawn(async move {
|
let task = tokio::spawn(async move {
|
||||||
inhibitor.run().await.expect("run");
|
inhibitor.run().await.expect("run");
|
||||||
});
|
});
|
||||||
|
|
||||||
nyield(5).await;
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
read_to_string(sys_base.join("input/input0/inhibited")).expect("inhibited"),
|
read_to_string(sys_base.join("input/input0/inhibited"))
|
||||||
|
.await
|
||||||
|
.expect("inhibited"),
|
||||||
"0\n"
|
"0\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
symlink(hid.hidraw(), path.join("proc/1/fd/3")).expect("symlink");
|
symlink(hid.hidraw(), path.join("proc/1/fd/3"))
|
||||||
let f = File::open(hid.hidraw()).expect("hidraw");
|
.await
|
||||||
nyield(15).await;
|
.expect("symlink");
|
||||||
assert_eq!(
|
let f = File::open(hid.hidraw()).await.expect("hidraw");
|
||||||
read_to_string(sys_base.join("input/input0/inhibited")).expect("inhibited"),
|
assert!(try_read(sys_base.join("input/input0/inhibited").as_path(), "1\n").await);
|
||||||
"1\n"
|
|
||||||
);
|
|
||||||
|
|
||||||
drop(f);
|
drop(f);
|
||||||
remove_file(path.join("proc/1/fd/3")).expect("rm");
|
remove_file(path.join("proc/1/fd/3")).await.expect("rm");
|
||||||
nyield(15).await;
|
assert!(try_read(sys_base.join("input/input0/inhibited").as_path(), "0\n").await);
|
||||||
assert_eq!(
|
|
||||||
read_to_string(sys_base.join("input/input0/inhibited")).expect("inhibited"),
|
|
||||||
"0\n"
|
|
||||||
);
|
|
||||||
|
|
||||||
task.abort();
|
task.abort();
|
||||||
}
|
}
|
||||||
|
@ -535,28 +627,33 @@ mod test {
|
||||||
let hid = HidNode::new(0);
|
let hid = HidNode::new(0);
|
||||||
let sys_base = hid.sys_base();
|
let sys_base = hid.sys_base();
|
||||||
|
|
||||||
create_dir_all(path.join("dev")).expect("dev");
|
create_dir_all(path.join("dev")).await.expect("dev");
|
||||||
create_dir_all(sys_base.join("input/input0/mouse0")).expect("mouse0");
|
create_dir_all(sys_base.join("input/input0/mouse0"))
|
||||||
symlink("sony", sys_base.join("driver")).expect("driver");
|
.await
|
||||||
create_dir_all(path.join("proc/1/fd")).expect("fd");
|
.expect("mouse0");
|
||||||
write(path.join("proc/1/comm"), "steam\n").expect("comm");
|
symlink("sony", sys_base.join("driver"))
|
||||||
|
.await
|
||||||
|
.expect("driver");
|
||||||
|
create_dir_all(path.join("proc/1/fd")).await.expect("fd");
|
||||||
|
write(path.join("proc/1/comm"), "steam\n")
|
||||||
|
.await
|
||||||
|
.expect("comm");
|
||||||
|
|
||||||
let mut inhibitor = Inhibitor::init().await.expect("init");
|
let mut inhibitor = Inhibitor::init().await.expect("init");
|
||||||
let task = tokio::spawn(async move {
|
let task = tokio::spawn(async move {
|
||||||
inhibitor.run().await.expect("run");
|
inhibitor.run().await.expect("run");
|
||||||
});
|
});
|
||||||
|
|
||||||
nyield(5).await;
|
assert!(read_to_string(sys_base.join("input/input0/inhibited"))
|
||||||
assert!(read_to_string(sys_base.join("input/input0/inhibited")).is_err());
|
.await
|
||||||
|
.is_err());
|
||||||
|
|
||||||
File::create(hid.hidraw()).expect("hidraw");
|
File::create(hid.hidraw()).await.expect("hidraw");
|
||||||
symlink(hid.hidraw(), path.join("proc/1/fd/3")).expect("symlink");
|
symlink(hid.hidraw(), path.join("proc/1/fd/3"))
|
||||||
let _f = File::open(hid.hidraw()).expect("hidraw");
|
.await
|
||||||
nyield(300).await;
|
.expect("symlink");
|
||||||
assert_eq!(
|
let _f = File::open(hid.hidraw()).await.expect("hidraw");
|
||||||
read_to_string(sys_base.join("input/input0/inhibited")).expect("inhibited"),
|
assert!(try_read(sys_base.join("input/input0/inhibited").as_path(), "1\n").await);
|
||||||
"1\n"
|
|
||||||
);
|
|
||||||
|
|
||||||
task.abort();
|
task.abort();
|
||||||
}
|
}
|
||||||
|
@ -568,29 +665,31 @@ mod test {
|
||||||
let hid = HidNode::new(0);
|
let hid = HidNode::new(0);
|
||||||
let sys_base = hid.sys_base();
|
let sys_base = hid.sys_base();
|
||||||
|
|
||||||
create_dir_all(path("/dev")).expect("dev");
|
create_dir_all(path("/dev")).await.expect("dev");
|
||||||
create_dir_all(sys_base.join("input/input0/mouse0")).expect("mouse0");
|
create_dir_all(sys_base.join("input/input0/mouse0"))
|
||||||
symlink("sony", sys_base.join("driver")).expect("driver");
|
.await
|
||||||
create_dir_all(path("/proc/1/fd")).expect("fd");
|
.expect("mouse0");
|
||||||
write(path("/proc/1/comm"), "steam\n").expect("comm");
|
symlink("sony", sys_base.join("driver"))
|
||||||
|
.await
|
||||||
|
.expect("driver");
|
||||||
|
create_dir_all(path("/proc/1/fd")).await.expect("fd");
|
||||||
|
write(path("/proc/1/comm"), "steam\n").await.expect("comm");
|
||||||
|
|
||||||
let mut inhibitor = Inhibitor::init().await.expect("init");
|
let mut inhibitor = Inhibitor::init().await.expect("init");
|
||||||
let task = tokio::spawn(async move {
|
let task = tokio::spawn(async move {
|
||||||
inhibitor.run().await.expect("run");
|
inhibitor.run().await.expect("run");
|
||||||
});
|
});
|
||||||
|
|
||||||
nyield(5).await;
|
assert!(read_to_string(sys_base.join("input/input0/inhibited"))
|
||||||
assert!(read_to_string(sys_base.join("input/input0/inhibited")).is_err());
|
.await
|
||||||
|
.is_err());
|
||||||
|
|
||||||
File::create(hid.hidraw()).expect("hidraw");
|
File::create(hid.hidraw()).await.expect("hidraw");
|
||||||
nyield(50).await;
|
symlink(hid.hidraw(), path("/proc/1/fd/3"))
|
||||||
symlink(hid.hidraw(), path("/proc/1/fd/3")).expect("symlink");
|
.await
|
||||||
let _f = File::open(hid.hidraw()).expect("hidraw");
|
.expect("symlink");
|
||||||
nyield(250).await;
|
let _f = File::open(hid.hidraw()).await.expect("hidraw");
|
||||||
assert_eq!(
|
assert!(try_read(sys_base.join("input/input0/inhibited").as_path(), "1\n").await);
|
||||||
read_to_string(sys_base.join("input/input0/inhibited")).expect("inhibited"),
|
|
||||||
"1\n"
|
|
||||||
);
|
|
||||||
|
|
||||||
task.abort();
|
task.abort();
|
||||||
}
|
}
|
||||||
|
|
|
@ -534,8 +534,6 @@ pub(crate) mod test {
|
||||||
.await
|
.await
|
||||||
.expect("at");
|
.expect("at");
|
||||||
|
|
||||||
//sleep(Duration::from_millis(10)).await;
|
|
||||||
|
|
||||||
let (tx, mut rx) = mpsc::channel(3);
|
let (tx, mut rx) = mpsc::channel(3);
|
||||||
let (fin_tx, fin_rx) = oneshot::channel();
|
let (fin_tx, fin_rx) = oneshot::channel();
|
||||||
|
|
||||||
|
|
|
@ -694,6 +694,7 @@ mod test {
|
||||||
handle.test.platform_config.replace(platform_config);
|
handle.test.platform_config.replace(platform_config);
|
||||||
let connection = handle.new_dbus().await?;
|
let connection = handle.new_dbus().await?;
|
||||||
connection.request_name("org.freedesktop.systemd1").await?;
|
connection.request_name("org.freedesktop.systemd1").await?;
|
||||||
|
sleep(Duration::from_millis(10)).await;
|
||||||
{
|
{
|
||||||
let object_server = connection.object_server();
|
let object_server = connection.object_server();
|
||||||
object_server
|
object_server
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue