From 6693862f9ebb0d2cdc74861bbb4bcb3709234a0c Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Sat, 4 Mar 2023 21:03:28 +0100 Subject: [PATCH] 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 Change-Id: I437a720e12e43e33fbf04345a6b77987167864fe Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17050 Reviewed-by: Jim Harris Reviewed-by: Ben Walker Reviewed-by: Karol Latecki Tested-by: SPDK CI Jenkins --- test/common/autotest_common.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index 76477ab94..e5ea96725 100755 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -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}' ;;