From cb86458689a81f4b6a201d117c92837075ff98e8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Sun, 7 Oct 2018 21:57:09 -0400 Subject: [PATCH] Kill dangling test processes before running tests Tests often fail because of "dangling" lttng processes left on CI slaves. I am not sure what leaks them (either failing tests or cancelled jobs), but they are a very frequent cause of build failures. The code is this diff is taken from lttng-tools warn_processes.sh. We could also clean-up at the end of the job, but I am not sure how to get Jenkins to run a "clean-up" when a job is cancelled (e.g. manually or after a time-out). --- scripts/lttng-tools/build.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/lttng-tools/build.sh b/scripts/lttng-tools/build.sh index 6c61db6..36c87b0 100755 --- a/scripts/lttng-tools/build.sh +++ b/scripts/lttng-tools/build.sh @@ -339,6 +339,13 @@ if [ "$RUN_TESTS" = "yes" ]; then # Allow core dumps ulimit -c unlimited + # Kill any LTTng-related process + lttng_processes="$("$PGREP" -l 'lttng|gen-ust-.+')" + if [ $? -eq 0 ]; then + pids="$(cut -d ' ' -f 1 <<< "$lttng_processes" | tr '\n' ' ')" + kill -9 $pids + fi + # Add 'babeltrace' binary to PATH chmod +x "$BABEL_BINS/babeltrace" export PATH="$PATH:$BABEL_BINS" -- 2.34.1