summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJonas Schievink <jonas.schievink@ferrous-systems.com>2022-09-27 14:26:35 +0200
committerJonas Schievink <jonas.schievink@ferrous-systems.com>2022-09-27 14:26:35 +0200
commit945f743aa7003b6cb6c646d9208713052cbc2701 (patch)
tree1db83427928731bab8c6dd2fcff6569a569a8293 /test
parentbe36bf05478ac40f92a01e1e8ec6aa11fad65d1f (diff)
downloadnix-945f743aa7003b6cb6c646d9208713052cbc2701.zip
Add a `sched_getcpu` wrapper
Diffstat (limited to 'test')
-rw-r--r--test/test_sched.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/test_sched.rs b/test/test_sched.rs
index ebf346db..c52616b8 100644
--- a/test/test_sched.rs
+++ b/test/test_sched.rs
@@ -1,4 +1,4 @@
-use nix::sched::{sched_getaffinity, sched_setaffinity, CpuSet};
+use nix::sched::{sched_getaffinity, sched_getcpu, sched_setaffinity, CpuSet};
use nix::unistd::Pid;
#[test]
@@ -30,6 +30,10 @@ fn test_sched_affinity() {
)
}
+ // Now check that we're also currently running on the CPU in question.
+ let cur_cpu = sched_getcpu().unwrap();
+ assert_eq!(cur_cpu, last_valid_cpu);
+
// Finally, reset the initial CPU set
sched_setaffinity(Pid::from_raw(0), &initial_affinity).unwrap();
}