1 | use nix::sys::sysinfo::*; |
---|---|
2 | |
3 | #[test] |
4 | fn sysinfo_works() { |
5 | let info = sysinfo().unwrap(); |
6 | |
7 | let (l1, l5, l15) = info.load_average(); |
8 | assert!(l1 >= 0.0); |
9 | assert!(l5 >= 0.0); |
10 | assert!(l15 >= 0.0); |
11 | |
12 | info.uptime(); // just test Duration construction |
13 | |
14 | assert!( |
15 | info.swap_free() <= info.swap_total(), |
16 | "more swap available than installed (free: {}, total: {})", |
17 | info.swap_free(), |
18 | info.swap_total() |
19 | ); |
20 | } |
21 |