support submitting tests to the test system in abuild. initial support.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Closes #3


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2474 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Stefan Reinauer 2006-10-25 19:02:34 +00:00 committed by Stefan Reinauer
parent 3d61074108
commit 3a1405725e
2 changed files with 113 additions and 51 deletions

View File

@ -14,6 +14,9 @@
#set -x # Turn echo on.... #set -x # Turn echo on....
ABUILD_DATE="October 24, 2006"
ABUILD_VERSION="0.4"
# Where shall we place all the build trees? # Where shall we place all the build trees?
TARGET=$( pwd )/linuxbios-builds TARGET=$( pwd )/linuxbios-builds
XMLFILE=$( pwd )/abuild.xml XMLFILE=$( pwd )/abuild.xml
@ -24,6 +27,8 @@ PAYLOAD=/dev/null
# Lines of error context to be printed in FAILURE case # Lines of error context to be printed in FAILURE case
CONTEXT=5 CONTEXT=5
TESTSUBMISSION="http://qa.linuxbios.org/deployment/send.php"
# One might want to adjust these in case of cross compiling # One might want to adjust these in case of cross compiling
MAKE="make" MAKE="make"
PYTHON=python PYTHON=python
@ -35,19 +40,34 @@ ARCH=`uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
-e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/ \ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/ \
-e "s/Power Macintosh/ppc/"` -e "s/Power Macintosh/ppc/"`
trap interrupt INT
function interrupt
{
printf "\n$0: execution interrupted manually.\n"
if [ "$mode" == "xml" ]; then
printf "$0: deleting incomplete xml output file.\n"
fi
exit 1
}
function debug function debug
{ {
test "$verbose" == "true" && echo $* test "$verbose" == "true" && printf "$*\n"
} }
function xml function xml
{ {
test "$mode" == "xml" && echo "$*" >> $XMLFILE test "$mode" == "xml" && printf "$*\n" >> $XMLFILE
} }
function xmlfile function xmlfile
{ {
test "$mode" == "xml" && { echo '<![CDATA['; cat $1; echo ']]>'; } >> $XMLFILE test "$mode" == "xml" && {
printf '<![CDATA[\n'
cat $1
printf ']]>\n'
} >> $XMLFILE
} }
@ -88,18 +108,18 @@ function create_config
if [ -x $payloads/payload.sh ]; then if [ -x $payloads/payload.sh ]; then
PAYLOAD=`$payloads/payload.sh $VENDOR $MAINBOARD` PAYLOAD=`$payloads/payload.sh $VENDOR $MAINBOARD`
echo "Using custom payload $PAYLOAD" printf "Using custom payload $PAYLOAD\n"
fi fi
mkdir -p $TARGET mkdir -p $TARGET
if [ -f $TARGCONFIG ]; then if [ -f $TARGCONFIG ]; then
cp $TARGCONFIG $TARGET/Config-${VENDOR}_${MAINBOARD}.lb cp $TARGCONFIG $TARGET/Config-${VENDOR}_${MAINBOARD}.lb
echo -n "Using existing test target $TARGCONFIG" printf "Using existing test target $TARGCONFIG"
xml " <config>$TARGCONFIG</config>" xml " <config>$TARGCONFIG</config>"
else else
echo -n " Creating config file..." printf " Creating config file..."
xml " <config>autogenerated</config>" xml " <config>autogenerated</config>"
( cat << EOF ( cat << EOF
# This will make a target directory of ./VENDOR_MAINBOARD # This will make a target directory of ./VENDOR_MAINBOARD
@ -149,7 +169,7 @@ EOF
-e s,CROSS_HOSTCC,"$HOSTCC",g \ -e s,CROSS_HOSTCC,"$HOSTCC",g \
$TARGET/Config-${VENDOR}_${MAINBOARD}.lb $TARGET/Config-${VENDOR}_${MAINBOARD}.lb
echo " ok" printf " ok\n"
} }
function create_builddir function create_builddir
@ -157,7 +177,7 @@ function create_builddir
VENDOR=$1 VENDOR=$1
MAINBOARD=$2 MAINBOARD=$2
echo -n " Creating builddir..." printf " Creating builddir..."
target_dir=$TARGET target_dir=$TARGET
config_dir=$LBROOT/util/newconfig config_dir=$LBROOT/util/newconfig
@ -182,12 +202,12 @@ function create_builddir
export PYTHONPATH=$config_dir export PYTHONPATH=$config_dir
$PYTHON $config_py $config_lb $LBROOT &> $build_dir/config.log $PYTHON $config_py $config_lb $LBROOT &> $build_dir/config.log
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "ok" printf "ok\n"
xml " <builddir>ok</builddir>" xml " <builddir>ok</builddir>"
xml "" xml ""
return 0 return 0
else else
echo "FAILED! Log excerpt:" printf "FAILED! Log excerpt:\n"
xml " <builddir>failed</builddir>" xml " <builddir>failed</builddir>"
xml " <log>" xml " <log>"
xmlfile $build_dir/config.log xmlfile $build_dir/config.log
@ -211,7 +231,7 @@ function compile_target
VENDOR=$1 VENDOR=$1
MAINBOARD=$2 MAINBOARD=$2
echo -n " Compiling image .." printf " Compiling image .."
CURR=$( pwd ) CURR=$( pwd )
cd $TARGET/${VENDOR}_${MAINBOARD} cd $TARGET/${VENDOR}_${MAINBOARD}
stime=`date +%s` stime=`date +%s`
@ -222,8 +242,8 @@ function compile_target
if [ $ret -eq 0 ]; then if [ $ret -eq 0 ]; then
xml " <compile>ok</compile>" xml " <compile>ok</compile>"
xml " <compiletime>${duration}s</compiletime>" xml " <compiletime>${duration}s</compiletime>"
echo "ok" > compile.status printf "ok\n" > compile.status
echo "ok. (took ${duration}s)" printf "ok. (took ${duration}s)\n"
cd $CURR cd $CURR
return 0 return 0
else else
@ -233,7 +253,7 @@ function compile_target
xmlfile make.log xmlfile make.log
xml " </log>" xml " </log>"
echo "FAILED after ${duration}s! Log excerpt:" printf "FAILED after ${duration}s! Log excerpt:\n"
tail -n $CONTEXT make.log tail -n $CONTEXT make.log
cd $CURR cd $CURR
return 1 return 1
@ -273,7 +293,7 @@ function build_target
HOSTCC='gcc' HOSTCC='gcc'
CROSS_COMPILE='' CROSS_COMPILE=''
echo -n "Processing mainboard/$VENDOR/$MAINBOARD" printf "Processing mainboard/$VENDOR/$MAINBOARD"
xml "<mainboard>" xml "<mainboard>"
xml "" xml ""
@ -287,7 +307,7 @@ function build_target
source $LBROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info source $LBROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info
if [ "$ARCH" == "$TARCH" ]; then if [ "$ARCH" == "$TARCH" ]; then
echo " ($TARCH: ok)" printf " ($TARCH: ok)\n"
else else
found_crosscompiler=false found_crosscompiler=false
if [ "$ARCH" == amd64 -a "$TARCH" == i386 ]; then if [ "$ARCH" == amd64 -a "$TARCH" == i386 ]; then
@ -314,15 +334,14 @@ function build_target
# Check result: # Check result:
if [ $found_crosscompiler == "false" ]; then if [ $found_crosscompiler == "false" ]; then
echo " ($TARCH: skipped, we're $ARCH)" printf " ($TARCH: skipped, we're $ARCH)\n\n"
echo
xml " <status>notbuilt</status>" xml " <status>notbuilt</status>"
xml "" xml ""
xml "</mainboard>" xml "</mainboard>"
return 0 return 0
else else
echo " ($TARCH: ok, we're $ARCH)" printf " ($TARCH: ok, we're $ARCH)\n"
xml " <compiler>" xml " <compiler>"
xml " <path>`which ${CROSS_COMPILE}gcc`</path>" xml " <path>`which ${CROSS_COMPILE}gcc`</path>"
xml " <version>`${CROSS_COMPILE}gcc --version | head -1`</version>" xml " <version>`${CROSS_COMPILE}gcc --version | head -1`</version>"
@ -333,8 +352,7 @@ function build_target
built_successfully $VENDOR $MAINBOARD && \ built_successfully $VENDOR $MAINBOARD && \
{ {
echo " ( mainboard/$VENDOR/$MAINBOARD previously ok )" printf " ( mainboard/$VENDOR/$MAINBOARD previously ok )\n\n"
echo
xml " <status>previouslyok</status>" xml " <status>previouslyok</status>"
xml "" xml ""
xml "</mainboard>" xml "</mainboard>"
@ -343,8 +361,7 @@ function build_target
build_broken $VENDOR $MAINBOARD || \ build_broken $VENDOR $MAINBOARD || \
{ {
echo " ( broken mainboard/$VENDOR/$MAINBOARD skipped )" printf " ( broken mainboard/$VENDOR/$MAINBOARD skipped )\n\n"
echo
xml " <status>knownbroken</status>" xml " <status>knownbroken</status>"
xml "" xml ""
xml "</mainboard>" xml "</mainboard>"
@ -354,51 +371,88 @@ function build_target
create_buildenv $VENDOR $MAINBOARD create_buildenv $VENDOR $MAINBOARD
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
compile_target $VENDOR $MAINBOARD && compile_target $VENDOR $MAINBOARD &&
xml "<status>ok</status>" || xml " <status>ok</status>" ||
xml "<status>broken</status>" xml "<status>broken</status>"
fi fi
xml "" xml ""
xml "</mainboard>" xml "</mainboard>"
echo printf "\n"
}
function test_target
{
VENDOR=$1
MAINBOARD=$2
if [ "$hwtest" != "true" ]; then
return 0
fi
# image does not exist. we silently skip the patch.
if [ ! -r "$TARGET/${VENDOR}_${MAINBOARD}/linuxbios.rom" ]; then
return 0
fi
which curl &> /dev/null
if [ $? != 0 ]; then
printf "curl is not installed but required for test submission. skipping test.\n\n"
return 0
fi
CURR=`pwd`
if [ -r "$TARGET/${VENDOR}_${MAINBOARD}/tested" ]; then
printf "Testing image for board $VENDOR $MAINBOARD skipped (previously submitted).\n\n"
return 0
fi
# touch $TARGET/${VENDOR}_${MAINBOARD}/tested
printf "Submitting image for board $VENDOR $MAINBOARD to test system...\n"
curl -f -F "romfile=@$TARGET/${VENDOR}_${MAINBOARD}/linuxbios.rom" \
-F "mode=abuild" -F "mainboard=${VENDOR}_${MAINBOARD}" -F "submit=Upload" \
"http://qa.linuxbios.org/deployment/send.php"
printf "\n"
return 0
} }
function myhelp function myhelp
{ {
echo "Usage: $0 [-v] [-a] [-b] [-t <vendor/board>] [-p <dir>] [lbroot]" printf "Usage: $0 [-v] [-a] [-b] [-t <vendor/board>] [-p <dir>] [lbroot]\n"
echo " $0 [-V|--version]" printf " $0 [-V|--version]\n"
echo " $0 [-h|--help]" printf " $0 [-h|--help]\n"
echo printf
echo "Options:" printf "Options:\n"
echo " [-v|--verbose] print more messages" printf " [-v|--verbose] print more messages\n"
echo " [-a|--all] build previously succeeded ports as well" printf " [-a|--all] build previously succeeded ports as well\n"
echo " [-b|--broken] attempt to build ports that are known broken" printf " [-b|--broken] attempt to build ports that are known broken\n"
echo " [-t|--target <vendor/board>] attempt to build target vendor/board only" printf " [-t|--target <vendor/board>] attempt to build target vendor/board only\n"
echo " [-p|--payloads <dir>] use payloads in <dir> to build images" printf " [-p|--payloads <dir>] use payloads in <dir> to build images\n"
echo " [-V|--version] print version number and exit" printf " [-V|--version] print version number and exit\n"
echo " [-h|--help] print this help and exit" printf " [-h|--help] print this help and exit\n"
echo " [-x|--xml] write xml log file " printf " [-x|--xml] write xml log file \n"
echo " (defaults to $XMLFILE)" printf " (defaults to $XMLFILE)\n"
echo " [lbroot] absolute path to LinuxBIOS sources" printf " [-T|--test] submit image(s) to automated test system\n"
echo " (defaults to $LBROOT)" printf " [lbroot] absolute path to LinuxBIOS sources\n"
echo printf " (defaults to $LBROOT)\n\n"
} }
function myversion function myversion
{ {
cat << EOF cat << EOF
LinuxBIOS autobuild: V0.3. LinuxBIOS autobuild v$ABUILD_VERSION ($ABUILD_DATE)
Copyright (C) 2004 by Stefan Reinauer <stepan@openbios.org> Copyright (C) 2004 by Stefan Reinauer <stepan@openbios.org>
Copyright (C) 2006 by coresystems GmbH <info@coresystems.de> Copyright (C) 2006 by coresystems GmbH <info@coresystems.de>
This program is free software; you may redistribute it under the terms This program is free software; you may redistribute it under the terms
of the GNU General Public License. This program has absolutely no of the GNU General Public License. This program has absolutely no
warranty. warranty.
EOF EOF
myhelp
} }
# default options # default options
@ -408,7 +462,7 @@ LBROOT=$( cd ../..; pwd )
verbose=false verbose=false
# parse parameters # parse parameters
args=`getopt -l version,verbose,help,all,target:,broken,payloads: Vvhat:bp: -- "$@"` args=`getopt -l version,verbose,help,all,target:,broken,payloads:,test Vvhat:bp:T -- "$@"`
if [ $? != 0 ]; then if [ $? != 0 ]; then
myhelp myhelp
@ -424,10 +478,11 @@ while true ; do
-b|--broken) shift; buildbroken=true;; -b|--broken) shift; buildbroken=true;;
-v|--verbose) shift; verbose=true;; -v|--verbose) shift; verbose=true;;
-V|--version) shift; myversion; exit 0;; -V|--version) shift; myversion; exit 0;;
-h|--help) shift; myhelp; exit 0;; -h|--help) shift; myversion; myhelp; exit 0;;
-p|--payloads) shift; payloads="$1"; shift;; -p|--payloads) shift; payloads="$1"; shift;;
-T|--test) shift; hwtest=true;;
--) shift; break;; --) shift; break;;
-*) echo -e "Invalid option\n"; myhelp; exit 1;; -*) printf "Invalid option\n\n"; myhelp; exit 1;;
*) break;; *) break;;
esac esac
done done
@ -442,14 +497,16 @@ xml '<abuild>'
if [ "$target" != "" ]; then if [ "$target" != "" ]; then
# build a single board # build a single board
VENDOR=`echo $target|cut -f1 -d/` VENDOR=`printf $target|cut -f1 -d/`
MAINBOARD=`echo $target|cut -f2 -d/` MAINBOARD=`printf $target|cut -f2 -d/`
build_target $VENDOR $MAINBOARD build_target $VENDOR $MAINBOARD
test_target $VENDOR $MAINBOARD
else else
# build all boards per default # build all boards per default
for VENDOR in $( vendors ); do for VENDOR in $( vendors ); do
for MAINBOARD in $( mainboards $VENDOR ); do for MAINBOARD in $( mainboards $VENDOR ); do
build_target $VENDOR $MAINBOARD build_target $VENDOR $MAINBOARD
test_target $VENDOR $MAINBOARD
done done
done done
fi fi

View File

@ -1,4 +1,4 @@
.TH ABUILD 1 "September 19, 2006" .TH ABUILD 1 "October 24, 2006"
.SH NAME .SH NAME
abuild \- build LinuxBIOS images for all available targets abuild \- build LinuxBIOS images for all available targets
.SH SYNOPSIS .SH SYNOPSIS
@ -41,6 +41,11 @@ The file will be called
.B abuild.xml .B abuild.xml
and will be created in the current directory. and will be created in the current directory.
.TP .TP
.B "\-T, \-\-test"
Submit generated image(s) to the automated test system.
The results of the tests will be made available at
.B http://qa.linuxbios.org/log_manual.php
.TP
.B "\-v, \-\-verbose" .B "\-v, \-\-verbose"
More verbose output. More verbose output.
.TP .TP
@ -62,7 +67,7 @@ is covered by the GNU General Public License (GPL), version 2 or later.
.br .br
2006 coresystems GmbH 2006 coresystems GmbH
.SH AUTHORS .SH AUTHORS
Stefan Reinauer <stepan@openbios.org> Stefan Reinauer <stepan@coresystems.de>
.PP .PP
This manual page was written by Uwe Hermann <uwe@hermann-uwe.de>. This manual page was written by Uwe Hermann <uwe@hermann-uwe.de>.
It is licensed under the terms of the GNU GPL (v2 or later). It is licensed under the terms of the GNU GPL (v2 or later).