|
|
@@ -1,7 +1,7 @@
|
|
1
|
1
|
#[cfg(test)]
|
|
2
|
2
|
mod tests {
|
|
3
|
3
|
use procinfo::pid::{status, status_self};
|
|
4
|
|
- use {self_pids, get_pid_command, get_thread_count, get_ownprocess_mem, get_task_total};
|
|
|
4
|
+ use {get_ownprocess_mem, get_pid_command, get_task_total, get_thread_count, self_pids};
|
|
5
|
5
|
|
|
6
|
6
|
|
|
7
|
7
|
fn sol_self_pids() -> (i32, i32) {
|
|
|
@@ -11,6 +11,16 @@ mod tests {
|
|
11
|
11
|
}
|
|
12
|
12
|
}
|
|
13
|
13
|
|
|
|
14
|
+ fn name_of_init() -> String {
|
|
|
15
|
+ status(1).unwrap().command
|
|
|
16
|
+ }
|
|
|
17
|
+
|
|
|
18
|
+ #[test]
|
|
|
19
|
+ fn test_name_of_init() {
|
|
|
20
|
+ let status = status(1).unwrap();
|
|
|
21
|
+ assert_eq!(name_of_init(), status.command);
|
|
|
22
|
+ }
|
|
|
23
|
+
|
|
14
|
24
|
#[test]
|
|
15
|
25
|
fn test0_ppid() {
|
|
16
|
26
|
assert_eq!(sol_self_pids(), self_pids().unwrap());
|
|
|
@@ -26,18 +36,12 @@ mod tests {
|
|
26
|
36
|
|
|
27
|
37
|
#[test]
|
|
28
|
38
|
fn test2_command() {
|
|
29
|
|
- assert_eq!(Ok("systemd".to_string()), get_pid_command(1));
|
|
|
39
|
+ assert_eq!(Ok(name_of_init()), get_pid_command(1));
|
|
30
|
40
|
}
|
|
31
|
41
|
|
|
32
|
42
|
|
|
33
|
43
|
#[test]
|
|
34
|
|
- fn test3_systemd_command() {
|
|
35
|
|
- let status = status(1).unwrap();
|
|
36
|
|
- assert_eq!("systemd".to_string(), status.command);
|
|
37
|
|
- }
|
|
38
|
|
-
|
|
39
|
|
- #[test]
|
|
40
|
|
- fn test4_systemd_threads() {
|
|
|
44
|
+ fn test3_systemd_threads() {
|
|
41
|
45
|
let status = status(1).unwrap();
|
|
42
|
46
|
assert_eq!(get_thread_count(1), Ok(status.threads));
|
|
43
|
47
|
}
|