if [ $# -ne 1 ];then echo Please input $0 [report dir] exit 1 fi REPORT=$1 if [ ! -e ${REPORT} ];then echo "The directory of ${REPORT} dose't not exit,please check the test log" exit 1 fi UT_Failed_Num=0 parse_unittest() { res=$1 echo ${res} echo Start to parse unittest results of $res if [ -e $res ];then tests=`cat $res | grep "> mail.log << EOF
Total unit test cases Failed Time Date
${tests} ${fails} ${waste} ${times}

EOF fi } xmlcount=`ls $REPORT | wc -l` xmlfiles=`ls $REPORT` if [ ${xmlcount} -eq 0 ]; then echo There is nothing xml files generated at $REPORT exit 1 fi for file in $xmlfiles;do parse_unittest $REPORT/$file done if [ ${UT_Failed_Num} = "0" ];then echo Total $xmlcount files at $REPORT,all sucessful exit 0 else echo Total $xmlcount files at $REPORT,${UT_Failed_Num} error cases exit 2 fi