Skip to content

Commit

Permalink
Add a built-in timeout mechanism to valgrind-checks
Browse files Browse the repository at this point in the history
If things go wrong and a run of valgrind-checks gets stuck, it's
hard to terminate and clean after it properly because it runs as
root. In a container, but that doesn't make a difference. To
avoid such issues, let's make sure the `bash` process running the
valgrind checks kills itself after a period of time unless it
finishes properly (succeeding or failing).

Ticket: CFE-4416
Changelog: None
(cherry picked from commit 079c633)
  • Loading branch information
vpodzime committed Jul 8, 2024
1 parent cf2ab18 commit 13d0d50
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/valgrind-check/valgrind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ function check_masterfiles_and_inputs {
set -e
set -x

# In case things go wrong and this hangs, let's make sure things get properly
# cleaned up from here rather than relying on the outer environment doing the
# cleanup. In case this runs in a container, it could be a big
# difference. Especially in a case of an SPC.
{ sleep 30m && kill -9 $$; } &
auto_destruct_pid=$!
trap "kill $auto_destruct_pid" EXIT

# Assume we are in core directory
if [ -f ./configure ] ; then
./configure -C --enable-debug
Expand Down

0 comments on commit 13d0d50

Please sign in to comment.