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 571c09fdc8)
changes/52/25252/1
Alexander Lutay 7 years ago
parent 387a733bbc
commit 367ccc6e57

@ -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 "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" echo "echo -e '$PASSWORD_ENCODED' >/tmp/vncpasswd ; vncviewer geometry=1280x1024x16 passwd=/tmp/vncpasswd localhost:5999"
RC=0
if [ -n "${3:-}" ] && [ "${3:-}" = "junit" ] ; then if [ -n "${3:-}" ] && [ "${3:-}" = "junit" ] ; then
CATALYST_SERVER=https://${SERVER}:1443/ prove -m --formatter TAP::Formatter::JUnit -l -It/lib t/selenium/*.t | \ 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 else
CATALYST_SERVER="https://${SERVER}:1443" prove -m -v --color -l -It/lib t/selenium/*.t | \ 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 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 for file in "${OUTPUT_DIRECTORY}/selenium.pretty" "${OUTPUT_DIRECTORY}/selenium.xml" ; do
if [ -f "$file" ] ; then if [ -f "$file" ] ; then
echo "Test results available at ${file}" echo "Test results available at ${file}"

Loading…
Cancel
Save