summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/tests/process/cpu_set.rs
blob: c4d9edf083083fc0ccbfcde99f43abf6cdb5d5f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#[cfg(any(target_os = "android", target_os = "linux"))]
#[test]
fn test_cpu_set() {
    let set = rustix::process::sched_getaffinity(None).unwrap();

    let mut count = 0;
    for i in 0..rustix::process::CpuSet::MAX_CPU {
        if set.is_set(i) {
            count += 1;
        }
    }

    assert_eq!(count, set.count());
}