2014-07-25 08:05:21 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
AUTO_TEST_PATH=`pwd`
|
2014-07-28 07:25:27 +02:00
|
|
|
IOS=0
|
|
|
|
ANDROID=0
|
2014-07-25 08:05:21 +02:00
|
|
|
#Prepare GTEST
|
|
|
|
AUTO_TEST_SRC_PATH="../../"
|
|
|
|
cd ${AUTO_TEST_SRC_PATH}
|
|
|
|
if [ ! -d "./gtest" ]
|
|
|
|
then
|
|
|
|
make gtest-bootstrap
|
|
|
|
fi
|
|
|
|
cd ${AUTO_TEST_PATH}
|
|
|
|
#To find whether have android devices
|
2014-07-25 08:37:14 +02:00
|
|
|
echo please set the enviroment variable as:
|
|
|
|
echo export ANDROID_HOME="path of android sdk"
|
2014-07-25 08:05:21 +02:00
|
|
|
echo export ANDROID_NDK_HOME="path of android ndk"
|
|
|
|
ANDROID_SDK_PATH=${ANDROID_HOME}
|
|
|
|
ANDROID_NDK_PATH=${ANDROID_NDK_HOME}
|
|
|
|
if [ "#${ANDROID_SDK_PATH}" = "#" ]
|
|
|
|
then
|
2015-04-27 12:34:59 +02:00
|
|
|
echo Please set ANDROID_HOME with the path of Android SDK
|
2014-07-25 08:05:21 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ "#${ANDROID_NDK_PATH}" = "#" ]
|
|
|
|
then
|
2014-07-25 08:37:14 +02:00
|
|
|
echo Please set ANDROID_NDK_HOME with the path of Android NDK
|
2014-07-25 08:05:21 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
2014-07-25 08:37:14 +02:00
|
|
|
#prepare devices
|
|
|
|
ADB=${ANDROID_SDK_PATH}/platform-tools/adb
|
|
|
|
|
|
|
|
#get devices
|
|
|
|
devices=`$ADB devices | awk -F" " '/\tdevice/{print $1}'`
|
|
|
|
if [ "#$devices" = "#" ];then
|
|
|
|
echo "Can not find any android devices!"
|
2014-07-25 08:05:21 +02:00
|
|
|
else
|
|
|
|
echo Start to run the unittest on android devices
|
2014-07-25 08:37:14 +02:00
|
|
|
ANDROID=1
|
2014-07-25 08:05:21 +02:00
|
|
|
cd ./android
|
2014-08-07 09:43:08 +02:00
|
|
|
bash run_AutoTest_android.sh >/dev/null 2>&1
|
2014-07-25 08:05:21 +02:00
|
|
|
if [ $? -ne 0 ];then
|
|
|
|
echo There is something wrong happened when runing unittest on android devices,please to check
|
2014-08-07 09:43:08 +02:00
|
|
|
else
|
|
|
|
echo Finish run the unittest on android devices sucessfully
|
2014-07-25 08:37:14 +02:00
|
|
|
fi
|
2014-08-07 09:43:08 +02:00
|
|
|
cd ${AUTO_TEST_PATH}
|
2014-07-25 08:37:14 +02:00
|
|
|
fi
|
2014-07-25 08:05:21 +02:00
|
|
|
|
|
|
|
#To find whether have ios devices
|
|
|
|
DEVICES=`system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2}'`
|
2014-07-25 08:37:14 +02:00
|
|
|
if [ "${DEVICES}#" == "#" ]
|
|
|
|
then
|
2014-07-28 07:25:27 +02:00
|
|
|
echo "Can not find any ios devices!"
|
2014-07-25 08:05:21 +02:00
|
|
|
else
|
|
|
|
echo Start to run the unittest on ios devices
|
|
|
|
IOS=1
|
|
|
|
cd ./ios
|
2014-08-07 09:43:08 +02:00
|
|
|
bash run_AutoTest_ios.sh >/dev/null 2>&1
|
2014-07-25 08:05:21 +02:00
|
|
|
if [ $? -ne 0 ];then
|
|
|
|
echo There is something wrong happened when runing unittest on ios devices,please to check
|
2014-08-07 09:43:08 +02:00
|
|
|
else
|
|
|
|
echo Finish run the unittest on android devices sucessfully
|
|
|
|
fi
|
|
|
|
cd ${AUTO_TEST_PATH}
|
2014-07-25 08:05:21 +02:00
|
|
|
fi
|
2014-07-25 08:37:14 +02:00
|
|
|
|
|
|
|
#To parse the unit test result file to find whether have failures
|
2014-07-25 08:05:21 +02:00
|
|
|
if [ ${ANDROID} = "1" ];then
|
2014-08-07 09:43:08 +02:00
|
|
|
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
|
2014-07-25 08:05:21 +02:00
|
|
|
bash run_ParseUTxml.sh ./android/report
|
|
|
|
ret=$?
|
|
|
|
if [ ${ret} -eq 0 ];then
|
|
|
|
echo Unit test run on the android devices have not any failure case
|
2014-07-25 08:37:14 +02:00
|
|
|
elif [ ${ret} -eq 2 ];then
|
|
|
|
echo Unit test have cases failed,please check
|
|
|
|
elif [ ${ret} -eq 1 ];then
|
|
|
|
echo Unit test run failed
|
2014-07-25 08:05:21 +02:00
|
|
|
fi
|
|
|
|
fi
|
2014-07-28 07:25:27 +02:00
|
|
|
if [ ${IOS} = "1" ];then
|
2014-08-07 09:43:08 +02:00
|
|
|
echo "<br><font class="env">Run unit test on ios devices with armv7 & arm64</font>">>mail.log
|
2014-07-25 08:05:21 +02:00
|
|
|
bash run_ParseUTxml.sh ./ios/report
|
2014-07-25 08:37:14 +02:00
|
|
|
ret=$?
|
|
|
|
if [ $ret -eq 0 ];then
|
2014-07-25 08:05:21 +02:00
|
|
|
echo Unit test run on the ios devices have not any failure case
|
2014-07-25 08:37:14 +02:00
|
|
|
elif [ $ret -eq 2 ];then
|
2014-07-25 08:05:21 +02:00
|
|
|
echo Unit test have cases failed,please check
|
|
|
|
elif [ $ret -eq 1 ];then
|
|
|
|
echo Unit test run failed
|
|
|
|
fi
|
|
|
|
fi
|