From f0e1f74fc6db62d1c87db9d6b6fb0566390ddc50 Mon Sep 17 00:00:00 2001 From: Alexander Lutay Date: Thu, 4 Apr 2019 14:17:02 +0200 Subject: [PATCH] TT#56376 Restore exit code propogation in t/selenium/testrunner Jenkins uses wrapper jenkins_docker_run which will mask exit code anyway and this is what we want currently: we need always zero exit code here on Jenkins. Jenkins will detect errors in produced artifacts (XML files) if any as a result the Jenkins job will be "yellow" instead of "red". Change-Id: I249fcde9103ee25e6798fcb835ee4a408f8f0f57 --- t/selenium/jenkins_docker_run | 10 +++++++++- t/selenium/testrunner | 7 +++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/t/selenium/jenkins_docker_run b/t/selenium/jenkins_docker_run index fc7f8a38f5..ad86414780 100755 --- a/t/selenium/jenkins_docker_run +++ b/t/selenium/jenkins_docker_run @@ -1,4 +1,12 @@ #!/bin/bash # This script is used for running the tests with # proper arguments from Jenkins under user 'selenium' -su - selenium -c "cd /code && ./t/selenium/testrunner $*" + +set -e + +su - selenium -c "cd /code && ./t/selenium/testrunner $*" || RC=$? + +## Jenkins will detect errors in produced artifacts if any +## as a result the Jenkins job will be "yellow" instead of "red". +[ -n "${RC}" ] && echo "Masking non-zero exit code '${RC}'" +exit 0 # ${RC:-0} diff --git a/t/selenium/testrunner b/t/selenium/testrunner index 4437f10f11..377a858343 100755 --- a/t/selenium/testrunner +++ b/t/selenium/testrunner @@ -56,6 +56,7 @@ echo "Selenium server log file available at /home/selenium/selenium.log" echo "Watch at test runs by connecting via VNC (password: '${PASSWORD}'):" echo "echo -e '$PASSWORD_ENCODED' >/tmp/vncpasswd ; vncviewer geometry=1280x1024x16 passwd=/tmp/vncpasswd localhost:5999" +RC=0 export CATALYST_SERVER="https://${SERVER}:1443" if [ "${OUTPUT_TYPE:-}" = "junit" ] ; then prove -ofvm --formatter TAP::Formatter::JUnit -l -It/lib "${TEST_PLAN[@]}" | \ @@ -65,13 +66,11 @@ else prove -ofv --color -l -It/lib "${TEST_PLAN[@]}" || RC=$? fi -echo "Finished test execution, test execution returned with exit code ${RC:-0}." +echo "Finished test execution, test execution returned with exit code ${RC}." if [ -f "${OUTPUT_DIRECTORY}/selenium.xml" ] ; then echo "Test results available at '${OUTPUT_DIRECTORY}/selenium.xml'" fi echo "################################################################################" -## exit cleanly here, Jenkins will detect errors in produced artifacts if any -## as a result the Jenkins job will be "yellow" instead of "red". -# exit "${RC}" +exit "${RC}"