diff --git a/crates/metal2vulkan-validation/tests/integration/translation_l3_stage.rs b/crates/metal2vulkan-validation/tests/integration/translation_l3_stage.rs index d94429632..054fe4cc8 100644 --- a/crates/metal2vulkan-validation/tests/integration/translation_l3_stage.rs +++ b/crates/metal2vulkan-validation/tests/integration/translation_l3_stage.rs @@ -19,7 +19,11 @@ use std::process::Command; /// /// It finds its parent with `pgrep`, never `ps`: macOS's `ps` is setuid root, and the worker's /// process-group monitor cannot read a root process's memory (`proc_pid_rusage` answers `EPERM`), -/// which fails the attempt as a tooling error whenever a sample lands while `ps` runs. +/// which fails the attempt as a tooling error whenever a sample lands while `ps` runs. macOS's +/// `pgrep` leaves out its own ancestors, the stand-in's parent among them, unless given `-a`; +/// procps's `pgrep` on Linux lists only other processes already and reads `-a` as +/// `--list-full`, which would put each command line beside its pid, so `-a` is passed on macOS +/// alone. fn stand_in( dir: &Path, name: &str, @@ -32,7 +36,9 @@ fn stand_in( let script = format!( "#!/bin/sh\n\ if [ \"$1\" = --version ]; then echo '{version}'; exit 0; fi\n\ - if pgrep -f -- '--l3-stage engine' | grep -qx \"$PPID\"; then\n\ + ancestors=\n\ + if [ \"$(uname)\" = Darwin ]; then ancestors=-a; fi\n\ + if pgrep $ancestors -f -- '--l3-stage engine' | grep -qx \"$PPID\"; then\n\ echo \"$PPID: --l3-stage engine\" >> '{calls}'\n\ else\n\ echo \"$PPID: not the L3 stage\" >> '{calls}'\n\