Skip to content

[AIX] Update tests/ui/wait-forked-but-failed-child.rs to accomodate exiting and idle processes. #136556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion tests/ui/wait-forked-but-failed-child.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,17 @@ fn find_zombies() {
// https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html
let ps_cmd_output = Command::new("ps").args(&["-A", "-o", "pid,ppid,args"]).output().unwrap();
let ps_output = String::from_utf8_lossy(&ps_cmd_output.stdout);
// On AIX, the PPID is not always present, such as when a process is blocked
// (marked as <exiting>), or if a process is idle. In these situations,
// the PPID column contains a "-" for the respective process.
// Filter out any lines that have a "-" as the PPID as the PPID is
// expected to be an integer.
let filtered_ps: Vec<_> = ps_output
.lines()
.filter(|line| line.split_whitespace().nth(1) != Some("-"))
.collect();

for (line_no, line) in ps_output.split('\n').enumerate() {
for (line_no, line) in filtered_ps.into_iter().enumerate() {
if 0 < line_no && 0 < line.len() &&
my_pid == line.split(' ').filter(|w| 0 < w.len()).nth(1)
.expect("1st column should be PPID")
Expand Down
Loading