From: Jonathan Rajotte Date: Wed, 17 Oct 2018 19:22:55 +0000 (-0400) Subject: Cleanup of running processes and coredump before build step X-Git-Url: http://git.lttng.org./?a=commitdiff_plain;h=aae4e17983454e0ecaafd78bc1cf9846a1bedf61;p=lttng-ci.git Cleanup of running processes and coredump before build step 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 --- diff --git a/jobs/lttng-tools.yaml b/jobs/lttng-tools.yaml index b5d55b1..10ead3f 100644 --- a/jobs/lttng-tools.yaml +++ b/jobs/lttng-tools.yaml @@ -209,6 +209,8 @@ 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 diff --git a/scripts/lttng-tools/build.sh b/scripts/lttng-tools/build.sh index 774f535..dded5f1 100755 --- a/scripts/lttng-tools/build.sh +++ b/scripts/lttng-tools/build.sh @@ -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 index 0000000..91082fb --- /dev/null +++ b/scripts/lttng-tools/clean_processes_coredump.sh @@ -0,0 +1,33 @@ +#!/bin/bash -exu +# +# Copyright (C) 2018 - Jonathan Rajotte-Julien +# +# 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 . + +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