#! /bin/bash ################################################################################ # Check Build Errors # # Copyright (C) Nintendo. All rights reserved. # # These coded instructions, statements, and computer programs contain # proprietary information of Nintendo of America Inc. and/or Nintendo # Company Ltd., and are protected by Federal copyright law. They may # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # # usage: ./check_build_errors.sh ${BUILD_LOG} # e.g) # ./check_build_errors.sh build_output.txt # ############################################################################### TMP_MESSAGES=${TMPDIR:-/tmp}/messages_$$.txt function remove_temporary_files { rm -f ${TMP_MESSAGES} } function interrupted { echo "INTERRUPTED" remove_temporary_files exit 6 } trap interrupted SIGINT remove_temporary_files # check for messages # match lines which start with error # match lines where the word error or errors is found # exclude "-C error" (for example make -C error) # match "permission denied" (but don't count as an error) # match ": no such file or directory" # Note: using -n to sed does not output unless there is a "p" command # Also Note: using "I" makes the pattern case insensative # exclude the warnings "-jn forced", "skip the hash", and "found in FST or locally" warnings # lines with "is missing" are reported, except for the "if this option is missing" { sed -n \ -e '/-C error/Id' \ -e '/ has modification time.*in the future/Id' \ -e '/Clock skew detected. Your build may be incomplete/Id' \ -e '/No rule to make target.*Stop/Ip' \ -e '/[-A-Za-z0-9_\/]error/Id' \ -e '/ 0 error(s)/Id' \ -e '/^\**error/Ip' \ -e '/\*\*\*.* Stop\./Ip' \ -e '/[^a-z0-9/.]error[s]*[ :(]/Ip' \ -e '/permission denied/Ip' \ -e '/: no such file or directory/Ip' \ -e '/rm: cannot remove /Ip' \ -e '/rm: error closing file/Ip' \ -e '/file data section size is 0byte./Id' \ -e '/has been deleted as it is empty./Id' \ -e '/Empty Section has been deleted./Id' \ -e '/Missing \[CODE\] or \[DATA\] directive/Id' \ -e '/problems were encountered while processing debug information/Id' \ -e '/warning/I{/-jn forced/Id;/[^ *]warnings*/Id;/warnings*[^ :]/Id;/skip the hash/Id;/found in FST or locally/Id;p}' \ -e '/is missing/I{/if this option is missing/Id;p}' \ $1 } > ${TMP_MESSAGES} # get number of errors and warnings error_num=`grep -i -w -e error ${TMP_MESSAGES} | wc -l` warning_num=`grep -i -w -e warning ${TMP_MESSAGES} | wc -l` missing_num=`grep -i -e "is missing" ${TMP_MESSAGES} | wc -l` PATH_FROM_CAFE_ROOT=${PWD//$CAFE_ROOT\//} # print out result if [[ $error_num != 0 ]] ; then echo echo "==================================================================" echo " BUILD RESULT ($PATH_FROM_CAFE_ROOT)" echo "==================================================================" echo " Error : $error_num" echo " Warning: $warning_num" echo " Missing: $missing_num" echo echo "--------------------------------" echo "-> Error Modules:" echo sed -n -e "/.*make.* \*\*\* \[.*\] Error /{s/.*make.* \*\*\* \[\(.*\)\] Error \(.*\)/\t\1 - Error \2/p}" \ -e "s/[0-9]*>\(.*\) - \(.*\) error(s).*/\t\1 - \2 error(s)/Ip" \ -e "/Errors: /{s/Errors: .*>//g;s'^.*/' 'g;s/: $//g;s/:/ - line: /g;p}" ${TMP_MESSAGES} echo if [[ $missing_num != 0 ]] ; then echo "-> Missing Modules:" echo grep -i "is missing" ${TMP_MESSAGES} echo fi echo "--------------------------------" echo "-> Error and Warning Log:" echo cat ${TMP_MESSAGES} echo remove_temporary_files exit 1 else # echo " ================================================================" # echo " BUILD RESULT ($PATH_FROM_CAFE_ROOT)" # echo " ================================================================" # echo " Success! :^)8" # print out result if [[ $warning_num != 0 ]] ; then echo "--------------------------------" echo "-> Error and Warning Log:" echo cat ${TMP_MESSAGES} echo fi remove_temporary_files exit 0 fi