diff options
author | Patrick Georgi <patrick@georgi-clan.de> | 2011-06-03 21:56:13 +0200 |
---|---|---|
committer | Patrick Georgi <patrick@georgi-clan.de> | 2011-06-06 17:13:50 +0200 |
commit | 140a990a612e25a6d4974f696b9fa757e834d764 (patch) | |
tree | 18990a30da738e3143664e64eb869cc97280dc28 /util | |
parent | fb38eb01cae8b2ff3b3dd99544abadff242d8a46 (diff) | |
download | coreboot-140a990a612e25a6d4974f696b9fa757e834d764.tar.xz |
Teach abuild to emit JUnit formatted build reports
Jenkins can produce reports from JUnit test cases, so we fake testcases
for each board.
Change-Id: I34d46d15c83f4f04d2228f302eb626b261ac098d
Reviewed-on: http://review.coreboot.org/1
Tested-by: build bot (Jenkins)
Reviewed-by: Sven Schnelle <svens@stackframe.org>
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Diffstat (limited to 'util')
-rwxr-xr-x | util/abuild/abuild | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/util/abuild/abuild b/util/abuild/abuild index 24e5d638bd..0ed295ff18 100755 --- a/util/abuild/abuild +++ b/util/abuild/abuild @@ -109,6 +109,20 @@ function xmlfile } >> $XMLFILE } +function junit +{ + test "$mode" == "junit" && printf "$*\n" >> $XMLFILE + return 0 +} + +function junitfile +{ + test "$mode" == "junit" && { + printf '<![CDATA[\n' + cat $1 + printf ']]>\n' + } >> $XMLFILE +} function vendors @@ -281,6 +295,7 @@ function compile_target etime=`perl -e 'print time();' 2>/dev/null || date +%s` duration=$(( $etime - $stime )) xml " <buildtime>${duration}s</buildtime>" + junit " <testcase classname='board' name='$TARCH/$VENDOR/$MAINBOARD' time='$duration' >" xml " <log>" xmlfile make.log @@ -288,12 +303,18 @@ function compile_target if [ $ret -eq 0 ]; then xml " <compile>ok</compile>" + junit "<system-out>" + junitfile make.log + junit "</system-out>" printf "ok\n" > compile.status printf "ok. (took ${duration}s)\n" cd $CURR return 0 else xml " <compile>failed</compile>" + junit "<failure type='BuildFailed'>" + junitfile make.log + junit "</failure>" printf "FAILED after ${duration}s!\nLog excerpt:\n" tail -n $CONTEXT make.log 2> /dev/null || tail -$CONTEXT make.log cd $CURR @@ -385,6 +406,9 @@ function build_target xml "" xml "</mainboard>" + junit " <testcase classname='board' name='$TARCH/$VENDOR/$MAINBOARD' >" + junit "<failure type='NoCrossCompiler'>No cross-compiler for $TARCH found</failure>" + return 0 else printf "$TARCH: ok, $ARCH using ${CROSS_COMPILE}gcc\n" @@ -408,6 +432,8 @@ function build_target xml " <status>knownbroken</status>" xml "" xml "</mainboard>" + junit " <testcase classname='board' name='$TARCH/$VENDOR/$MAINBOARD' >" + junit "<failure type='KnownBroken'>Board is marked as broken</failure>" return 0 } @@ -432,6 +458,7 @@ function build_target xml "" xml "</mainboard>" + junit "</testcase>" printf "\n" } @@ -511,6 +538,8 @@ function myhelp printf " [-h|--help] print this help and exit\n" printf " [-x|--xml] write xml log file \n" printf " (defaults to $XMLFILE)\n" + printf " [-J|--junit] write JUnit formatted xml log file \n" + printf " (defaults to $XMLFILE)\n" printf " [-T|--test] submit image(s) to automated test system\n" printf " [-c|--cpus <numcpus>] build on <numcpus> at the same time\n" printf " [-s|--silent] omit compiler calls in logs\n" @@ -554,11 +583,11 @@ test "$ROOT" = "" && ROOT=$( cd ../..; pwd ) getoptbrand="`getopt -V`" if [ "${getoptbrand:0:6}" == "getopt" ]; then # Detected GNU getopt that supports long options. - args=`getopt -l version,verbose,help,all,target:,broken,payloads:,test,cpus:,silent,xml,config,loglevel:,remove,prefix:,update,nostackprotect,scan-build,ccache -o Vvhat:bp:Tc:sxCl:rP:uy -- "$@"` + args=`getopt -l version,verbose,help,all,target:,broken,payloads:,test,cpus:,silent,junit,xml,config,loglevel:,remove,prefix:,update,nostackprotect,scan-build,ccache -o Vvhat:bp:Tc:sJxCl:rP:uy -- "$@"` eval set -- $args else # Detected non-GNU getopt - args=`getopt Vvhat:bp:Tc:sxCl:rP:uy $*` + args=`getopt Vvhat:bp:Tc:sJxCl:rP:uy $*` set -- $args fi @@ -570,6 +599,7 @@ fi while true ; do case "$1" in -x|--xml) shift; mode=xml; rm -f $XMLFILE ;; + -J|--junit) shift; mode=junit; rm -f $XMLFILE ;; -t|--target) shift; target="$1"; shift;; -a|--all) shift; buildall=true;; -b|--broken) shift; buildbroken=true;; @@ -602,6 +632,9 @@ debug "ROOT=$ROOT" xml '<?xml version="1.0" encoding="utf-8"?>' xml '<abuild>' +junit '<?xml version="1.0" encoding="utf-8"?>' +junit '<testsuite>' + if [ "$target" != "" ]; then # build a single board VENDOR=`printf $target|cut -f1 -d/` @@ -610,6 +643,7 @@ if [ "$target" != "" ]; then if [ ! -r $ROOT/src/mainboard/$target ]; then printf "No such target: $target\n" xml '</abuild>' + junit '</testsuite>' exit 1 fi build_target $VENDOR $MAINBOARD $CONFIG @@ -625,5 +659,6 @@ else done fi xml '</abuild>' +junit '</testsuite>' exit $failed |