Cleanup of running processes and coredump before build step
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 17 Oct 2018 19:22:55 +0000 (15:22 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 18 Oct 2018 19:26:48 +0000 (15:26 -0400)
Coredump are expected in /tmp. Remove any previous coredumps present if
any.

Kill (SIGKILL) all lttng related processes that are present at the start
of the build.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
jobs/lttng-tools.yaml
scripts/lttng-tools/build.sh
scripts/lttng-tools/clean_processes_coredump.sh [new file with mode: 0755]

index b5d55b1c0d7dc1736a6ff1b775ca992d3be3fd55..10ead3f96033cfffae7475d2b1da4ffe20b6d04f 100644 (file)
                 filter: 'build/**'
                 target: 'deps/lttng-ust'
                 do-not-fingerprint: true
+      - shell:
+         !include-raw-escape: scripts/lttng-tools/clean_processes_coredump.sh
       - shell:
          !include-raw-escape: scripts/lttng-tools/build.sh
 
index 774f5359451d6e99505ec0a96205ff9166205fa1..dded5f1efeda0b555474c8e6f92d3c6aa069103f 100755 (executable)
@@ -341,16 +341,6 @@ if [ "$RUN_TESTS" = "yes" ]; then
     # Allow core dumps
     ulimit -c unlimited
 
-    # Kill any LTTng-related process
-    lttng_processes="$("$PGREP" -l 'lttng|gen-ust-.+')" || true
-    if [ ! -z "$lttng_processes" ]; then
-        echo "The following LTTng processes were detected running on the system and will be killed:"
-        echo "$lttng_processes"
-
-        pids="$(cut -d ' ' -f 1 <<< "$lttng_processes" | tr '\n' ' ')"
-        kill -SIGKILL $pids
-    fi
-
     # Add 'babeltrace' binary to PATH
     chmod +x "$BABEL_BINS/babeltrace"
     export PATH="$PATH:$BABEL_BINS"
diff --git a/scripts/lttng-tools/clean_processes_coredump.sh b/scripts/lttng-tools/clean_processes_coredump.sh
new file mode 100755 (executable)
index 0000000..91082fb
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/bash -exu
+#
+# Copyright (C) 2018 - Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+PGREP=pgrep
+# Kill any LTTng-related process
+lttng_processes="$("$PGREP" -l 'lttng|gen-ust-.+')" || true
+if [ ! -z "$lttng_processes" ]; then
+    echo "The following LTTng processes were detected running on the system and will be killed:"
+    echo "$lttng_processes"
+
+    pids="$(cut -d ' ' -f 1 <<< "$lttng_processes" | tr '\n' ' ')"
+    kill -SIGKILL $pids
+fi
+
+# Remove any coredump already present
+core_files=$(find "/tmp" -name "core\.[0-9]*" -type f 2>/dev/null) || true
+if [ ! -z "$core_files" ]; then
+    rm -rf $core_files
+fi
This page took 0.024993 seconds and 4 git commands to generate.