autotest: Consider processes from deleted workspaces during cleanup

Common practice is to purge workspace on the jenkins side when the
job is done. When that happens, stuck processes may still linger,
but readlink -f will fail to resolve exe link as the target binary
won't exist anymore. Instead, just see what the link points at
and include it in the list.

Signed-off-by: Michal Berger <michal.berger@intel.com>
Change-Id: I437a720e12e43e33fbf04345a6b77987167864fe
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17050
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Michal Berger 2023-03-04 21:03:28 +01:00 committed by David Ko
parent fb09c4a5c9
commit e5e9f91113

View File

@ -1562,10 +1562,11 @@ function pap() {
function get_proc_paths() {
case "$(uname -s)" in
Linux) # ps -e -opid,exe <- not supported under {centos7,rocky8}'s procps-ng
local pid
local pid exe
for pid in /proc/[0-9]*; do
[[ -e $pid/exe ]] || continue
echo "${pid##*/} $(readlink -f "$pid/exe")"
exe=$(readlink "$pid/exe") || continue
exe=${exe/ (deleted)/}
echo "${pid##*/} $exe"
done
;;
FreeeBSD) procstat -ab | awk '{print $1, $4}' ;;