[coreboot-gerrit] Change in coreboot[master]: util/abuild: Set exit code on failure

Martin Roth (Code Review) gerrit at coreboot.org
Thu Jul 20 00:35:12 CEST 2017


Martin Roth has uploaded this change for review. ( https://review.coreboot.org/20656


Change subject: util/abuild: Set exit code on failure
......................................................................

util/abuild: Set exit code 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 errorlevel 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
errorlevel.

Change-Id: Ic2be5deaedacd3f55db8e0b14a2b7b39cc44664e
Signed-off-by: Martin Roth <martinroth at google.com>
---
M util/abuild/abuild
1 file changed, 10 insertions(+), 2 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/56/20656/1

diff --git a/util/abuild/abuild b/util/abuild/abuild
index 8637e6f..a11562b 100755
--- a/util/abuild/abuild
+++ b/util/abuild/abuild
@@ -50,6 +50,9 @@
 # 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 @@
     [-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 @@
 # 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 @@
 		-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 @@
 		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

-- 
To view, visit https://review.coreboot.org/20656
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic2be5deaedacd3f55db8e0b14a2b7b39cc44664e
Gerrit-Change-Number: 20656
Gerrit-PatchSet: 1
Gerrit-Owner: Martin Roth <martinroth at google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170719/f86ef7c2/attachment.html>


More information about the coreboot-gerrit mailing list