Skip to contentSkip to conversation

MAKEALL: Add summary information

PATCH Superseded Peter Tyser 3 participants 5 messages Sep 18, 2009 – Sep 21, 2009

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 MAKEALL: Add summary information

This change adds some basic summary information to the MAKEALL script. The summary information includes how many boards were compiled, how many boards had compile warnings or errors, and which specific boards had compile warnings or errors.

This information is useful when doing compile testing to quickly determine which boards are broken.

As a side benefit, no empty $BOARD.ERR files are generated by MAKEALL. Previously, each board had a corresponding $BOARD.ERR file, even if the board compiled cleanly.

---
Changes since v1:
- Fix issue where summary was printed multiple times when a list was composed of sublists

Changes since v2:
- Update script to only use POSIX arithmetic

 MAKEALL |   32 +++++++++++++++++++++++++++++---
 1 files changed, 29 insertions(+), 3 deletions(-)
MAKEALL +29 -3
index 1d50c34..e7bdbc4 100755
@@ -1,11 +1,14 @@
 #!/bin/sh
 
+# Print statistics when ctrl-c is pressed
+trap "print_stats; exit " 2
+
 # Determine number of CPU cores if no default was set
 : ${BUILD_NCPUS:="`getconf _NPROCESSORS_ONLN`"}
 
 if [ "$BUILD_NCPUS" -gt 1 ]
 then
-	JOBS=-j`expr "$BUILD_NCPUS" + 1`
+	JOBS="-j $(($BUILD_NCPUS + 1))"
 else
 	JOBS=""
 fi
@@ -31,6 +34,11 @@ fi
 
 LIST=""
 
+# Keep track of the number of builds and errors
+ERR_CNT=0
+ERR_LIST=""
+TOTAL_CNT=0
+
 #########################################################################
 ## MPC5xx Systems
 #########################################################################
@@ -898,8 +906,14 @@ build_target() {
 	${MAKE} distclean >/dev/null
 	${MAKE} ${target}_config
 
-	${MAKE} ${JOBS} all 2>&1 >${LOG_DIR}/$target.MAKELOG \
-				| tee ${LOG_DIR}/$target.ERR
+	ERR=$(${MAKE} ${JOBS} all 2>&1 > ${LOG_DIR}/$target.MAKELOG)
+	if [ "${ERR}" ] ; then
+		echo "$ERR" | tee ${LOG_DIR}/$target.ERR
+		ERR_CNT=$(($ERR_CNT + 1))
+		ERR_LIST="${ERR_LIST} $target"
+	fi
+
+	TOTAL_CNT=$(($TOTAL_CNT + 1))
 
 	${CROSS_COMPILE}size ${BUILD_DIR}/u-boot \
 				| tee -a ${LOG_DIR}/$target.MAKELOG
@@ -907,7 +921,17 @@ build_target() {
 
 #-----------------------------------------------------------------------
 
+print_stats() {
+	echo ""
+	echo "--------------------- SUMMARY ----------------------------"
+	echo "Boards compiled: ${TOTAL_CNT}"
+	if [ ${ERR_CNT} -gt 0 ] ; then
+		echo "Boards with warnings or errors: ${ERR_CNT} (${ERR_LIST} )"
+	fi
+	echo "----------------------------------------------------------"
+}
 
+#-----------------------------------------------------------------------
 for arg in $@
 do
 	case "$arg" in
@@ -932,3 +956,5 @@ do
 			;;
 	esac
 done
+
+print_stats
Signature · 1 line
1.6.2.1
#1 lore raw

PATCH v3 1/1 MAKEALL: Add summary information

MAKEALL build_target() { · line 916

Quoted 1 line · On Friday 18 September 2009 19:48:03 Peter Tyser wrote:
MAKEALL +1 -0
+	TOTAL_CNT=$(($TOTAL_CNT + 1))

what i suggested want a typo ;). you dont need to expand the var inside of the $((...)). v=1; : $(( v += 1))
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090919/f09b4b7a/attachment.pgp

#2 lore raw

PATCH v3 1/1 MAKEALL: Add summary information

In reply to Peter Tyser

Dear Peter Tyser,

MAKEALL line 14

Quoted 8 lines · In message <[email protected]> you wrote:

if [ "$BUILD_NCPUS" -gt 1 ]
then

MAKEALL +1 -1
-	JOBS=-j`expr "$BUILD_NCPUS" + 1`
+	JOBS="-j $(($BUILD_NCPUS + 1))"
 else
 	JOBS=""
 fi

This is an unrelated change. I would not include it with this patch.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If all you have is a hammer, everything looks like a nail.
#3 lore raw

PATCH v3 1/1 MAKEALL: Add summary information

Quoted 4 lines · Wolfgang Denk

Dear Peter Tyser,

Quoted 1 line · In message <[email protected]> you wrote:
Quoted 9 lines

MAKEALL line 14

Quoted 7 lines

if [ "$BUILD_NCPUS" -gt 1 ]
then

MAKEALL +1 -1
-	JOBS=-j`expr "$BUILD_NCPUS" + 1`
+	JOBS="-j $(($BUILD_NCPUS + 1))"
 else
 	JOBS=""
 fi

This is an unrelated change. I would not include it with this patch.

Mike mentioned using POSIX math in the new arithmetic functions I added, which makes sense. I reasoned it was better to convert the 1 other reference to 'expr + 1' to the same POSIX style for consistency's sake. Changing 1 'expr + 1' reference to $((+ 1)) doesn't seem worth its own commit, so I rolled it into this patch. How about I just add a sentence to the commit message stating that I also converted math operations to be POSIX compliant?

Best,
Peter

#4 lore raw

PATCH v3 1/1 MAKEALL: Add summary information

Dear Peter Tyser,

Quoted 3 lines · In message <1253489072.27060.51.camel@ptyser-laptop> you wrote:
Quoted 3 lines
Quoted 3 lines
MAKEALL +1 -1
-	JOBS=-j`expr "$BUILD_NCPUS" + 1`
+	JOBS="-j $(($BUILD_NCPUS + 1))"

...

Quoted 9 lines
Quoted 1 line

This is an unrelated change. I would not include it with this patch.

Mike mentioned using POSIX math in the new arithmetic functions I added, which makes sense. I reasoned it was better to convert the 1 other reference to 'expr + 1' to the same POSIX style for consistency's sake. Changing 1 'expr + 1' reference to $((+ 1)) doesn't seem worth its own commit, so I rolled it into this patch. How about I just add a sentence to the commit message stating that I also converted math operations to be POSIX compliant?

It's still an unrelated change. Please do this in a separate patch (probably before adding your other changes).

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"More software projects have gone awry for lack of calendar time than
for all other causes combined."
                         - Fred Brooks, Jr., _The Mythical Man Month_