Skip to content

Commit

Permalink
[Tests] Fix check for running process to prevent setup failures
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
amadio committed Dec 12, 2024
1 parent aef92e0 commit c9aaf67
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/XRootD/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c9aaf67

Please sign in to comment.