util/abuild: Print list of failed boards at the end of the abuild

When running abuild outside of jenkins, because all of the builds are
printed intermixed, it's easy to miss when a board has failed the build
by looking at the output.  This saves a list of failed builds and prints
the list at the end of the run.

- Add a command line option to mark when abuild is being called
recursively.
- Add all failed builds to a list.
- Print the list when a non-recursive abuild run exits.

Change-Id: Icb40ed8083a57bbcde49297d2b0814f98dcbb6c8
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/17890
Tested-by: build bot (Jenkins)
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Martin Roth 2016-12-14 10:16:26 -07:00
parent e6bd18f6b5
commit 047c2f44b0
1 changed files with 26 additions and 3 deletions

View File

@ -79,6 +79,9 @@ quiet=false
# clang mode enabled by -sb option. # clang mode enabled by -sb option.
scanbuild=false scanbuild=false
# Mark whether abuild was called recursively
recursive=false
trap interrupt INT trap interrupt INT
function interrupt function interrupt
@ -359,6 +362,7 @@ function compile_target
printf "failed\n" > compile.status printf "failed\n" > compile.status
printf "%s build FAILED after %ss!\nLog excerpt:\n" "$BUILD_NAME" "${duration}" printf "%s build FAILED after %ss!\nLog excerpt:\n" "$BUILD_NAME" "${duration}"
tail -n $CONTEXT make.log 2> /dev/null || tail -$CONTEXT make.log tail -n $CONTEXT make.log 2> /dev/null || tail -$CONTEXT make.log
echo "$BUILD_NAME" >> "$FAILED_BOARDS"
failed=1 failed=1
fi fi
cd "$CURR" || return $? cd "$CURR" || return $?
@ -424,6 +428,7 @@ function build_config
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"
junit "</testcase>" junit "</testcase>"
echo "$BUILD_NAME" >> "$FAILED_BOARDS"
return return
fi fi
@ -585,12 +590,12 @@ getoptbrand="$(getopt -V)"
# shellcheck disable=SC2086 # shellcheck disable=SC2086
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,quiet,help,all,target:,payloads:,cpus:,silent,junit,config,loglevel:,remove,prefix:,update,scan-build,ccache,blobs,clang,clean,outdir:,chromeos,xmlfile:,kconfig:,dir:,root: -o Vvqhat:p:c:sJCl:rP:uyBLzo:xX:K:d:R: -- "$@") || exit 1 args=$(getopt -l version,verbose,quiet,help,all,target:,payloads:,cpus:,silent,junit,config,loglevel:,remove,prefix:,update,scan-build,ccache,blobs,clang,clean,outdir:,chromeos,xmlfile:,kconfig:,dir:,root:,recursive -o Vvqhat:p:c:sJCl:rP:uyBLzo:xX:K:d:R:I -- "$@") || exit 1
eval set -- $args eval set -- $args
retval=$? retval=$?
else else
# Detected non-GNU getopt # Detected non-GNU getopt
args=$(getopt Vvqhat:p:c:sJCl:rP:uyBLzo:xX:K:d:R: "$@") args=$(getopt Vvqhat:p:c:sJCl:rP:uyBLzo:xX:K:d:R:I "$@")
set -- $args set -- $args
retval=$? retval=$?
fi fi
@ -671,6 +676,7 @@ while true ; do
configoptions="${configoptions}CONFIG_CHROMEOS=y\n" configoptions="${configoptions}CONFIG_CHROMEOS=y\n"
;; ;;
-X|--xmlfile) shift; XMLFILE=$1; REAL_XMLFILE=$1; shift;; -X|--xmlfile) shift; XMLFILE=$1; REAL_XMLFILE=$1; shift;;
-I|--recursive) shift; recursive=true;;
-K|--kconfig) shift -K|--kconfig) shift
testclass="$(basename "$1" | tr '.' '_' )" testclass="$(basename "$1" | tr '.' '_' )"
customizing="${customizing}, $1 config" customizing="${customizing}, $1 config"
@ -695,6 +701,12 @@ if [ "$customizing" = "" ]; then
customizing="default configuration" customizing="default configuration"
fi fi
FAILED_BOARDS="$TOP/$TARGET/failed_boards"
if [ "$recursive" = "false" ]; then
rm -f "$FAILED_BOARDS"
fi
USE_XARGS=0 USE_XARGS=0
if [ "$cpus" != "1" ]; then if [ "$cpus" != "1" ]; then
# Limit to 32 parallel builds for now. # Limit to 32 parallel builds for now.
@ -770,7 +782,7 @@ build_targets()
fi fi
rm -rf "$TARGET/temp" "$TMPCFG" rm -rf "$TARGET/temp" "$TMPCFG"
# shellcheck disable=SC2086 # shellcheck disable=SC2086
echo $targets | xargs -P ${cpus:-0} -n 1 "$0" $cmdline -t echo $targets | xargs -P ${cpus:-0} -n 1 "$0" $cmdline -I -t
} }
fi fi
@ -814,4 +826,15 @@ else
fi fi
junit '</testsuite>' junit '</testsuite>'
if [ "$recursive" = "false" ]; then
# Print the list of failed boards
if [ -f "$FAILED_BOARDS" ]; then
printf "%s build(s) failed:\n" "$( wc -l < "$FAILED_BOARDS" )"
cat "$FAILED_BOARDS"
else
echo "All tested boards passed."
fi
fi
exit $failed exit $failed