From 367ccc6e5785377301e330c76766e7151c9f48e7 Mon Sep 17 00:00:00 2001 From: Alexander Lutay Date: Tue, 6 Nov 2018 14:19:47 +0100 Subject: [PATCH] TT#46791 Fix exit code passing in pipe for selenium testrunner The old code didn't work as expected, as RC receives 'tee' exit code (which is zero in most of the cases) instead of 'prove' exit code. The new code gets 'prove' exit code and it changes nothing at the end, as we just print it into debug message. Anyway Jenkins operates with JUnit output to detect issues. It is better to have 'correct' code here to prevent misunderstanding in the future. Change-Id: I09f399813179590a67c25509f310c91f7e297f3a (cherry picked from commit 571c09fdc815e38f4c91da5fde69a432dceb38e3) --- t/selenium/testrunner | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/t/selenium/testrunner b/t/selenium/testrunner index 8a9e98ae5c..88f4cc7478 100755 --- a/t/selenium/testrunner +++ b/t/selenium/testrunner @@ -51,16 +51,17 @@ 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 if [ -n "${3:-}" ] && [ "${3:-}" = "junit" ] ; then CATALYST_SERVER=https://${SERVER}:1443/ prove -m --formatter TAP::Formatter::JUnit -l -It/lib t/selenium/*.t | \ - tee -a "${OUTPUT_DIRECTORY}/selenium.xml" || RC=$? + tee -a "${OUTPUT_DIRECTORY}/selenium.xml" + RC="${PIPESTATUS[0]}" else CATALYST_SERVER="https://${SERVER}:1443" prove -m -v --color -l -It/lib t/selenium/*.t | \ - tee -a "${OUTPUT_DIRECTORY}/selenium.pretty" || RC=$? + tee -a "${OUTPUT_DIRECTORY}/selenium.pretty" + RC="${PIPESTATUS[0]}" fi -echo "Finished test execution, test execution returned with exit code ${RC}." +echo "Finished test execution, test execution returned with exit code ${RC:-0}." for file in "${OUTPUT_DIRECTORY}/selenium.pretty" "${OUTPUT_DIRECTORY}/selenium.xml" ; do if [ -f "$file" ] ; then echo "Test results available at ${file}"