ref: ef1098be9ce373840e5c744b7c8fe533bdc5bfca
parent: 4ebf8266a1f69f841748f49912f7a23fd6c74260
parent: a5707738b7329cece54cf88dc239dc6a0d3dfd96
author: HaiboZhu <haibozhu@cisco.com>
date: Thu Aug 7 13:28:54 EDT 2014
Merge pull request #1251 from syureyi/sendmail improve the shell scripts
--- a/autotest/unitTest/android/run_AutoTest_android.sh
+++ b/autotest/unitTest/android/run_AutoTest_android.sh
@@ -3,7 +3,13 @@
AUTO_TEST_ANDROID_PATH=`pwd`
AUTO_TEST_SRC_PATH="../../../"
AUTO_TEST_RES_PATH="${AUTO_TEST_ANDROID_PATH}/report"
+if [ ! -d ${AUTO_TEST_RES_PATH} ]
+then
mkdir -p ${AUTO_TEST_RES_PATH}
+else
+echo "Will delete those outdate xml in the report"
+rm -f ${AUTO_TEST_RES_PATH}/*.xml
+fi
#Prepare android build enviroment
echo please set the enviroment variable as:
echo export ANDROID_HOME="path of android sdk"
--- a/autotest/unitTest/ios/run_AutoTest_ios.sh
+++ b/autotest/unitTest/ios/run_AutoTest_ios.sh
@@ -62,6 +62,7 @@
############make build
find ./ -name *.o -exec rm -rf {} \;
find ./ -name *.d -exec rm -rf {} \;
+rm -f *.so
make clean
make ${IOS_MAKE_PARAMS} test
echo "Codec test will run on ${CODEC_TEST_IOS_PLATFORM} with ${CODEC_TEST_IOS_DEBUG_RELEASE}"
@@ -134,6 +135,9 @@
if [ ! -d ${CODEC_TEST_IOS_REPORT_PATH} ]
then
mkdir -p ${CODEC_TEST_IOS_REPORT_PATH}
+else
+ echo "Will delete those outdate xml in the report"
+ rm -f ${CODEC_TEST_IOS_REPORT_PATH}/*.xml
fi
#start to run unittest,default run the xcode at arch armv7 with release
--- a/autotest/unitTest/run_ParseUTxml.sh
+++ b/autotest/unitTest/run_ParseUTxml.sh
@@ -22,7 +22,34 @@
msg="Total testcases: $tests, failed: $fails,time:$waste seconds, at$times,xml:$res"
echo ${msg}
UT_Failed_Num=$((${UT_Failed_Num}+${fails}))
- fi
+cat >> mail.log << EOF
+<style>
+.fail {
+ background-color: yellow;
+}
+</style>
+<br>
+ <table style="width:600px" cellspacing="0" border="1" width="100%">
+ <thead>
+ <tr>
+ <td>Total unit test cases</td>
+ <td>Failed</td>
+ <td>Time</td>
+ <td>Date</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr style="text-align:center; font-weight: bold;">
+ <td>${tests}</td>
+ <td><font class="fail">${fails}</font></td>
+ <td>${waste}</td>
+ <td>${times}</td>
+ </tr>
+ </tbody>
+ </table>
+<br>
+EOF
+ fi
}
xmlcount=`ls $REPORT | wc -l`
--- a/autotest/unitTest/run_unitTest.sh
+++ b/autotest/unitTest/run_unitTest.sh
@@ -19,7 +19,7 @@
ANDROID_NDK_PATH=${ANDROID_NDK_HOME}
if [ "#${ANDROID_SDK_PATH}" = "#" ]
then
-echo Please set ANDROID_HOME with the path of Android SDK
+echo Please set ANDROID_HOME with the path of Android SDK
exit 1
fi
if [ "#${ANDROID_NDK_PATH}" = "#" ]
@@ -38,11 +38,13 @@
echo Start to run the unittest on android devices
ANDROID=1
cd ./android
- bash run_AutoTest_android.sh
- cd ${AUTO_TEST_PATH}
+ bash run_AutoTest_android.sh >/dev/null 2>&1
if [ $? -ne 0 ];then
echo There is something wrong happened when runing unittest on android devices,please to check
+ else
+ echo Finish run the unittest on android devices sucessfully
fi
+ cd ${AUTO_TEST_PATH}
fi
#To find whether have ios devices
@@ -54,15 +56,24 @@
echo Start to run the unittest on ios devices
IOS=1
cd ./ios
- bash run_AutoTest_ios.sh
- cd ${AUTO_TEST_PATH}
+ bash run_AutoTest_ios.sh >/dev/null 2>&1
if [ $? -ne 0 ];then
echo There is something wrong happened when runing unittest on ios devices,please to check
- fi
+ else
+ echo Finish run the unittest on android devices sucessfully
fi
+ cd ${AUTO_TEST_PATH}
+fi
#To parse the unit test result file to find whether have failures
if [ ${ANDROID} = "1" ];then
+echo "
+<style>
+.env {
+ background-color: #95B9C7;
+ font: 30px bold;
+}</style>">>mail.log
+echo "<br><font class="env">Run unit test on android devices</font>">>mail.log
bash run_ParseUTxml.sh ./android/report
ret=$?
if [ ${ret} -eq 0 ];then
@@ -74,6 +85,7 @@
fi
fi
if [ ${IOS} = "1" ];then
+echo "<br><font class="env">Run unit test on ios devices with armv7 & arm64</font>">>mail.log
bash run_ParseUTxml.sh ./ios/report
ret=$?
if [ $ret -eq 0 ];then