Kill dangling test processes before running tests
authorJérémie Galarneau <jeremie.galarneau@gmail.com>
Mon, 8 Oct 2018 01:57:09 +0000 (21:57 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 18 Oct 2018 19:26:48 +0000 (15:26 -0400)
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

index 6c61db670b40cd21cbac4257ae191d906588ed67..36c87b0f9d9d5dcf411c4ff0c9825d077247e511 100755 (executable)
@@ -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"
This page took 0.024716 seconds and 4 git commands to generate.