From c9aaf675bbf87adccc215cc0a29c5e25ee061f31 Mon Sep 17 00:00:00 2001 From: Guilherme Amadio Date: Wed, 6 Nov 2024 12:55:58 +0100 Subject: [PATCH] [Tests] Fix check for running process to prevent setup failures If a test causes a server to crash, a pid file with the pid of the crashed server will be left behind. The teardown phase would then fail due to a non-zero return of the ps command when assigning the pid to $PID. This changes the test to skip killing a process that has already exited without failing. --- tests/XRootD/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/XRootD/test.sh b/tests/XRootD/test.sh index f8f6a81ad51..4bdb827df30 100755 --- a/tests/XRootD/test.sh +++ b/tests/XRootD/test.sh @@ -147,7 +147,7 @@ function teardown() { # Kill all processes that created pid files and are still running for PIDFILE in *.pid; do test -s "${PIDFILE}" || continue - PID="$(ps -o pid= "$(cat "${PIDFILE}")")" + PID="$(ps -o pid= "$(cat "${PIDFILE}")" || true)" if test -n "${PID}"; then kill -s TERM "${PID}" fi