From patchwork Wed Oct 31 01:55:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Hershberger X-Patchwork-Id: 195691 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id A1E442C0081 for ; Wed, 31 Oct 2012 12:56:28 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 849344A379; Wed, 31 Oct 2012 02:56:18 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jB0K5SCQWE7c; Wed, 31 Oct 2012 02:56:18 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EF8C94A395; Wed, 31 Oct 2012 02:56:13 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 654044A379 for ; Wed, 31 Oct 2012 02:56:07 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jbAMRTyEfKin for ; Wed, 31 Oct 2012 02:56:05 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from spamkiller05.natinst.com (mailserver5.natinst.com [130.164.80.5]) by theia.denx.de (Postfix) with ESMTP id 13ED84A37A for ; Wed, 31 Oct 2012 02:56:03 +0100 (CET) Received: from mailserv59-us.natinst.com (nb-hsrp-1338.natinst.com [130.164.19.133]) by spamkiller05.natinst.com (8.14.5/8.14.5) with ESMTP id q9V1tmEb014893; Tue, 30 Oct 2012 20:55:48 -0500 Received: from linux-xvxi.natinst.com ([130.164.14.197]) by mailserv59-us.natinst.com (Lotus Domino Release 8.5.3FP2 HF169) with ESMTP id 2012103020554892-810295 ; Tue, 30 Oct 2012 20:55:48 -0500 From: Joe Hershberger To: u-boot@lists.denx.de Date: Tue, 30 Oct 2012 20:55:20 -0500 Message-Id: <1351648522-29229-1-git-send-email-joe.hershberger@ni.com> X-Mailer: git-send-email 1.7.11.5 X-MIMETrack: Itemize by SMTP Server on MailServ59-US/AUS/H/NIC(Release 8.5.3FP2 HF169|September 14, 2012) at 10/30/2012 08:55:48 PM, Serialize by Router on MailServ59-US/AUS/H/NIC(Release 8.5.3FP2 HF169|September 14, 2012) at 10/30/2012 08:55:48 PM, Serialize complete at 10/30/2012 08:55:48 PM X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.7.7855, 1.0.431, 0.0.0000 definitions=2012-10-31_01:2012-10-31, 2012-10-31, 1970-01-01 signatures=0 Cc: Tom Rini , Joe Hershberger Subject: [U-Boot] [PATCH 1/2] MAKEALL: Fix kill_children X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de When building in parallel, make sure that we look up the children based on the the actual process group id instead of just assuming that the MAKEALL pid is the process group id. Also ensure that logs from incomplete builds are deleted in the process. Signed-off-by: Joe Hershberger Acked-by: Simon Glass Tested-by: Simon Glass --- MAKEALL | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/MAKEALL b/MAKEALL index 84a5c92..1f88dc5 100755 --- a/MAKEALL +++ b/MAKEALL @@ -610,6 +610,13 @@ list_target() { donep="${LOG_DIR}/._done_" skipp="${LOG_DIR}/._skip_" +build_target_killed() { + echo "Aborted $target build." + # Remove the logs for this board since it was aborted + rm -f ${LOG_DIR}/$target.MAKELOG ${LOG_DIR}/$target.ERR + exit +} + build_target() { target=$1 build_idx=$2 @@ -622,6 +629,7 @@ build_target() { if [ $BUILD_MANY == 1 ] ; then output_dir="${OUTPUT_PREFIX}/${target}" mkdir -p "${output_dir}" + trap build_target_killed TERM else output_dir="${OUTPUT_PREFIX}" fi @@ -640,6 +648,8 @@ build_target() { fi if [ $BUILD_MANY == 1 ] ; then + trap - TERM + ${MAKE} -s tidy if [ -s ${LOG_DIR}/${target}.ERR ] ; then @@ -721,7 +731,9 @@ build_targets() { if [ $BUILD_MANY == 1 ] ; then build_target ${t} ${TOTAL_CNT} & else + CUR_TGT="${t}" build_target ${t} ${TOTAL_CNT} + CUR_TGT='' fi fi @@ -745,7 +757,11 @@ build_targets() { #----------------------------------------------------------------------- kill_children() { - kill -- "-$1" + local pgid=`ps -p $$ --no-headers -o "%r" | tr -d ' '` + local children=`pgrep -g $pgid | grep -v $$ | grep -v $pgid` + + kill $children 2> /dev/null + wait $children 2> /dev/null exit } @@ -753,6 +769,9 @@ kill_children() { print_stats() { if [ "$ONLY_LIST" == 'y' ] ; then return ; fi + # Only count boards that completed + : $((TOTAL_CNT = `find ${skipp}* 2> /dev/null | wc -l`)) + rm -f ${donep}* ${skipp}* if [ $BUILD_MANY == 1 ] && [ -e "${OUTPUT_PREFIX}/ERR" ] ; then @@ -762,6 +781,9 @@ print_stats() { WRN_LIST=`grep -riwL error ${OUTPUT_PREFIX}/ERR/` WRN_LIST=`for f in $WRN_LIST ; do echo -n " $(basename $f)" ; done` WRN_CNT=`echo $WRN_LIST | wc -w | awk '{print $1}'` + else + # Remove the logs for any board that was interrupted + rm -f ${LOG_DIR}/${CUR_TGT}.MAKELOG ${LOG_DIR}/${CUR_TGT}.ERR fi echo "" @@ -776,7 +798,7 @@ print_stats() { echo "----------------------------------------------------------" if [ $BUILD_MANY == 1 ] ; then - kill_children $$ & + kill_children fi exit $RC