From a5707738b7329cece54cf88dc239dc6a0d3dfd96 Mon Sep 17 00:00:00 2001 From: syureyi Date: Thu, 7 Aug 2014 15:43:08 +0800 Subject: [PATCH] improve the shell scripts --- .../unitTest/android/run_AutoTest_android.sh | 6 ++++ autotest/unitTest/ios/run_AutoTest_ios.sh | 4 +++ autotest/unitTest/run_ParseUTxml.sh | 29 ++++++++++++++++++- autotest/unitTest/run_unitTest.sh | 24 +++++++++++---- 4 files changed, 56 insertions(+), 7 deletions(-) diff --git a/autotest/unitTest/android/run_AutoTest_android.sh b/autotest/unitTest/android/run_AutoTest_android.sh index 1a6d4d64..8eb7e6e7 100644 --- 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" diff --git a/autotest/unitTest/ios/run_AutoTest_ios.sh b/autotest/unitTest/ios/run_AutoTest_ios.sh index bc25545d..59b48177 100644 --- a/autotest/unitTest/ios/run_AutoTest_ios.sh +++ b/autotest/unitTest/ios/run_AutoTest_ios.sh @@ -62,6 +62,7 @@ IOS_MAKE_PARAMS="OS=ios ARCH=${CODEC_TEST_IOS_ARCH}" ############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 @@ CODEC_TEST_IOS_REPORT_PATH="${AUTO_TEST_IOS_PATH}/report" 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 diff --git a/autotest/unitTest/run_ParseUTxml.sh b/autotest/unitTest/run_ParseUTxml.sh index 041fd917..8142eb4a 100644 --- a/autotest/unitTest/run_ParseUTxml.sh +++ b/autotest/unitTest/run_ParseUTxml.sh @@ -22,7 +22,34 @@ parse_unittest() { 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 + +
+ + + + + + + + + + + + + + + + + +
Total unit test casesFailedTimeDate
${tests}${fails}${waste}${times}
+
+EOF + fi } xmlcount=`ls $REPORT | wc -l` diff --git a/autotest/unitTest/run_unitTest.sh b/autotest/unitTest/run_unitTest.sh index dc5ce265..91804f0b 100644 --- a/autotest/unitTest/run_unitTest.sh +++ b/autotest/unitTest/run_unitTest.sh @@ -19,7 +19,7 @@ ANDROID_SDK_PATH=${ANDROID_HOME} 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 @@ else 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 @@ else 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 " +">>mail.log +echo "
Run unit test on android devices">>mail.log bash run_ParseUTxml.sh ./android/report ret=$? if [ ${ret} -eq 0 ];then @@ -74,6 +85,7 @@ echo Unit test run failed fi fi if [ ${IOS} = "1" ];then +echo "
Run unit test on ios devices with armv7 & arm64">>mail.log bash run_ParseUTxml.sh ./ios/report ret=$? if [ $ret -eq 0 ];then