Skip to contentSkip to conversation

MAKEALL: Add summary information

PATCH Superseded Peter Tyser 2 participants 4 messages Sep 18, 2009 – Sep 21, 2009

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 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

 MAKEALL |   30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)
MAKEALL +28 -2
index 1d50c34..a63d028 100755
@@ -1,5 +1,8 @@
 #!/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`"}
 
@@ -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=`expr ${ERR_CNT} + 1`
+		ERR_LIST="${ERR_LIST} $target"
+	fi
+
+	TOTAL_CNT=`expr ${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 v2 1/1 MAKEALL: Add summary information

Dear Peter Tyser,

MAKEALL line 4

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

index 1d50c34..a63d028 100755

MAKEALL +2 -0
@@ -1,5 +1,8 @@
 #!/bin/sh
 
+# Print statistics when ctrl-c is pressed
+trap "print_stats; exit " 2

Why only on signal 2? Usually we use "1 2 3 15" in such cases.

Also, you might add "0" here and then...

MAKEALL do · line 960

Quoted 6 lines
MAKEALL +2 -0
@@ -932,3 +956,5 @@ do
 			;;
 	esac
 done
+
+print_stats

...omit this chunk.

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
Prepare for tomorrow -- get ready.
	-- Edith Keeler, "The City On the Edge of Forever",
	   stardate unknown
#2 lore raw

PATCH v2 1/1 MAKEALL: Add summary information

Quoted 4 lines

MAKEALL line 4

Quoted 2 lines
MAKEALL +2 -0
+# Print statistics when ctrl-c is pressed
+trap "print_stats; exit " 2

Why only on signal 2? Usually we use "1 2 3 15" in such cases.

2's the only case I've ever used for MAKEALL, I'll add the other cases as you suggest.

Quoted 8 lines

Also, you might add "0" here and then...

MAKEALL do · line 960

Quoted 6 lines
MAKEALL +2 -0
@@ -932,3 +956,5 @@ do
 			;;
 	esac
 done
+
+print_stats

I didn't trap 0 because I wasn't aware of a quick way to only call print_stats once when ctrl-c was pressed (eg trapping 0 and 2 would result in 2 print_stats calls with the current code). Let me know if there's a standard way to workaround this.

Best,
Peter

#3 lore raw

PATCH v2 1/1 MAKEALL: Add summary information

Dear Peter Tyser,

Quoted 7 lines · In message <1253489996.27060.60.camel@ptyser-laptop> you wrote:
Quoted 4 lines

MAKEALL line 4

Quoted 2 lines
MAKEALL +2 -0
+# Print statistics when ctrl-c is pressed
+trap "print_stats; exit " 2

Why only on signal 2? Usually we use "1 2 3 15" in such cases.

2's the only case I've ever used for MAKEALL, I'll add the other cases as you suggest.

Thanks.

Quoted 4 lines

I didn't trap 0 because I wasn't aware of a quick way to only call print_stats once when ctrl-c was pressed (eg trapping 0 and 2 would result in 2 print_stats calls with the current code). Let me know if there's a standard way to workaround this.

I would probably use something like this:

	trap exit 1 2 3 15
	trap print_stats 0

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
Quotation, n. The act of repeating erroneously the words of  another.
The  words  erroneously  repeated.
                            - Ambrose Bierce _The Devil's Dictionary_