From: Jérémie Galarneau Date: Mon, 8 Oct 2018 01:57:09 +0000 (-0400) Subject: Kill dangling test processes before running tests X-Git-Url: http://git.lttng.org./?a=commitdiff_plain;h=cb86458689a81f4b6a201d117c92837075ff98e8;p=lttng-ci.git 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). --- 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"