hang_processes.sh: Set WORKSPACE variable when running outside of
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 25 Feb 2019 23:25:20 +0000 (18:25 -0500)
committerJonathan Rajotte Julien <jonathan.rajotte-julien@efficios.com>
Tue, 26 Feb 2019 16:45:04 +0000 (11:45 -0500)
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 <simon.marchi@efficios.com>
scripts/lttng-tools/hang_processes.sh

index 7639adb51983b6fcb1e335d7419437f6a91b97f9..6a102b89d3926e6527f7f4671b2bfa468c39c154 100755 (executable)
@@ -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
This page took 0.047026 seconds and 4 git commands to generate.