diff options
| author | Amy Kwan <amy.kwan1@ibm.com> | 2025-02-04 13:57:20 -0500 |
|---|---|---|
| committer | Amy Kwan <amy.kwan1@ibm.com> | 2025-02-04 13:57:20 -0500 |
| commit | 6c4cf30009bd0cad81202fbcc2e835bc66b14e74 (patch) | |
| tree | 80dab05ab11511cc494754353fcefd579874df9e /tests | |
| parent | 01e4f19cc8027925ffe0885a86388b700e46bfab (diff) | |
| download | rust-6c4cf30009bd0cad81202fbcc2e835bc66b14e74.tar.gz rust-6c4cf30009bd0cad81202fbcc2e835bc66b14e74.zip | |
[AIX] Update tests/ui/wait-forked-but-failed-child.rs to accomodate exiting and idle processes.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/wait-forked-but-failed-child.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/ui/wait-forked-but-failed-child.rs b/tests/ui/wait-forked-but-failed-child.rs index 04f1c1a65d5..d756e6515b7 100644 --- a/tests/ui/wait-forked-but-failed-child.rs +++ b/tests/ui/wait-forked-but-failed-child.rs @@ -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(' ').filter(|x| 0 < x.len()).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") |
