ref: c12cf3b2a016514104ca93e2f2608181d96b66e6
parent: 9b11f253000eb3eaaeb3740042eeda89b6d7b009
author: syureyi <[email protected]>
date: Tue Jul 22 10:01:27 EDT 2014
add .gitignore and also typo
--- a/autotest/performaceTest/android/run_AutoTest_android.sh
+++ /dev/null
@@ -1,138 +1,0 @@
-#!/bin/bash
-
-AUTO_TEST_ANDROID_PATH=`pwd`
-AUTO_TEST_SRC_PATH="../../../"
-AUTO_TEST_RES_PATH="${AUTO_TEST_ANDROID_PATH}/report"
-mkdir -p ${AUTO_TEST_RES_PATH}
-#Prepare android build enviroment
-echo please set the enviroment variable as:
-echo export ANDROID_HOME="path of android sdk"
-echo export ANDROID_NDK_HOME="path of android ndk"
-ANDROID_SDK_PATH=${ANDROID_HOME}
-ANDROID_NDK_PATH=${ANDROID_NDK_HOME}
-ANDROID_MAKE_PARAMS="OS=android NDKROOT=${ANDROID_NDK_PATH} TARGET=android-19"
-
-if [ "#${ANDROID_SDK_PATH}" = "#" ]
-then
-echo Please set ANDROID_HOME with the path of Android SDK
-exit 1
-fi
-if [ "#${ANDROID_NDK_PATH}" = "#" ]
-then
-echo Please set ANDROID_NDK_HOME with the path of Android NDK
-exit 1
-fi
-#make build
-cd ${AUTO_TEST_SRC_PATH}
-find ./ -name *.o -exec rm -f {} \;
-find ./ -name *.d -exec rm -f {} \;
-make $ANDROID_MAKE_PARAMS
-
-if [ $? -ne 0 ]
-then
- echo Build error,check with the trace of make
- exit 1
-fi
-
-ENCDEC=$1
-#find apk
-if [ ${ENCDEC} = "enc" ]
-then
-echo Start to find enc apk
-apk_name=`find ./ -name WelsEncTest-debug.apk`
-if [ "#${apk_name}" = "#" ]
-then
- echo Fail to find encoder APK.
- exit 1
-fi
-else
-echo Start to find dec apk
-apk_name=`find ./ -name WelsDecTest-debug.apk`
-if [ "#${apk_name}" = "#" ]
-then
-echo Fail to find decoder APK.
-exit 1
-fi
-fi
-
-#prepare devices
-ADB=${ANDROID_SDK_PATH}/platform-tools/adb
-
-#get devices
-devices=`$ADB devices | awk -F" " '/\tdevice/{print $1}'`
-if [ "#$devices" = "#" ];then
- echo "Have not any android devices."
- exit 1
-fi
-
-#run apk
-run_apk() {
-local apk=$1;
-local rand=` date +%s`
-
-if [[ "${apk}" =~ "WelsDecTest-debug.apk" ]]
-then
- apk_id="com.wels.dec"
- apk_main="com.wels.dec/.WelsDecTest"
- test_path="/sdcard/welsdec"
- log_grep_params="welsdec"
- test_res=${AUTO_TEST_ANDROID_PATH}/../DecoderPerfTestRes
- report_file=${AUTO_TEST_RES_PATH}/decPerf_${rand}
-
-fi
-if [[ "${apk}" =~ "WelsEncTest-debug.apk" ]]
-then
- apk_id="com.wels.enc"
- apk_main="com.wels.enc/.WelsEncTest"
- test_path="/sdcard/welsenc"
- log_grep_params="welsenc"
- test_res=${AUTO_TEST_ANDROID_PATH}/../EncoderPerfTestRes
- report_file=${AUTO_TEST_RES_PATH}/encPerf_${rand}
-fi
-
-for dev in $devices; do
- dev_info_file=${AUTO_TEST_RES_PATH}/${dev}.log
- $ADB -s $dev uninstall ${apk_id}
- $ADB -s $dev install -r ${apk}
- #TODO: output more info about android device such as name,cpu,memory,and also power comsumption.
- echo `$ADB -s $dev shell cat /system/build.prop |grep ro.product.model | awk -F"=" '{print $2}'`>${dev_info_file}
- #push resources
- $ADB -s $dev push ${test_res} ${test_path}
- #before start logcat,kill logcat
- pid=`$ADB -s $dev shell ps | grep logcat | awk '{print $2;}'`
- [ "#$pid" != "#" ] && $ADB -s $dev shell kill $pid >/dev/null
- $ADB -s $dev logcat -c
- $ADB -s $dev logcat |grep ${log_grep_params} >${report_file}_${dev}.log &
- $ADB -s $dev shell am start -n ${apk_main}
- # check whetehr the app is finished every 2 sec
- for (( ; ; )); do
- $ADB -s $dev shell ps | grep ${apk_id}
- if [ $? -ne 0 ]; then
- sleep 2
- $ADB -s $dev shell ps | grep ${apk_id}
- [ $? -ne 0 ] && break
- fi
- sleep 2
- done
-
- # kill logcat
- pid=`$ADB -s $dev shell ps | grep logcat | awk '{print $2;}'`
- [ "#$pid" != "#" ] && $ADB -s $dev shell kill $pid >/dev/null
-
- #delete the res
- $ADB -s $dev shell rm -rf ${test_path}
-done
-}
-for apk in ${apk_name};do
- run_apk $apk;
- if [ $? -ne 0 ]
- then
- echo There is something wrong happened when run ${apk_name}
- exit 1
- else
- echo Finished $ENCDEC performance test on android
- echo The test result is at ./android/report/xxx.log
- echo xxxxxxxxxxxxxxxAndroid $ENCDEC Endxxxxxxxxxxxxxxxx
- fi
-done
-
binary files a/autotest/performaceTest/ios/fruitstrap /dev/null differ
binary files a/autotest/performaceTest/ios/iFileTransfer /dev/null differ
--- a/autotest/performaceTest/ios/run_AutoTest_ios.sh
+++ /dev/null
@@ -1,147 +1,0 @@
-#!/bin/bash
-
-##############################################################
-#Build ios test ref app
-
-#set the default configuration
-CODEC_TEST_IOS_ARCH="armv7 armv7s arm64"
-CODEC_TEST_IOS_PLATFORM="iphoneos"
-CODEC_TEST_IOS_DEBUG_RELEASE="Release"
-CODEC_TEST_IOS_REPORT_SUBFOLDER="release"
-
-
-buildXcodeProject()
-{
- xcodebuild ARCHS="${CODEC_TEST_IOS_ARCH}" VALID_ARCHS="${CODEC_TEST_IOS_ARCH}" ONLY_ACTIVE_ARCH=YES -project $1 -target $2 -configuration $3 -sdk ${CODEC_TEST_IOS_PLATFORM} clean build
-
-if [ $? -eq 0 ]; then
- echo "build $1 $3 successfully"
- else
- echo "build $1 $3 fail"
- exit 1
- fi
-}
-
-
-
-iosPerformanceTest()
-{
-
-if [ $# -gt 2 ]; then
-echo "Please use command $0 [enc/dec] [release/debug]"
-exit 1
-fi
-
-for PARAM in $*; do
- if [ "enc" = "${PARAM}" ]; then
- CODEC_TEST_XCODE_PROJECT_NAME="${AUTO_TEST_SRC_PATH}/codec/build/iOS/enc/encDemo/encDemo.xcodeproj"
- CODEC_TEST_IOS_PROJECT_NAME="encDemo"
- CODEC_TEST_IOS_PROJECT_PATH="${AUTO_TEST_SRC_PATH}/codec/build/iOS/enc/encDemo/build"
- CODEC_TEST_IOS_APP=${CODEC_TEST_IOS_PROJECT_PATH}/${CODEC_TEST_IOS_DEBUG_RELEASE}-iphoneos/${CODEC_TEST_IOS_PROJECT_NAME}.app
- CODEC_TEST_IOS_APP_ID="cisco.encDemo"
- CODEC_TEST_RES=${AUTO_TEST_IOS_PATH}/../EncoderPerfTestRes
- CODEC_TEST_LOG="encPerf"
- elif [ "dec" = "${PARAM}" ]; then
- CODEC_TEST_XCODE_PROJECT_NAME="${AUTO_TEST_SRC_PATH}/codec/build/iOS/dec/demo/demo.xcodeproj/"
- CODEC_TEST_IOS_PROJECT_NAME="demo"
- CODEC_TEST_IOS_PROJECT_PATH="${AUTO_TEST_SRC_PATH}/codec/build/iOS/dec/demo/build"
- CODEC_TEST_IOS_APP=${CODEC_TEST_IOS_PROJECT_PATH}/${CODEC_TEST_IOS_DEBUG_RELEASE}-iphoneos/${CODEC_TEST_IOS_PROJECT_NAME}.app
- CODEC_TEST_IOS_APP_ID="hf.cisco.demo"
- CODEC_TEST_RES=${AUTO_TEST_IOS_PATH}/../DecoderPerfTestRes
- CODEC_TEST_LOG="decPerf"
- elif [ "release" = "${PARAM}" ]; then
- CODEC_TEST_IOS_DEBUG_RELEASE="Release"
- CODEC_TEST_IOS_REPORT_SUBFOLDER="release"
- elif [ "debug" = "${PARAM}" ]; then
- CODEC_TEST_IOS_DEBUG_RELEASE="Debug"
- CODEC_TEST_IOS_REPORT_SUBFOLDER="debug"
- else
- echo parameters are illegal!!!, please have a check.
- exit 1
- fi
- done
-
-echo "Codec test will run on ${CODEC_TEST_IOS_PLATFORM} with ${CODEC_TEST_IOS_DEBUG_RELEASE}"
-buildXcodeProject ${CODEC_TEST_XCODE_PROJECT_NAME} ${CODEC_TEST_IOS_PROJECT_NAME} ${CODEC_TEST_IOS_DEBUG_RELEASE} ${CODEC_TEST_IOS_PLATFORM}
-
-
-
-
-##############run on ios devices#########################
-# for real device
-if [ ! -d ${CODEC_TEST_IOS_APP} ] ; then
-echo "${CODEC_TEST_IOS_APP} is not found"
-exit 1
-else
-echo "Find app ${CODEC_TEST_IOS_APP}"
-fi
-
- #ensure instruments not runing
-echo "Try to kill the runing instruments"
-pids_str=`ps x -o pid,command | grep -v grep | grep "instruments" | awk '{printf "%s,", $1}'`
-instruments_pids="${pids_str//,/ }"
-for pid in ${instruments_pids}; do
-echo "Found instruments ${pid}. Killing..."
-kill -9 ${pid} && wait ${pid} &> /dev/null
-done
-
-
-
-DEVICES=`system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2}'`
-if [ "${DEVICES}#" == "#" ]
-then
-echo "Can not find any connected device! please check device is connected to MAC!"
-exit 1
-else
-rand=`date +%s`
-for DEVICE_ID in ${DEVICES}
-do
-echo "Try to run on device:${DEVICE_ID}"
-
-#uninstall the application from device to remove the last result
-./fruitstrap uninstall --bundle ${CODEC_TEST_IOS_APP_ID} --id ${DEVICE_ID}
-if [ $? -ne 0 ]; then
-echo uninstall application: ${CODEC_TEST_IOS_APP} from device: ${DEVICE_ID} is failed!
-fi
-#install the application
-./fruitstrap install --bundle ${CODEC_TEST_IOS_APP} --id ${DEVICE_ID}
-if [ $? -ne 0 ]; then
-echo install application: ${CODEC_TEST_IOS_APP} to device: ${DEVICE_ID} is failed!
-exit 1
-fi
-
-./iFileTransfer -o copy -id ${DEVICE_ID} -app ${CODEC_TEST_IOS_APP_ID} -from ${CODEC_TEST_RES}
-instruments -w ${DEVICE_ID} -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate ${CODEC_TEST_IOS_APP} -e UIASCRIPT ./uiascript.js -e UIARRESULTPATH /tmp/
-#copy to report folder
-./iFileTransfer -o download -id ${DEVICE_ID} -app ${CODEC_TEST_IOS_APP_ID} -from /Documents/${CODEC_TEST_LOG}.log -to ${CODEC_TEST_IOS_REPORT_PATH}/${CODEC_TEST_LOG}_${DEVICE_ID}_${rand}.log
-if [ $? -ne 0 ]; then
-echo "download file: ${CODEC_TEST_LOG}.log from ${CODEC_TEST_IOS_APP_ID} is failed!"
-exit 1
-fi
-
-done
-fi
-}
-
-AUTO_TEST_IOS_PATH=`pwd`
-AUTO_TEST_SRC_PATH="../../.."
-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}
-fi
-
-ENCDEC=$1
-#start to get encoder/decoder performance data,default run the xcode with release
-iosPerformanceTest $ENCDEC release
-
-if [ $? -ne 0 ]; then
-echo "Running $ENCDEC demo to get encoder performance is failed!"
-exit 1
-else
-echo Finished $ENCDEC performance test on ios devices
-echo the test result is generated at ./ios/report/xx.loGbash parsePerfData.sh
-echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxIOS $ENCDEC Endxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-fi
-#TODO:according to the trace of instruments to do some analysis
-find .\ -name *.trace -exec rm -rf {} \;
--- a/autotest/performaceTest/ios/uiascript.js
+++ /dev/null
@@ -1,19 +1,0 @@
-UIATarget.onAlert = function onAlert(alert){
-
- UIALogger.logMessage("In Alert!");
- title = alert.name();
- if (title && title.indexOf("Microphone") !== -1) {
- UIALogger.logMessage("Alert with title '" + title + "' encountered!");
- var buttons = alert.buttons();
- var buttonCount = buttons.length;
-
- if (buttonCount > 0) {
- var acceptButton = buttons[buttonCount - 1];
- acceptButton.tap(); // last button is accept
- }
- return true; //forbid the default cancel processing
- }
- return false; //using the default cancel processing
-}
-var target = UIATarget.localTarget();
-target.delay(6000);
--- a/autotest/performaceTest/parsePerfData.sh
+++ /dev/null
@@ -1,107 +1,0 @@
-#!/bin/bash
-
-#usage runGetPerformanceInfo ${PerformanceLogFile}
-runGetPerformanceInfo_openh264()
-{
-
- if [ ! $# -eq 2 ]
- then
- echo "not enough parameters!"
- echo "usage: ${0} [android/ios] ${PerformanceLogFile}"
- return 1
- fi
-
- local PerformanceLogFile=$2
- local FileName=""
- local Width=""
- local Height=""
- local Frames=""
- local FPS=""
- local EncodeTime=""
- if [ $1 = "android" ]
- then seperatorNum=3
- else
- seperatorNum=2
- fi
-
- while read line
- do
- if [[ $line =~ "enc yuv file" ]]
- then
- FileName=`echo $line | awk 'BEGIN {FS="enc yuv file"} {print $2}'`
- FileName=`echo $FileName | awk 'BEGIN {FS=":"} {print $2}'`
- fi
- if [[ $line =~ "Width" ]]
- then
- Width=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
- fi
- if [[ $line =~ "Height" ]]
- then
- Height=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
- fi
- if [[ $line =~ "Frames" ]]
- then
- Frames=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
- fi
- if [[ $line =~ "FPS" ]]
- then
- FPS=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
- FPS=`echo $FPS | awk 'BEGIN {FS="fps"} {print $1}'`
- echo "${FileName},"${Width}x${Height}",${Frames},${FPS}"
- fi
-
- if [[ $line =~ "encode time" ]]
- then
- EncodeTime=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
- fi
- if [[ $line =~ "height" ]]
- then
- Height=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
- fi
- if [[ $line =~ "H264 source file name" ]]
- then
- FileName=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
- if [ $1 = "ios" ]
- then
- FileName=`echo $FileName | awk -F"DecoderPerfTestRes" '{print $2}'`
- FileName=`echo $FileName | awk -F"/" '{print $2}'`
- else
- FileName=`echo $FileName | awk -F"/" '{print $4}'`
- fi
- fi
-
- done <${PerformanceLogFile}
-
-
-}
-AUTO_TEST_RESULT_PATH="./TestResultCSV/"
-
-
-parseLogToCSV()
-{
-if [ $# -ne 1 ]
-then echo "Please input $0 [android/ios]"
-fi
-if [ $* = "android" ]
-then
- Result_log_path="./android/report/"
- suffix=android
- dos2unix ${Result_log_path}*.*
-else
-Result_log_path="./ios/report/"
-suffix=ios
-fi
-Result_log=`ls ${Result_log_path}`
-
-for log in ${Result_log}
-do
- PerformFile=`echo $log |awk -F"." '{print $1}'`
- PerformFile=${PerformFile}_${suffix}.csv
- #inital perfermance file
- echo "$log,,,">>${AUTO_TEST_RESULT_PATH}${PerformFile}
- echo "YUV,Resolution,Encodedframes,FPS">>${AUTO_TEST_RESULT_PATH}${PerformFile}
- runGetPerformanceInfo_openh264 ${suffix} ${Result_log_path}${log}>>${AUTO_TEST_RESULT_PATH}${PerformFile}
-done
-}
-parseLogToCSV android
-parseLogToCSV ios
--- a/autotest/performaceTest/run_perfTest.sh
+++ /dev/null
@@ -1,122 +1,0 @@
-#!bin/bash
-IOS=1
-ANDROID=1
-ENC=1
-DEC=1
-AUTO_TEST_PATH=`pwd`
-
-#Judge to run the test on which kind of mobile
-if [ $# -eq 0 ];then
-echo Default testing will run on android and ios devices meanwhile
-else
-for params in $*; do
-if [ $params = "ios" ];then
- echo Running the test just on ios devices
- ANDROID=0
-elif [ $params = "android" ];then
- echo Running the test just on android devices
- IOS=0
-elif [ $params = "enc" ];then
- echo Running the encoder performance test
- DEC=0
-elif [ $params = "dec" ];then
- echo Running the decoder performance test
- ENC=0
-else
- echo parameters are illegal!!!, ${0} [ios/android] [enc/dec]
- exit 1
-fi
-done
-fi
-
-#Prepare encoder resources
-if [ ${ENC} = "1" ]
-then
-if [ ! -d ./EncoderPerTestRes ]
-then
-mkdir -p ./EncoderPerfTestRes
-fi
-if [ "#`ls ./EncoderPerfTestRes`" = "#" ]
-then
-echo put yuv and cfg file into ./EncoderPerfTest folder as
-echo case_720p
-echo case_720p/welsenc.cfg
-echo case_720p/layer2.cfg
-echo case_720p/yuv
-echo case_720p/yuv/xxx1.yuv
-echo case_720p/yuv/xxx2.yuv
-echo case_360p
-echo case_360p/welsenc.cfg
-echo ......
-else
-#Run the encoder performance test
-if [ ${IOS} = "1" ]
-then
-echo xxxxxxxxxxxxxxxxIOS ENC Startxxxxxxxxxxxxxxxxxx
-echo Run the Encoder performance test on ios devices
-cd ./ios
-bash run_AutoTest_ios.sh enc
-cd ${AUTO_TEST_PATH}
-fi
-
-if [ ${ANDROID} = "1" ]
-then
-echo xxxxxxxxxxxxxxAndroid ENC Startxxxxxxxxxxxxxxxxxxxx
-echo Run the Encoder performance test on android devices
-cd ./android
-bash run_AutoTest_android.sh enc
-cd ${AUTO_TEST_PATH}
-fi
-fi
-fi
-
-#Prepare decoder resources
-if [ ${DEC} = "1" ]
-then
-if [ ! -d ./DecoderPerfTestRes ]
-then
-mkdir -p ./DecoderPerfTestRes
-fi
-
-if [ "#`ls ./DecoderPerfTestRes`" = "#" ]
-then
-echo put decoded bitstreams into such folder as
-echo xxx1.264
-echo xxx2.264
-echo ........
-else
-#Run the decoder performance test
-if [ ${IOS} = "1" ]
-then
-echo xxxxxxxxxxxxxxxxIOS DEC Startxxxxxxxxxxxxxxxxxx
-echo Run the Decoder performance test on ios devices
-cd ./ios
-bash run_AutoTest_ios.sh dec
-cd ${AUTO_TEST_PATH}
-fi
-
-if [ ${ANDROID} = "1" ]
-then
-echo xxxxxxxxxxxxxxAndroid DEC Startxxxxxxxxxxxxxxxxxxxx
-echo Run the Decoder performance test on android devices
-cd ./android
-bash run_AutoTest_android.sh dec
-cd ${AUTO_TEST_PATH}
-fi
-fi
-fi
-
-#TODO:NOW just generate csv file to display performance data
-cd ${AUTO_TEST_PATH}
-if [[ "#`ls ./ios/report`" == "#" || "#`ls ./android/report`" == "#" ]]
-then
-echo There is nothing result log generated at ios or android devices
-else
-echo Start to generate test result csv file
-#Test result
-mkdir -p ./TestResultCSV
-bash parsePerfData.sh
-echo The csv file locate ./TestResultCSV/xxx.csv
-fi
-
-
--- /dev/null
+++ b/autotest/performanceTest/.gitignore
@@ -1,0 +1,13 @@
+#performance test resource folder
+./EncoderPerfTestRes
+./DecoderPerfTestRes
+./DecoderPerfTestRes/*.*
+./EncoderPerfTestRes/*.*
+#performance test result folder
+./TestResultCSV
+#
+.DS_Store
+#.
+./android/report
+./ios/report
+
--- /dev/null
+++ b/autotest/performanceTest/android/run_AutoTest_android.sh
@@ -1,0 +1,138 @@
+#!/bin/bash
+
+AUTO_TEST_ANDROID_PATH=`pwd`
+AUTO_TEST_SRC_PATH="../../../"
+AUTO_TEST_RES_PATH="${AUTO_TEST_ANDROID_PATH}/report"
+mkdir -p ${AUTO_TEST_RES_PATH}
+#Prepare android build enviroment
+echo please set the enviroment variable as:
+echo export ANDROID_HOME="path of android sdk"
+echo export ANDROID_NDK_HOME="path of android ndk"
+ANDROID_SDK_PATH=${ANDROID_HOME}
+ANDROID_NDK_PATH=${ANDROID_NDK_HOME}
+ANDROID_MAKE_PARAMS="OS=android NDKROOT=${ANDROID_NDK_PATH} TARGET=android-19"
+
+if [ "#${ANDROID_SDK_PATH}" = "#" ]
+then
+echo Please set ANDROID_HOME with the path of Android SDK
+exit 1
+fi
+if [ "#${ANDROID_NDK_PATH}" = "#" ]
+then
+echo Please set ANDROID_NDK_HOME with the path of Android NDK
+exit 1
+fi
+#make build
+cd ${AUTO_TEST_SRC_PATH}
+find ./ -name *.o -exec rm -f {} \;
+find ./ -name *.d -exec rm -f {} \;
+make $ANDROID_MAKE_PARAMS
+
+if [ $? -ne 0 ]
+then
+ echo Build error,check with the trace of make
+ exit 1
+fi
+
+ENCDEC=$1
+#find apk
+if [ ${ENCDEC} = "enc" ]
+then
+echo Start to find enc apk
+apk_name=`find ./ -name WelsEncTest-debug.apk`
+if [ "#${apk_name}" = "#" ]
+then
+ echo Fail to find encoder APK.
+ exit 1
+fi
+else
+echo Start to find dec apk
+apk_name=`find ./ -name WelsDecTest-debug.apk`
+if [ "#${apk_name}" = "#" ]
+then
+echo Fail to find decoder APK.
+exit 1
+fi
+fi
+
+#prepare devices
+ADB=${ANDROID_SDK_PATH}/platform-tools/adb
+
+#get devices
+devices=`$ADB devices | awk -F" " '/\tdevice/{print $1}'`
+if [ "#$devices" = "#" ];then
+ echo "Have not any android devices."
+ exit 1
+fi
+
+#run apk
+run_apk() {
+local apk=$1;
+local rand=` date +%s`
+
+if [[ "${apk}" =~ "WelsDecTest-debug.apk" ]]
+then
+ apk_id="com.wels.dec"
+ apk_main="com.wels.dec/.WelsDecTest"
+ test_path="/sdcard/welsdec"
+ log_grep_params="welsdec"
+ test_res=${AUTO_TEST_ANDROID_PATH}/../DecoderPerfTestRes
+ report_file=${AUTO_TEST_RES_PATH}/decPerf_${rand}
+
+fi
+if [[ "${apk}" =~ "WelsEncTest-debug.apk" ]]
+then
+ apk_id="com.wels.enc"
+ apk_main="com.wels.enc/.WelsEncTest"
+ test_path="/sdcard/welsenc"
+ log_grep_params="welsenc"
+ test_res=${AUTO_TEST_ANDROID_PATH}/../EncoderPerfTestRes
+ report_file=${AUTO_TEST_RES_PATH}/encPerf_${rand}
+fi
+
+for dev in $devices; do
+ dev_info_file=${AUTO_TEST_RES_PATH}/${dev}.log
+ $ADB -s $dev uninstall ${apk_id}
+ $ADB -s $dev install -r ${apk}
+ #TODO: output more info about android device such as name,cpu,memory,and also power comsumption.
+ echo `$ADB -s $dev shell cat /system/build.prop |grep ro.product.model | awk -F"=" '{print $2}'`>${dev_info_file}
+ #push resources
+ $ADB -s $dev push ${test_res} ${test_path}
+ #before start logcat,kill logcat
+ pid=`$ADB -s $dev shell ps | grep logcat | awk '{print $2;}'`
+ [ "#$pid" != "#" ] && $ADB -s $dev shell kill $pid >/dev/null
+ $ADB -s $dev logcat -c
+ $ADB -s $dev logcat |grep ${log_grep_params} >${report_file}_${dev}.log &
+ $ADB -s $dev shell am start -n ${apk_main}
+ # check whetehr the app is finished every 2 sec
+ for (( ; ; )); do
+ $ADB -s $dev shell ps | grep ${apk_id}
+ if [ $? -ne 0 ]; then
+ sleep 2
+ $ADB -s $dev shell ps | grep ${apk_id}
+ [ $? -ne 0 ] && break
+ fi
+ sleep 2
+ done
+
+ # kill logcat
+ pid=`$ADB -s $dev shell ps | grep logcat | awk '{print $2;}'`
+ [ "#$pid" != "#" ] && $ADB -s $dev shell kill $pid >/dev/null
+
+ #delete the res
+ $ADB -s $dev shell rm -rf ${test_path}
+done
+}
+for apk in ${apk_name};do
+ run_apk $apk;
+ if [ $? -ne 0 ]
+ then
+ echo There is something wrong happened when run ${apk_name}
+ exit 1
+ else
+ echo Finished $ENCDEC performance test on android
+ echo The test result is at ./android/report/xxx.log
+ echo xxxxxxxxxxxxxxxAndroid $ENCDEC Endxxxxxxxxxxxxxxxx
+ fi
+done
+
binary files /dev/null b/autotest/performanceTest/ios/fruitstrap differ
binary files /dev/null b/autotest/performanceTest/ios/iFileTransfer differ
--- /dev/null
+++ b/autotest/performanceTest/ios/run_AutoTest_ios.sh
@@ -1,0 +1,147 @@
+#!/bin/bash
+
+##############################################################
+#Build ios test ref app
+
+#set the default configuration
+CODEC_TEST_IOS_ARCH="armv7 armv7s arm64"
+CODEC_TEST_IOS_PLATFORM="iphoneos"
+CODEC_TEST_IOS_DEBUG_RELEASE="Release"
+CODEC_TEST_IOS_REPORT_SUBFOLDER="release"
+
+
+buildXcodeProject()
+{
+ xcodebuild ARCHS="${CODEC_TEST_IOS_ARCH}" VALID_ARCHS="${CODEC_TEST_IOS_ARCH}" ONLY_ACTIVE_ARCH=YES -project $1 -target $2 -configuration $3 -sdk ${CODEC_TEST_IOS_PLATFORM} clean build
+
+if [ $? -eq 0 ]; then
+ echo "build $1 $3 successfully"
+ else
+ echo "build $1 $3 fail"
+ exit 1
+ fi
+}
+
+
+
+iosPerformanceTest()
+{
+
+if [ $# -gt 2 ]; then
+echo "Please use command $0 [enc/dec] [release/debug]"
+exit 1
+fi
+
+for PARAM in $*; do
+ if [ "enc" = "${PARAM}" ]; then
+ CODEC_TEST_XCODE_PROJECT_NAME="${AUTO_TEST_SRC_PATH}/codec/build/iOS/enc/encDemo/encDemo.xcodeproj"
+ CODEC_TEST_IOS_PROJECT_NAME="encDemo"
+ CODEC_TEST_IOS_PROJECT_PATH="${AUTO_TEST_SRC_PATH}/codec/build/iOS/enc/encDemo/build"
+ CODEC_TEST_IOS_APP=${CODEC_TEST_IOS_PROJECT_PATH}/${CODEC_TEST_IOS_DEBUG_RELEASE}-iphoneos/${CODEC_TEST_IOS_PROJECT_NAME}.app
+ CODEC_TEST_IOS_APP_ID="cisco.encDemo"
+ CODEC_TEST_RES=${AUTO_TEST_IOS_PATH}/../EncoderPerfTestRes
+ CODEC_TEST_LOG="encPerf"
+ elif [ "dec" = "${PARAM}" ]; then
+ CODEC_TEST_XCODE_PROJECT_NAME="${AUTO_TEST_SRC_PATH}/codec/build/iOS/dec/demo/demo.xcodeproj/"
+ CODEC_TEST_IOS_PROJECT_NAME="demo"
+ CODEC_TEST_IOS_PROJECT_PATH="${AUTO_TEST_SRC_PATH}/codec/build/iOS/dec/demo/build"
+ CODEC_TEST_IOS_APP=${CODEC_TEST_IOS_PROJECT_PATH}/${CODEC_TEST_IOS_DEBUG_RELEASE}-iphoneos/${CODEC_TEST_IOS_PROJECT_NAME}.app
+ CODEC_TEST_IOS_APP_ID="hf.cisco.demo"
+ CODEC_TEST_RES=${AUTO_TEST_IOS_PATH}/../DecoderPerfTestRes
+ CODEC_TEST_LOG="decPerf"
+ elif [ "release" = "${PARAM}" ]; then
+ CODEC_TEST_IOS_DEBUG_RELEASE="Release"
+ CODEC_TEST_IOS_REPORT_SUBFOLDER="release"
+ elif [ "debug" = "${PARAM}" ]; then
+ CODEC_TEST_IOS_DEBUG_RELEASE="Debug"
+ CODEC_TEST_IOS_REPORT_SUBFOLDER="debug"
+ else
+ echo parameters are illegal!!!, please have a check.
+ exit 1
+ fi
+ done
+
+echo "Codec test will run on ${CODEC_TEST_IOS_PLATFORM} with ${CODEC_TEST_IOS_DEBUG_RELEASE}"
+buildXcodeProject ${CODEC_TEST_XCODE_PROJECT_NAME} ${CODEC_TEST_IOS_PROJECT_NAME} ${CODEC_TEST_IOS_DEBUG_RELEASE} ${CODEC_TEST_IOS_PLATFORM}
+
+
+
+
+##############run on ios devices#########################
+# for real device
+if [ ! -d ${CODEC_TEST_IOS_APP} ] ; then
+echo "${CODEC_TEST_IOS_APP} is not found"
+exit 1
+else
+echo "Find app ${CODEC_TEST_IOS_APP}"
+fi
+
+ #ensure instruments not runing
+echo "Try to kill the runing instruments"
+pids_str=`ps x -o pid,command | grep -v grep | grep "instruments" | awk '{printf "%s,", $1}'`
+instruments_pids="${pids_str//,/ }"
+for pid in ${instruments_pids}; do
+echo "Found instruments ${pid}. Killing..."
+kill -9 ${pid} && wait ${pid} &> /dev/null
+done
+
+
+
+DEVICES=`system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2}'`
+if [ "${DEVICES}#" == "#" ]
+then
+echo "Can not find any connected device! please check device is connected to MAC!"
+exit 1
+else
+rand=`date +%s`
+for DEVICE_ID in ${DEVICES}
+do
+echo "Try to run on device:${DEVICE_ID}"
+
+#uninstall the application from device to remove the last result
+./fruitstrap uninstall --bundle ${CODEC_TEST_IOS_APP_ID} --id ${DEVICE_ID}
+if [ $? -ne 0 ]; then
+echo uninstall application: ${CODEC_TEST_IOS_APP} from device: ${DEVICE_ID} is failed!
+fi
+#install the application
+./fruitstrap install --bundle ${CODEC_TEST_IOS_APP} --id ${DEVICE_ID}
+if [ $? -ne 0 ]; then
+echo install application: ${CODEC_TEST_IOS_APP} to device: ${DEVICE_ID} is failed!
+exit 1
+fi
+
+./iFileTransfer -o copy -id ${DEVICE_ID} -app ${CODEC_TEST_IOS_APP_ID} -from ${CODEC_TEST_RES}
+instruments -w ${DEVICE_ID} -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate ${CODEC_TEST_IOS_APP} -e UIASCRIPT ./uiascript.js -e UIARRESULTPATH /tmp/
+#copy to report folder
+./iFileTransfer -o download -id ${DEVICE_ID} -app ${CODEC_TEST_IOS_APP_ID} -from /Documents/${CODEC_TEST_LOG}.log -to ${CODEC_TEST_IOS_REPORT_PATH}/${CODEC_TEST_LOG}_${DEVICE_ID}_${rand}.log
+if [ $? -ne 0 ]; then
+echo "download file: ${CODEC_TEST_LOG}.log from ${CODEC_TEST_IOS_APP_ID} is failed!"
+exit 1
+fi
+
+done
+fi
+}
+
+AUTO_TEST_IOS_PATH=`pwd`
+AUTO_TEST_SRC_PATH="../../.."
+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}
+fi
+
+ENCDEC=$1
+#start to get encoder/decoder performance data,default run the xcode with release
+iosPerformanceTest $ENCDEC release
+
+if [ $? -ne 0 ]; then
+echo "Running $ENCDEC demo to get encoder performance is failed!"
+exit 1
+else
+echo Finished $ENCDEC performance test on ios devices
+echo the test result is generated at ./ios/report/xx.loGbash parsePerfData.sh
+echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxIOS $ENCDEC Endxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+fi
+#TODO:according to the trace of instruments to do some analysis
+find .\ -name *.trace -exec rm -rf {} \;
--- /dev/null
+++ b/autotest/performanceTest/ios/uiascript.js
@@ -1,0 +1,19 @@
+UIATarget.onAlert = function onAlert(alert){
+
+ UIALogger.logMessage("In Alert!");
+ title = alert.name();
+ if (title && title.indexOf("Microphone") !== -1) {
+ UIALogger.logMessage("Alert with title '" + title + "' encountered!");
+ var buttons = alert.buttons();
+ var buttonCount = buttons.length;
+
+ if (buttonCount > 0) {
+ var acceptButton = buttons[buttonCount - 1];
+ acceptButton.tap(); // last button is accept
+ }
+ return true; //forbid the default cancel processing
+ }
+ return false; //using the default cancel processing
+}
+var target = UIATarget.localTarget();
+target.delay(6000);
--- /dev/null
+++ b/autotest/performanceTest/parsePerfData.sh
@@ -1,0 +1,107 @@
+#!/bin/bash
+
+#usage runGetPerformanceInfo ${PerformanceLogFile}
+runGetPerformanceInfo_openh264()
+{
+
+ if [ ! $# -eq 2 ]
+ then
+ echo "not enough parameters!"
+ echo "usage: ${0} [android/ios] ${PerformanceLogFile}"
+ return 1
+ fi
+
+ local PerformanceLogFile=$2
+ local FileName=""
+ local Width=""
+ local Height=""
+ local Frames=""
+ local FPS=""
+ local EncodeTime=""
+ if [ $1 = "android" ]
+ then seperatorNum=3
+ else
+ seperatorNum=2
+ fi
+
+ while read line
+ do
+ if [[ $line =~ "enc yuv file" ]]
+ then
+ FileName=`echo $line | awk 'BEGIN {FS="enc yuv file"} {print $2}'`
+ FileName=`echo $FileName | awk 'BEGIN {FS=":"} {print $2}'`
+ fi
+ if [[ $line =~ "Width" ]]
+ then
+ Width=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
+ fi
+ if [[ $line =~ "Height" ]]
+ then
+ Height=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
+ fi
+ if [[ $line =~ "Frames" ]]
+ then
+ Frames=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
+ fi
+ if [[ $line =~ "FPS" ]]
+ then
+ FPS=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
+ FPS=`echo $FPS | awk 'BEGIN {FS="fps"} {print $1}'`
+ echo "${FileName},"${Width}x${Height}",${Frames},${FPS}"
+ fi
+
+ if [[ $line =~ "encode time" ]]
+ then
+ EncodeTime=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
+ fi
+ if [[ $line =~ "height" ]]
+ then
+ Height=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
+ fi
+ if [[ $line =~ "H264 source file name" ]]
+ then
+ FileName=`echo $line | awk 'BEGIN {FS=":"} {print $'${seperatorNum}'}'`
+ if [ $1 = "ios" ]
+ then
+ FileName=`echo $FileName | awk -F"DecoderPerfTestRes" '{print $2}'`
+ FileName=`echo $FileName | awk -F"/" '{print $2}'`
+ else
+ FileName=`echo $FileName | awk -F"/" '{print $4}'`
+ fi
+ fi
+
+ done <${PerformanceLogFile}
+
+
+}
+AUTO_TEST_RESULT_PATH="./TestResultCSV/"
+
+
+parseLogToCSV()
+{
+if [ $# -ne 1 ]
+then echo "Please input $0 [android/ios]"
+fi
+if [ $* = "android" ]
+then
+ Result_log_path="./android/report/"
+ suffix=android
+ dos2unix ${Result_log_path}*.*
+else
+Result_log_path="./ios/report/"
+suffix=ios
+fi
+Result_log=`ls ${Result_log_path}`
+
+for log in ${Result_log}
+do
+ PerformFile=`echo $log |awk -F"." '{print $1}'`
+ PerformFile=${PerformFile}_${suffix}.csv
+ #inital perfermance file
+ echo "$log,,,">>${AUTO_TEST_RESULT_PATH}${PerformFile}
+ echo "YUV,Resolution,Encodedframes,FPS">>${AUTO_TEST_RESULT_PATH}${PerformFile}
+ runGetPerformanceInfo_openh264 ${suffix} ${Result_log_path}${log}>>${AUTO_TEST_RESULT_PATH}${PerformFile}
+done
+}
+parseLogToCSV android
+parseLogToCSV ios
--- /dev/null
+++ b/autotest/performanceTest/run_perfTest.sh
@@ -1,0 +1,122 @@
+#!bin/bash
+IOS=1
+ANDROID=1
+ENC=1
+DEC=1
+AUTO_TEST_PATH=`pwd`
+
+#Judge to run the test on which kind of mobile
+if [ $# -eq 0 ];then
+echo Default testing will run on android and ios devices meanwhile
+else
+for params in $*; do
+if [ $params = "ios" ];then
+ echo Running the test just on ios devices
+ ANDROID=0
+elif [ $params = "android" ];then
+ echo Running the test just on android devices
+ IOS=0
+elif [ $params = "enc" ];then
+ echo Running the encoder performance test
+ DEC=0
+elif [ $params = "dec" ];then
+ echo Running the decoder performance test
+ ENC=0
+else
+ echo parameters are illegal!!!, ${0} [ios/android] [enc/dec]
+ exit 1
+fi
+done
+fi
+
+#Prepare encoder resources
+if [ ${ENC} = "1" ]
+then
+if [ ! -d ./EncoderPerTestRes ]
+then
+mkdir -p ./EncoderPerfTestRes
+fi
+if [ "#`ls ./EncoderPerfTestRes`" = "#" ]
+then
+echo put yuv and cfg file into ./EncoderPerfTest folder as
+echo case_720p
+echo case_720p/welsenc.cfg
+echo case_720p/layer2.cfg
+echo case_720p/yuv
+echo case_720p/yuv/xxx1.yuv
+echo case_720p/yuv/xxx2.yuv
+echo case_360p
+echo case_360p/welsenc.cfg
+echo ......
+else
+#Run the encoder performance test
+if [ ${IOS} = "1" ]
+then
+echo xxxxxxxxxxxxxxxxIOS ENC Startxxxxxxxxxxxxxxxxxx
+echo Run the Encoder performance test on ios devices
+cd ./ios
+bash run_AutoTest_ios.sh enc
+cd ${AUTO_TEST_PATH}
+fi
+
+if [ ${ANDROID} = "1" ]
+then
+echo xxxxxxxxxxxxxxAndroid ENC Startxxxxxxxxxxxxxxxxxxxx
+echo Run the Encoder performance test on android devices
+cd ./android
+bash run_AutoTest_android.sh enc
+cd ${AUTO_TEST_PATH}
+fi
+fi
+fi
+
+#Prepare decoder resources
+if [ ${DEC} = "1" ]
+then
+if [ ! -d ./DecoderPerfTestRes ]
+then
+mkdir -p ./DecoderPerfTestRes
+fi
+
+if [ "#`ls ./DecoderPerfTestRes`" = "#" ]
+then
+echo put decoded bitstreams into such folder as
+echo xxx1.264
+echo xxx2.264
+echo ........
+else
+#Run the decoder performance test
+if [ ${IOS} = "1" ]
+then
+echo xxxxxxxxxxxxxxxxIOS DEC Startxxxxxxxxxxxxxxxxxx
+echo Run the Decoder performance test on ios devices
+cd ./ios
+bash run_AutoTest_ios.sh dec
+cd ${AUTO_TEST_PATH}
+fi
+
+if [ ${ANDROID} = "1" ]
+then
+echo xxxxxxxxxxxxxxAndroid DEC Startxxxxxxxxxxxxxxxxxxxx
+echo Run the Decoder performance test on android devices
+cd ./android
+bash run_AutoTest_android.sh dec
+cd ${AUTO_TEST_PATH}
+fi
+fi
+fi
+
+#TODO:NOW just generate csv file to display performance data
+cd ${AUTO_TEST_PATH}
+if [[ "#`ls ./ios/report`" == "#" || "#`ls ./android/report`" == "#" ]]
+then
+echo There is nothing result log generated at ios or android devices
+else
+echo Start to generate test result csv file
+#Test result
+mkdir -p ./TestResultCSV
+bash parsePerfData.sh
+echo The csv file locate ./TestResultCSV/xxx.csv
+fi
+
+