File: after-failure.sh

package info (click to toggle)
jabref 3.8.1%2Bds-3%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 18,336 kB
  • sloc: java: 114,114; xml: 3,985; python: 283; sh: 282; perl: 200; ruby: 22; makefile: 6
file content (27 lines) | stat: -rwxr-xr-x 970 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# taken from https://github.com/lhotari/travis-gradle-test-failures-to-console/blob/master/travis/junit-errors-to-stdout.sh
IFS='
'
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
if [ "$TRAVIS" = "true" ]; then
	#echo 'Installing xml-twig-tools and xsltproc....'
	sudo apt-get install -qq -y --force-yes xml-twig-tools xsltproc > /dev/null
fi
ROOTDIR="$1"
if [ -z "$ROOTDIR" ]; then
	ROOTDIR="."
fi
echo 'Formatting results...'
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
		echo "Formatting $file"
		if [ -f "$file" ]; then
			echo '====================================================='
			xsltproc "$DIR/junit-xml-format-errors.xsl" "$file"
		fi
	done
	echo '====================================================='
else
	echo 'No */build/test-results/*.xml files found with failing tests.'
fi