From 21903f6b2cda1081b7cbabc5e8351929a68b0776 Mon Sep 17 00:00:00 2001 From: Lari Hotari Date: Sat, 29 Nov 2014 00:01:45 +0200 Subject: [PATCH] Travis CI build improvement: output test errors to stdout as text when build fails --- travis-after-failure.sh | 1 + travis/junit-errors-to-stdout.sh | 19 ++++++++++ travis/junit-xml-format-errors.xsl | 60 ++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100755 travis/junit-errors-to-stdout.sh create mode 100644 travis/junit-xml-format-errors.xsl diff --git a/travis-after-failure.sh b/travis-after-failure.sh index f6c23c96c9c..50f8b3dd6ae 100755 --- a/travis-after-failure.sh +++ b/travis-after-failure.sh @@ -1,4 +1,5 @@ #!/bin/bash +./travis/junit-errors-to-stdout.sh if [[ $TRAVIS_BRANCH =~ ^master|2\..\.x$ && $TRAVIS_REPO_SLUG == grails/* && $TRAVIS_PULL_REQUEST == 'false' ]]; then echo "Install duplicity with S3 support" diff --git a/travis/junit-errors-to-stdout.sh b/travis/junit-errors-to-stdout.sh new file mode 100755 index 00000000000..98ef1bd62ed --- /dev/null +++ b/travis/junit-errors-to-stdout.sh @@ -0,0 +1,19 @@ +#!/bin/bash +IFS=' +' +DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +sudo apt-get install -y --force-yes xml-twig-tools xsltproc +ROOTDIR="$1" +if [ -z "$ROOTDIR" ]; then + ROOTDIR="." +fi +FILES=$(find "$ROOTDIR" -path '*/build/test-results/*.xml' | xargs --no-run-if-empty xml_grep --files --cond 'testsuite[@failures > 0 or @errors > 0]') +if [ -n "$FILES" ]; then + for file in "$FILES"; do + if [ -f "$file" ]; then + echo '=====================================================' + xsltproc "$DIR/junit-xml-format-errors.xsl" "$file" + fi + done + echo '=====================================================' +fi diff --git a/travis/junit-xml-format-errors.xsl b/travis/junit-xml-format-errors.xsl new file mode 100644 index 00000000000..5f27accb659 --- /dev/null +++ b/travis/junit-xml-format-errors.xsl @@ -0,0 +1,60 @@ + + + + + Testsuite: + +Tests run: + + , Failures: + + , Errors: + + , Time elapsed: + + sec + +--------- ----------- --------- + + + + + + + +Testcase: + + took + + + FAILURE + ERROR + SUCCESS + + + + + + + + + + + + + + + +------ Standard output ------ + + + + + + +------ Error output ------ + + + + + \ No newline at end of file