From 7e326b3aae71a757ca5ebab2701b25d1413d2c6a Mon Sep 17 00:00:00 2001
From: Martin Hierholzer <martin.hierholzer@desy.de>
Date: Mon, 18 Feb 2019 14:39:33 +0100
Subject: [PATCH] presumably fixed issues with TEST_VARABLES and JOB_VARIABLES

---
 README.md          |  2 +-
 vars/helper.groovy | 24 +++++++++++++-----------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/README.md b/README.md
index 46b5705..0ef2028 100644
--- a/README.md
+++ b/README.md
@@ -52,7 +52,7 @@ env.RUN_FROM_SUBDIR="examples"
 The variables are gives as space separated lists of key=values pairs. The pairs must not have spaces. JOB_VARIABLES are applied to build and tests (incl. analysis), while TEST_VARIABLES are only in tests and analysis.
 ```
 env.JOB_VARIABLES="A=aha B=bubu"
-env.TEST_VARABLES="PATH=${PATH}:/some/path/for/the/test"
+env.TEST_VARABLES='PATH=${PATH}:/some/path/for/the/test'
 ```
 
 
diff --git a/vars/helper.groovy b/vars/helper.groovy
index 54455ac..56d57d2 100644
--- a/vars/helper.groovy
+++ b/vars/helper.groovy
@@ -161,15 +161,16 @@ def doBuild(String label, String buildType) {
       sudo -H -u msk_jenkins mkdir -p /scratch/install
       cd /scratch/build-${JOB_NAME}
       # We might run only part of the project from a sub-directory. If it is empty the trailing / does not confuse cmake
-     if [ -z "\${RUN_FROM_SUBDIR}" ]; then
-      SUBDIR=""
-     else
-      SUBDIR="${env.RUN_FROM_SUBDIR}"
-     fi
-     for VAR in \${JOB_VARIABLES}; do
-       export \${VAR}
-     done
-     sudo -H -u msk_jenkins cmake /scratch/source/\${SUBDIR} -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=${buildType} -DSUPPRESS_AUTO_DOC_BUILD=true \${CMAKE_EXTRA_ARGS}
+      if [ -z "\${RUN_FROM_SUBDIR}" ]; then
+        SUBDIR=""
+      else
+        SUBDIR="${env.RUN_FROM_SUBDIR}"
+      fi
+      for VAR in ${env.JOB_VARIABLES}; do
+        export `eval echo \${VAR}`
+      done
+      export
+      sudo -H -u msk_jenkins cmake /scratch/source/\${SUBDIR} -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=${buildType} -DSUPPRESS_AUTO_DOC_BUILD=true \${CMAKE_EXTRA_ARGS}
       sudo -H -u msk_jenkins make ${env.MAKEOPTS}
     """
   }
@@ -194,9 +195,10 @@ def doTest(String label, String buildType) {
     if [ -z "\${CTESTOPTS}" ]; then
       CTESTOPTS="${env.MAKEOPTS}"
     fi
-    for VAR in \${JOB_VARIABLES}  \${TEST_VARIABLES}; do
-       export \${VAR}
+    for VAR in ${env.JOB_VARIABLES} \${TEST_VARIABLES}; do
+       export `eval echo \${VAR}`
     done
+    export
     sudo -H -u msk_jenkins ctest --no-compress-output \${CTESTOPTS} -T Test -V || true
     sudo -H -u msk_jenkins sed -i Testing/*/Test.xml -e 's_\\(^[[:space:]]*<Name>\\)\\(.*\\)\\(</Name>\\)\$_\\1${label}.${buildType}.\\2\\3_'
     sudo -H -u msk_jenkins cp -r /scratch/build-${JOB_NAME}/Testing "${WORKSPACE}"
-- 
GitLab