From: Mike Frysinger Date: Sun, 6 Dec 2009 18:20:13 -0500 Subject: [U-Boot] [PATCH] MAKEALL: Fix return value In-Reply-To: <1260089046.7073.66.camel@ptyser-laptop> References: <1260083374-11002-1-git-send-email-ptyser@xes-inc.com> <200912060245.16784.vapier@gentoo.org> <1260089046.7073.66.camel@ptyser-laptop> Message-ID: <200912061820.13769.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sunday 06 December 2009 03:44:06 Peter Tyser wrote: > On Sun, 2009-12-06 at 02:45 -0500, Mike Frysinger wrote: > > On Sunday 06 December 2009 02:09:34 Peter Tyser wrote: > > > ${MAKE} ${JOBS} all 2>&1 >${LOG_DIR}/$target.MAKELOG \ > > > > > > | tee ${LOG_DIR}/$target.ERR > > > > you could rewrite this to keep POSIX compliance: > > # need to maintain exit value ourselves as pipes eat it > > fail=${LOG_DIR}/$target.failed > > rm -f ${fail} > > (${MAKE} ${JOBS} all 2>&1 >${LOG_DIR}/$target.MAKELOG \ > > > > || touch ${fail}) | tee ${LOG_DIR}/$target.ERR > > > > [ -e ${fail} ] && : $(( RC += 1 )) > > rm -f ${fail} > > Ahh, clever. It doesn't really matter which way to me. PIPESTATUS > seems more straightforward, but maintaining POSIX compliance would be > nice too. i agree with both points > > > + # Return how many board compiles failed, assuming 'make' returns 2 > > > + # for builds which failed > > > + exit $(((RC + 1) / 2)) > > > > the problem here is that exit statuses have a range of 256 values. so as > > soon as more than 255 boards fail, this wont work. maybe i'm being > > overly paranoid though ? > > Good point. I can change RC into a bitwise OR of the 'make' return > values instead of a sum. I think 98% of the time people just want to > know if any board compile failed, not specifically how many boards > failed. right, so maybe something like: : $(( RC = (RC + 1) / 2 )) # exit values top out at 255 exit $(( RC > 255 ? 255 : RC )) not that ive ever looked at the exit status as anything meaningful ... i always review the ERR files to make sure they're all 0 bytes. -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/20091206/fd0076f7/attachment.pgp