• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3AUTO_TEST_PATH=`pwd`
4IOS=0
5ANDROID=0
6#Prepare GTEST
7AUTO_TEST_SRC_PATH="../../"
8cd ${AUTO_TEST_SRC_PATH}
9if [ ! -d "./gtest" ]
10then
11   make gtest-bootstrap
12fi
13cd ${AUTO_TEST_PATH}
14#To find whether have android devices
15echo please set the enviroment variable as:
16echo export ANDROID_HOME="path of android sdk"
17echo export ANDROID_NDK_HOME="path of android ndk"
18ANDROID_SDK_PATH=${ANDROID_HOME}
19ANDROID_NDK_PATH=${ANDROID_NDK_HOME}
20if [ "#${ANDROID_SDK_PATH}" = "#" ]
21then
22echo Please set ANDROID_HOME with the path of Android SDK
23exit 1
24fi
25if [ "#${ANDROID_NDK_PATH}" = "#" ]
26then
27echo Please set ANDROID_NDK_HOME with the path of Android NDK
28exit 1
29fi
30#prepare devices
31ADB=${ANDROID_SDK_PATH}/platform-tools/adb
32
33#get devices
34devices=`$ADB devices | awk -F" " '/\tdevice/{print $1}'`
35if [ "#$devices" = "#" ];then
36   echo "Can not find any android devices!"
37else
38   echo Start to run the unittest on android devices
39   ANDROID=1
40   cd ./android
41   bash run_AutoTest_android.sh >/dev/null 2>&1
42   if [ $? -ne 0 ];then
43   echo There is something wrong happened when runing unittest on android devices,please to check
44   else
45   echo Finish run the unittest on android devices sucessfully
46   fi
47   cd ${AUTO_TEST_PATH}
48fi
49
50#To find whether have ios devices
51 DEVICES=`system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2}'`
52 if [ "${DEVICES}#" == "#" ]
53 then
54 echo "Can not find any ios devices!"
55else
56  echo Start to run the unittest on ios devices
57  IOS=1
58  cd ./ios
59  bash run_AutoTest_ios.sh >/dev/null 2>&1
60 if [ $? -ne 0 ];then
61 echo There is something wrong happened when runing unittest on ios devices,please to check
62 else
63 echo Finish run the unittest on android devices sucessfully
64fi
65 cd ${AUTO_TEST_PATH}
66fi
67
68#To parse the unit test result file to find whether have failures
69if [ ${ANDROID} = "1" ];then
70echo "
71<style>
72.env {
73    background-color: #95B9C7;
74    font: 30px bold;
75}</style>">>mail.log
76echo "<br><font class="env">Run unit test on android devices</font>">>mail.log
77bash run_ParseUTxml.sh ./android/report
78ret=$?
79if [ ${ret} -eq 0 ];then
80echo Unit test run on the android devices have not any failure case
81elif [ ${ret} -eq 2 ];then
82echo Unit test have cases failed,please check
83elif [ ${ret} -eq 1 ];then
84echo Unit test run failed
85fi
86fi
87if [ ${IOS} = "1" ];then
88echo "<br><font class="env">Run unit test on ios devices with armv7 & arm64</font>">>mail.log
89bash run_ParseUTxml.sh ./ios/report
90ret=$?
91if [ $ret -eq 0 ];then
92echo Unit test run on the ios devices have not any failure case
93elif [ $ret -eq 2 ];then
94echo Unit test have cases failed,please check
95elif [ $ret -eq 1 ];then
96echo Unit test run failed
97fi
98fi
99