|
|
@ -1,4 +1,4 @@
|
|
|
|
use std::io::BufRead;
|
|
|
|
use std::{env, io::BufRead, path::Path};
|
|
|
|
|
|
|
|
|
|
|
|
use aya::{programs::Iter, Btf, Ebpf};
|
|
|
|
use aya::{programs::Iter, Btf, Ebpf};
|
|
|
|
use test_log::test;
|
|
|
|
use test_log::test;
|
|
|
@ -20,11 +20,15 @@ fn iter_task() {
|
|
|
|
let line_init = lines.next().unwrap().unwrap();
|
|
|
|
let line_init = lines.next().unwrap().unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
assert_eq!(line_title, "tgid pid name");
|
|
|
|
assert_eq!(line_title, "tgid pid name");
|
|
|
|
let expected_values = ["1 1 init", "1 1 systemd"];
|
|
|
|
// It's hard to predict what's the PID of the first process in a container.
|
|
|
|
assert!(
|
|
|
|
// Use this assertion only on non-containerized systems.
|
|
|
|
expected_values.contains(&line_init.as_str()),
|
|
|
|
if !Path::new("/.dockerenv").exists() && env::var_os("container").is_none() {
|
|
|
|
"Unexpected line_init value: '{}', expected one of: {:?}",
|
|
|
|
let expected_values = ["1 1 init", "1 1 systemd"];
|
|
|
|
line_init,
|
|
|
|
assert!(
|
|
|
|
expected_values
|
|
|
|
expected_values.contains(&line_init.as_str()),
|
|
|
|
);
|
|
|
|
"Unexpected line_init value: '{}', expected one of: {:?}",
|
|
|
|
|
|
|
|
line_init,
|
|
|
|
|
|
|
|
expected_values
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|