From 64ecd511c290a2d5160d3abb1159a3ac859ae11b Mon Sep 17 00:00:00 2001 From: Martin Hierholzer <martin.hierholzer@desy.de> Date: Wed, 20 Feb 2019 11:12:52 +0100 Subject: [PATCH] doTest(): run all shell commands in the same sudo environment, so the environment variables incl. LD_PRELOAD are properly used --- vars/helper.groovy | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/vars/helper.groovy b/vars/helper.groovy index 7a9b093..78b9a36 100644 --- a/vars/helper.groovy +++ b/vars/helper.groovy @@ -167,15 +167,10 @@ def doBuild(String label, String buildType) { sudo -H -E -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 ${env.JOB_VARIABLES}; do export `eval echo \${VAR}` done - sudo -H -E -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 -E -u msk_jenkins cmake /scratch/source/\${RUN_FROM_SUBDIR} -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=${buildType} -DSUPPRESS_AUTO_DOC_BUILD=true \${CMAKE_EXTRA_ARGS} sudo -H -E -u msk_jenkins make ${env.MAKEOPTS} """ } @@ -196,6 +191,7 @@ def doTest(String label, String buildType) { // Prefix test names with label and buildType, so we can distinguish them later // Copy test results files to the workspace, otherwise they are not available to the xunit plugin sh """ + cat > /scratch/script <<EOF cd /scratch/build-${JOB_NAME} if [ -z "\${CTESTOPTS}" ]; then CTESTOPTS="${env.MAKEOPTS}" @@ -203,9 +199,12 @@ def doTest(String label, String buildType) { for VAR in ${env.JOB_VARIABLES} \${TEST_VARIABLES}; do export `eval echo \${VAR}` done - sudo -H -E -u msk_jenkins ctest --no-compress-output \${CTESTOPTS} -T Test -V || true - sudo -H -E -u msk_jenkins sed -i Testing/*/Test.xml -e 's_\\(^[[:space:]]*<Name>\\)\\(.*\\)\\(</Name>\\)\$_\\1${label}.${buildType}.\\2\\3_' - sudo -H -E -u msk_jenkins cp -r /scratch/build-${JOB_NAME}/Testing "${WORKSPACE}" + ctest --no-compress-output \${CTESTOPTS} -T Test -V || true + sed -i Testing/*/Test.xml -e 's_\\(^[[:space:]]*<Name>\\)\\(.*\\)\\(</Name>\\)\$_\\1${label}.${buildType}.\\2\\3_' + cp -r /scratch/build-${JOB_NAME}/Testing "${WORKSPACE}" +EOF + chmod +x /scratch/script + sudo -H -E -u msk_jenkins /scratch/script """ // Publish test result directly (works properly even with multiple publications from parallel branches) -- GitLab