abuild: drop xml mode

We use junit style output these days.

Change-Id: I4110ec10bf0e9f4354ee08e7e1c5a81ae605fee0
Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Reviewed-on: http://review.coreboot.org/4484
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
Patrick Georgi 2013-12-05 19:36:31 +01:00 committed by Alexandru Gagniuc
parent b17117904d
commit 6f0e160459
1 changed files with 4 additions and 70 deletions

View File

@ -60,7 +60,7 @@ if [ "$i" = "nonexistant_make" ]; then
fi fi
MAKE=$i MAKE=$i
# this can be changed to xml by -x # this can be changed to junit by -J
mode=text mode=text
# silent mode.. no compiler calls, only warnings in the log files. # silent mode.. no compiler calls, only warnings in the log files.
@ -83,7 +83,7 @@ trap interrupt INT
function interrupt function interrupt
{ {
printf "\n$0: execution interrupted manually.\n" printf "\n$0: execution interrupted manually.\n"
if [ "$mode" == "xml" ]; then if [ "$mode" == "junit" ]; then
printf "$0: deleting incomplete xml output file.\n" printf "$0: deleting incomplete xml output file.\n"
fi fi
exit 1 exit 1
@ -94,21 +94,6 @@ function debug
test "$verbose" == "true" && printf "$*\n" test "$verbose" == "true" && printf "$*\n"
} }
function xml
{
test "$mode" == "xml" && printf "$*\n" >> $XMLFILE
return 0
}
function xmlfile
{
test "$mode" == "xml" && {
printf '<![CDATA[\n'
cat $1
printf ']]>\n'
} >> $XMLFILE
}
function junit function junit
{ {
test "$mode" == "junit" && printf "$*\n" >> $XMLFILE test "$mode" == "junit" && printf "$*\n" >> $XMLFILE
@ -181,11 +166,9 @@ function create_config
if [ "$CONFIG" != "" ]; then if [ "$CONFIG" != "" ]; then
printf " Using existing configuration $CONFIG ... " printf " Using existing configuration $CONFIG ... "
xml " <config>$CONFIG</config>"
cp src/mainboard/$VENDOR/$MAINBOARD/$CONFIG ${build_dir}/config.build cp src/mainboard/$VENDOR/$MAINBOARD/$CONFIG ${build_dir}/config.build
else else
printf " Creating config file... " printf " Creating config file... "
xml " <config>autogenerated</config>"
grep "if[\t ]*VENDOR" src/mainboard/$VENDOR/$MAINBOARD/../Kconfig | \ grep "if[\t ]*VENDOR" src/mainboard/$VENDOR/$MAINBOARD/../Kconfig | \
sed "s,^.*\(VENDOR_.*\)[^A-Z0-9_]*,CONFIG_\1=y," > ${build_dir}/config.build sed "s,^.*\(VENDOR_.*\)[^A-Z0-9_]*,CONFIG_\1=y," > ${build_dir}/config.build
grep "if[\t ]*BOARD" src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \ grep "if[\t ]*BOARD" src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \
@ -210,20 +193,10 @@ function create_config
ret=$? ret=$?
if [ $ret -eq 0 ]; then if [ $ret -eq 0 ]; then
printf "ok; " printf "ok; "
xml " <builddir>ok</builddir>"
xml " <log>"
xmlfile $build_dir/config.log
xml " </log>"
xml ""
return 0 return 0
else else
# Does this ever happen? # Does this ever happen?
printf "FAILED!\nLog excerpt:\n" printf "FAILED!\nLog excerpt:\n"
xml " <builddir>failed</builddir>"
xml " <log>"
xmlfile $build_dir/config.log
xml " </log>"
xml ""
tail -n $CONTEXT $build_dir/config.log 2> /dev/null || tail -$CONTEXT $build_dir/config.log tail -n $CONTEXT $build_dir/config.log 2> /dev/null || tail -$CONTEXT $build_dir/config.log
return 1 return 1
fi fi
@ -274,15 +247,9 @@ function compile_target
etime=`perl -e 'print time();' 2>/dev/null || date +%s` etime=`perl -e 'print time();' 2>/dev/null || date +%s`
duration=$(( $etime - $stime )) duration=$(( $etime - $stime ))
xml " <buildtime>${duration}s</buildtime>"
junit " <testcase classname='board' name='$TARCH/$VENDOR/$MAINBOARD' time='$duration' >" junit " <testcase classname='board' name='$TARCH/$VENDOR/$MAINBOARD' time='$duration' >"
xml " <log>"
xmlfile make.log
xml " </log>"
if [ $ret -eq 0 ]; then if [ $ret -eq 0 ]; then
xml " <compile>ok</compile>"
junit "<system-out>" junit "<system-out>"
junitfile make.log junitfile make.log
junit "</system-out>" junit "</system-out>"
@ -291,7 +258,6 @@ function compile_target
cd $CURR cd $CURR
return 0 return 0
else else
xml " <compile>failed</compile>"
junit "<failure type='BuildFailed'>" junit "<failure type='BuildFailed'>"
junitfile make.log junitfile make.log
junit "</failure>" junit "</failure>"
@ -338,14 +304,6 @@ function build_target
mkdir -p $TOP/$TARGET/${VENDOR}_${MAINBOARD} mkdir -p $TOP/$TARGET/${VENDOR}_${MAINBOARD}
XMLFILE=$TOP/$TARGET/${VENDOR}_${MAINBOARD}/abuild.xml XMLFILE=$TOP/$TARGET/${VENDOR}_${MAINBOARD}/abuild.xml
xml "<mainboard>"
xml ""
xml " <vendor>$VENDOR</vendor>"
xml " <device>$MAINBOARD</device>"
xml ""
xml " <architecture>$TARCH</architecture>"
xml ""
if [ "$ARCH" = "$TARCH" -o $found_crosscompiler = true ]; then if [ "$ARCH" = "$TARCH" -o $found_crosscompiler = true ]; then
printf "$TARCH: ok$CROSS_TEXT\n" printf "$TARCH: ok$CROSS_TEXT\n"
else else
@ -383,10 +341,6 @@ function build_target
# Check result: # Check result:
if [ $found_crosscompiler == "false" ]; then if [ $found_crosscompiler == "false" ]; then
printf "$TARCH: skipped, we're $ARCH\n\n" printf "$TARCH: skipped, we're $ARCH\n\n"
xml " <status>notbuilt</status>"
xml ""
xml "</mainboard>"
junit "<testcase classname='board' name='$TARCH/$VENDOR/$MAINBOARD' >" junit "<testcase classname='board' name='$TARCH/$VENDOR/$MAINBOARD' >"
junit " <failure type='NoCrossCompiler'>No cross-compiler for $TARCH found</failure>" junit " <failure type='NoCrossCompiler'>No cross-compiler for $TARCH found</failure>"
junit "</testcase>" junit "</testcase>"
@ -394,11 +348,6 @@ function build_target
return 0 return 0
else else
printf "$TARCH: ok, $ARCH using ${CROSS_COMPILE}gcc\n" printf "$TARCH: ok, $ARCH using ${CROSS_COMPILE}gcc\n"
xml " <compiler>"
xml " <path>`which ${CROSS_COMPILE}gcc`</path>"
xml " <version>`${CROSS_COMPILE}gcc --version | head -1`</version>"
xml " </compiler>"
xml ""
fi fi
fi fi
@ -414,9 +363,7 @@ function build_target
if [ "$scanbuild" = "true" ]; then if [ "$scanbuild" = "true" ]; then
rm -rf $TARGET/scan-build-results-tmp rm -rf $TARGET/scan-build-results-tmp
fi fi
compile_target $VENDOR $MAINBOARD && compile_target $VENDOR $MAINBOARD
xml " <status>ok</status>" ||
xml "<status>broken</status>"
if [ "$scanbuild" = "true" ]; then if [ "$scanbuild" = "true" ]; then
rm -rf $TARGET/${VENDOR}_${MAINBOARD}-scanbuild rm -rf $TARGET/${VENDOR}_${MAINBOARD}-scanbuild
mv `dirname $TARGET/scan-build-results-tmp/*/index.html` $TARGET/${VENDOR}_${MAINBOARD}-scanbuild mv `dirname $TARGET/scan-build-results-tmp/*/index.html` $TARGET/${VENDOR}_${MAINBOARD}-scanbuild
@ -425,10 +372,7 @@ function build_target
# Not calculated here because we still print it in compile_target # Not calculated here because we still print it in compile_target
#etime=`perl -e 'print time();' 2>/dev/null || date +%s` #etime=`perl -e 'print time();' 2>/dev/null || date +%s`
#duration=$(( $etime - $stime )) #duration=$(( $etime - $stime ))
#xml " <buildtime>${duration}s</buildtime>"
xml ""
xml "</mainboard>"
junit "</testcase>" junit "</testcase>"
printf "\n" printf "\n"
@ -506,8 +450,6 @@ function myhelp
printf " [-p|--payloads <dir>] use payloads in <dir> to build images\n" printf " [-p|--payloads <dir>] use payloads in <dir> to build images\n"
printf " [-V|--version] print version number and exit\n" printf " [-V|--version] print version number and exit\n"
printf " [-h|--help] print this help and exit\n" 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 " [-J|--junit] write JUnit formatted xml log file \n"
printf " (defaults to $XMLFILE)\n" printf " (defaults to $XMLFILE)\n"
printf " [-T|--test] submit image(s) to automated test system\n" printf " [-T|--test] submit image(s) to automated test system\n"
@ -561,7 +503,7 @@ cmdline="$* -c 1"
getoptbrand="`getopt -V`" getoptbrand="`getopt -V`"
if [ "${getoptbrand:0:6}" == "getopt" ]; then if [ "${getoptbrand:0:6}" == "getopt" ]; then
# Detected GNU getopt that supports long options. # Detected GNU getopt that supports long options.
args=`getopt -l version,verbose,help,all,target:,payloads:,test,cpus:,silent,junit,xml,config,loglevel:,remove,prefix:,update,nostackprotect,scan-build,ccache,blobs -o Vvhat:p:Tc:sJxCl:rP:uyB -- "$@"` || exit 1 args=`getopt -l version,verbose,help,all,target:,payloads:,test,cpus:,silent,junit,config,loglevel:,remove,prefix:,update,nostackprotect,scan-build,ccache,blobs -o Vvhat:p:Tc:sJCl:rP:uyB -- "$@"` || exit 1
eval set -- $args eval set -- $args
else else
# Detected non-GNU getopt # Detected non-GNU getopt
@ -578,7 +520,6 @@ customizing=""
configoptions="" configoptions=""
while true ; do while true ; do
case "$1" in case "$1" in
-x|--xml) shift; mode=xml; rm -f $XMLFILE ;;
-J|--junit) shift; mode=junit; rm -f $XMLFILE ;; -J|--junit) shift; mode=junit; rm -f $XMLFILE ;;
-t|--target) shift; target="$1"; shift;; -t|--target) shift; target="$1"; shift;;
-a|--all) shift; buildall=true;; -a|--all) shift; buildall=true;;
@ -684,9 +625,6 @@ test -z "$1" || ROOT=$1
debug "ROOT=$ROOT" debug "ROOT=$ROOT"
xml '<?xml version="1.0" encoding="utf-8"?>'
xml '<abuild>'
junit '<?xml version="1.0" encoding="utf-8"?>' junit '<?xml version="1.0" encoding="utf-8"?>'
junit '<testsuite>' junit '<testsuite>'
@ -708,9 +646,6 @@ else
build_all_targets build_all_targets
rm -f $REAL_XMLFILE rm -f $REAL_XMLFILE
XMLFILE=$REAL_XMLFILE XMLFILE=$REAL_XMLFILE
xml '<?xml version="1.0" encoding="utf-8"?>'
xml '<abuild>'
junit '<?xml version="1.0" encoding="utf-8"?>' junit '<?xml version="1.0" encoding="utf-8"?>'
junit '<testsuite>' junit '<testsuite>'
if [ "$mode" != "text" ]; then if [ "$mode" != "text" ]; then
@ -720,7 +655,6 @@ else
fi fi
XMLFILE=$REAL_XMLFILE XMLFILE=$REAL_XMLFILE
fi fi
xml '</abuild>'
junit '</testsuite>' junit '</testsuite>'
exit $failed exit $failed