From 6b95a7b49da0c3f874fa9db0cbe75252677104ee Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 25 Feb 2019 18:25:20 -0500 Subject: [PATCH] hang_processes.sh: Set WORKSPACE variable when running outside of Jenkins We use the WORKSPACE variable, which is normally set by Jenkins. To allow testing the script by hand, set it manually to the current working directory if it is not defined. Signed-off-by: Simon Marchi --- scripts/lttng-tools/hang_processes.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/lttng-tools/hang_processes.sh b/scripts/lttng-tools/hang_processes.sh index 7639adb..6a102b8 100755 --- a/scripts/lttng-tools/hang_processes.sh +++ b/scripts/lttng-tools/hang_processes.sh @@ -21,6 +21,10 @@ dependencies="" file_list=$(mktemp) ret=0 +# WORKSPACE is normally set by Jenkins. Use the current directory otherwise, +# like when testing this script manually. +WORKSPACE=${WORKSPACE:-$PWD} + lttng_processes="$("$PGREP" -l 'lttng|gen-ust-.+')" || true if [ ! -z "$lttng_processes" ]; then @@ -58,6 +62,7 @@ if [ ! -z "$core_files" ]; then done done + mkdir -p "${WORKSPACE}/build" tar cfzh "${WORKSPACE}/build/core.tar.gz" -T "$file_list" rm -rf $core_files ret=1 -- 2.34.1