[U-Boot] [PATCH] MAKEALL: Fix return value

Peter Tyser ptyser at xes-inc.com
Sun Dec 6 08:09:34 CET 2009


Previously MAKEALL would always return a value of 0, even if 1 or more
boards did not compile.

This change causes MAKEALL to return the number of board's which did not
compile.  0 indicates success, 2 indicates 2 board did not compile, etc.
Boards with compile warnings do not affect the return value, only boards
which failed to compile.

Note that this change also requires changing the script interpreter from
sh to bash to support bash's PIPESTATUS variable.

Signed-off-by: Peter Tyser <ptyser at xes-inc.com>
---
 MAKEALL |   29 +++++++++++------------------
 1 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/MAKEALL b/MAKEALL
index d63c5c2..1227abd 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # Print statistics when we exit
 trap exit 1 2 3 15
@@ -39,6 +39,7 @@ LIST=""
 ERR_CNT=0
 ERR_LIST=""
 TOTAL_CNT=0
+RC=0
 
 #########################################################################
 ## MPC5xx Systems
@@ -936,6 +921,10 @@ build_target() {
 
 	${MAKE} ${JOBS} all 2>&1 >${LOG_DIR}/$target.MAKELOG \
 				| tee ${LOG_DIR}/$target.ERR
+
+	# Keep a running total of all 'make' return values
+	RC=$((RC + ${PIPESTATUS[0]}))
+
 	if [ -s ${LOG_DIR}/$target.ERR ] ; then
 		ERR_CNT=$((ERR_CNT + 1))
 		ERR_LIST="${ERR_LIST} $target"
@@ -959,6 +948,10 @@ print_stats() {
 		echo "Boards with warnings or errors: ${ERR_CNT} (${ERR_LIST} )"
 	fi
 	echo "----------------------------------------------------------"
+
+	# Return how many board compiles failed, assuming 'make' returns 2
+	# for builds which failed
+	exit $(((RC + 1) / 2))
 }
 
 #-----------------------------------------------------------------------
-- 
1.6.2.1



More information about the U-Boot mailing list