summaryrefslogtreecommitdiff
path: root/util/abuild
diff options
context:
space:
mode:
authorMartin Roth <martinroth@google.com>2017-07-19 14:13:07 -0600
committerMartin Roth <martinroth@google.com>2017-07-31 20:52:07 +0000
commitba973bd2de8bf91cc83431333519124bf0f1fd72 (patch)
treeef2b5365d1474f2a308a2e66fadf48fca2e6fc87 /util/abuild
parent6c1c9d5d5f1de8304cfb463f619d109412fd02b2 (diff)
downloadcoreboot-ba973bd2de8bf91cc83431333519124bf0f1fd72.tar.xz
util/abuild: Set exit status on failure
Currently, the what-jenkins-does target doesn't stop if abuild fails. This change gives a command line parameter to abuild with tells it to exit with a non-zero exit status if any of the builds failed. This will be particularly useful for concourse which doesn't parse the junit.xml files, and only knows whether a build passed or failed by the exit status. Change-Id: Ic2be5deaedacd3f55db8e0b14a2b7b39cc44664e Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/20656 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Chris Ching <chingcodes@google.com>
Diffstat (limited to 'util/abuild')
-rwxr-xr-xutil/abuild/abuild12
1 files changed, 10 insertions, 2 deletions
diff --git a/util/abuild/abuild b/util/abuild/abuild
index f0bfcd8d9b..e03753a50c 100755
--- a/util/abuild/abuild
+++ b/util/abuild/abuild
@@ -50,6 +50,9 @@ configureonly=0
# Did any board fail to build?
failed=0
+# Exit with a non-zero errorlevel on failure
+exitcode=0
+
# default: don't save checksums
checksum_file=""
@@ -529,6 +532,7 @@ Options:\n"
[-c|--cpus <numcpus>] Build on <numcpus> at the same time
[-C|--config] Configure-only mode
[-d|--dir <dir>] Directory containing config files
+ [-e|--exitcode] Exit with a non-zero errorlevel on failure
[-J|--junit] Write JUnit formatted xml log file
[-K|--kconfig <name>] Prepend file to generated Kconfig
[-l|--loglevel <num>] Set loglevel
@@ -599,12 +603,12 @@ getoptbrand="$(getopt -V)"
# shellcheck disable=SC2086
if [ "${getoptbrand:0:6}" == "getopt" ]; then
# 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:,recursive,checksum:,timeless -o Vvqhat:p:c:sJCl:rP:uyBLzo:xX:K:d:R:I -- "$@") || 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,checksum:,timeless,exitcode -o Vvqhat:p:c:sJCl:rP:uyBLzo:xX:K:d:R:Ie -- "$@") || exit 1
eval set -- $args
retval=$?
else
# Detected non-GNU getopt
- args=$(getopt Vvqhat:p:c:sJCl:rP:uyBLzo:xX:K:d:R:I "$@")
+ args=$(getopt Vvqhat:p:c:sJCl:rP:uyBLzo:xX:K:d:R:Ie "$@")
set -- $args
retval=$?
fi
@@ -627,6 +631,7 @@ while true ; do
-t|--target) shift; target="$1"; shift;;
-a|--all) shift; buildall=true;;
-d|--dir) shift; configdir="$1"; shift;;
+ -e|--exitcode) shift; exitcode=1;;
-r|--remove) shift; remove=true;;
-v|--verbose) shift; verbose=true; verboseopt='V=1';;
-q|--quiet) shift; quiet=true;;
@@ -848,6 +853,9 @@ if [ "$recursive" = "false" ]; then
printf "%s configuration(s) failed:\n" "$( wc -l < "$FAILED_BOARDS" )"
cat "$FAILED_BOARDS"
echo
+ if [ "$exitcode" != "0" ]; then
+ failed=1
+ fi
else
printf "All %s tested configurations passed.\n" "$( wc -l < "$PASSED_BOARDS" )"
fi