test: add FreeBSD-specific ps options to get process name

Fixes issue #1145.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ifee3d8e041ca2f7acfb3e00c001e77027bf5cdb8

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/970
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Jim Harris 2020-02-20 00:57:33 -07:00 committed by Tomasz Zawadzki
parent 2b43f6353f
commit 39dce00bb5

View File

@ -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