From 39dce00bb58da888904ba811172a0198703e4993 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Thu, 20 Feb 2020 00:57:33 -0700 Subject: [PATCH] test: add FreeBSD-specific ps options to get process name Fixes issue #1145. Signed-off-by: Jim Harris Change-Id: Ifee3d8e041ca2f7acfb3e00c001e77027bf5cdb8 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/970 Reviewed-by: Tomasz Zawadzki Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto Tested-by: SPDK CI Jenkins --- test/common/autotest_common.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index 1a080e4df..12f3d1e9c 100644 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -495,7 +495,12 @@ function killprocess() { fi if kill -0 $1; then - if [ "$(ps --no-headers -o comm= $1)" = "sudo" ]; then + if [ $(uname) = Linux ]; then + process_name=$(ps --no-headers -o comm= $1) + else + process_name=$(ps -c -o command $1 | tail -1) + fi + if [ "$process_name" = "sudo" ]; then # kill the child process, which is the actual app # (assume $1 has just one child) local child