+++ /dev/null
-#!/bin/sh
-TIZEN_SDK_INSTALL_PATH=`grep TIZEN_SDK_INSTALLED_PATH ${HOME}/tizen-sdk-data/tizensdkpath | cut -f2- -d"="`
-EMULATOR_MANAGER=${TIZEN_SDK_INSTALL_PATH}/tools/emulator/bin/emulator-manager
-TESTPROJECT="TestTizen"
-LOGTIME=$(date +"%Y.%m.%d-%H.%M.%S")
-LOGSTR="Compliance TEST Start..."
-TESTPROFILE="test:../profiles.xml"
-CURRENT_DIR=$(pwd)
-EMUL_NAME="webcompliance"
-WIDGET_ID="http://yourdomain/TestTizen"
-CHROME="google-chrome"
-CMD_EMUL_CREATE="${EMULATOR_MANAGER} create -n ${EMUL_NAME} -b 1"
-CMD_EMUL_DELETE="${EMULATOR_MANAGER} delete -n ${EMUL_NAME}"
-CMD_EMUL_LAUNCH="${EMULATOR_MANAGER} launch -n ${EMUL_NAME}"
-CMD_EMUL_LIST="${EMULATOR_MANAGER} list-vm"
-CMD_SDB_DEVICE="sdb devices"
-CMD_WEB_GEN="./web-gen"
-CMD_WEB_SIGN="../web-signing"
-CMD_WEB_PACKAGING="../web-packaging"
-CMD_WEB_INSTALL="./web-install"
-CMD_WEB_UNINSTALL="./web-uninstall"
-CMD_WEB_RUN="./web-run"
-CMD_WEB_DEBUGRUN="./web-debug"
-
-
-#function
-printlog() {
- printf "%s" "$1" >> compliance.${LOGTIME}.log
-}
-printlogln() {
- echo "$1"
- printlog "$1"
- printf "\n" >> compliance.${LOGTIME}.log
-}
-create_y_File() {
- printf "%s\n\n" "yes" > y
-}
-remove_y_File() {
- rm y
-}
-exitMessage() {
- PID=`ps -a | grep emulator | awk -F ' ' '{ print $1 }'`
- if [ ${PID} ]
- then
- kill -9 ${PID}
- fi
-
- echo "web compliance test complete.\nplease check 'compliance.${LOGTIME}.log' file"
- remove_y_File
-
- if [ $1 = 0 ]
- then
- printlogln "Compliance TEST success End..."
- else
- printlogln "Compliance TEST failed End..."
- fi
-
- exit $1
-}
-isEmulVM() {
- for list in $@; do
- if [ ${EMUL_NAME} = ${list} ]
- then
- return 0; # exist
- fi
- done
- return 1; # not exist
-}
-isEmulVMConnected() {
- for list in `${CMD_SDB_DEVICE} | grep ${EMUL_NAME}`; do
- if [ ${EMUL_NAME} = ${list} ]
- then
- return 0; # connected
- fi
- done
- return 1; # not connected
-}
-checkCMDSuccess() {
- START_TIME_SEC=$(date +%s)
- CHECK=`cat compliance.${LOGTIME}.log | tail -1 | awk -F ' ' '{ print $(NF)}'`
- if [ -n $1 ] && [ "$1" = "debug" ]
- then
- #echo 'debug check'
- CHECK=`cat compliance.${LOGTIME}.log | tail -2 | head -1 | awk -F ' ' '{ printf $(NF) }'`
- fi
-
- while true
- do
- sleep 1
-
- if [ ${CHECK} = success ]
- then
- #echo 'success'
- break;
- fi
-
- CURRENT_TIME_SEC=$(date +%s)
- DIFF=`echo $(( $CURRENT_TIME_SEC - $START_TIME_SEC )) | bc`
- #echo ${DIFF}
-
- if [ $DIFF = 60 ]
- then
- printlogln ">>wait ${DIFF} sec but failed"
- exitMessage 1
- break;
- fi
- done
-}
-
-#test start
-create_y_File
-printlogln "${LOGSTR}"
-
-#emulator
-## emulator create
-printlogln ">create emulator vm"
-isEmulVM `${CMD_EMUL_LIST}` # already exist check
-if [ `echo $?` = 1 ]
-then
- printlog ">>"
- ${CMD_EMUL_CREATE} >> compliance.${LOGTIME}.log
-else
- printlogln ">>emulator vm is already exist"
-fi
-## emulator launch
-printlogln ">launch emulator vm"
-printlog ">>"
-${CMD_EMUL_LAUNCH} >> compliance.${LOGTIME}.log
-## emulator booting complete and connection wait
-printlogln ">waiting emulator booting complete and sdb connection"
-START_TIME_SEC=$(date +%s)
-while true
-do
- isEmulVMConnected
- if [ `echo $?` = 0 ]
- then
- printlogln ">>connected"
- break;
- else
- sleep 1;
- fi
-
- CURRENT_TIME_SEC=$(date +%s)
- DIFF=`echo $(( $CURRENT_TIME_SEC - $START_TIME_SEC )) | bc`
-
- if [ $DIFF = 60 ]
- then
- printlogln ">>connection try ${DIFF} sec but not connected"
- exitMessage 1
- break;
- fi
-done
-printlogln ">if emulator showing setting view then please complete that"
-
-#remove tizen basic web project
-printlogln ">remove previous test project"
-printlog "rm -rf ${TESTPROJECT}"
-rm -rf ${TESTPROJECT}
-
-#create tizen basic web project
-printlogln ">create test project"
-printlog "${CMD_WEB_GEN} -n ${TESTPROJECT} >> compliance.${LOGTIME}.log"
-${CMD_WEB_GEN} -n ${TESTPROJECT} >> compliance.${LOGTIME}.log
-
-#check project create
-printlogln ">check test project creation"
-printlog "if [ -d ${TESTPROJECT} ]"
-if [ -d ${TESTPROJECT} ]
-then
- # DIRECTORY exists.
- printlog "DIRECTORY exists."
-else
- # DIRECTORY not exists.
- printlog "no. DIRECTORY not exists."
- exitMessage 1
-fi
-
-#signing project
-printlogln ">signing test project"
-cd ${TESTPROJECT}
-echo "1234" | script -c "${CMD_WEB_SIGN} --nocheck -p ${TESTPROFILE} --exclude typescript" -a ../compliance.${LOGTIME}.log > ${CURRENT_DIR}/.temp
-
-while [ ! -e author-signature.xml ]
-do
- sleep 1
-done
-cd ${CURRENT_DIR}
-rm .temp
-
-
-#packaging project
-printlogln ">packaging test project"
-cd ${TESTPROJECT}
-echo "yes" | ${CMD_WEB_PACKAGING} >> ${CURRENT_DIR}/compliance.${LOGTIME}.log
-mv ${TESTPROJECT}.wgt ${CURRENT_DIR}
-cd ${CURRENT_DIR}
-
-
-#install project
-printlogln ">install test project"
-EMUL_ID=`${CMD_SDB_DEVICE} | grep ${EMUL_NAME} | awk '{ print $1 }'`
-${CMD_WEB_UNINSTALL} -d ${EMUL_ID} -i ${WIDGET_ID} >> compliance.${LOGTIME}.log
-${CMD_WEB_INSTALL} -d ${EMUL_ID} -w ${TESTPROJECT}.wgt >> compliance.${LOGTIME}.log
-checkCMDSuccess
-
-#run project
-printlogln ">run test project"
-${CMD_WEB_RUN} -d ${EMUL_ID} -w ${TESTPROJECT}.wgt -i ${WIDGET_ID} >> compliance.${LOGTIME}.log
-checkCMDSuccess
-
-#uninstall project
-printlogln ">uninstall test project"
-${CMD_WEB_UNINSTALL} -d ${EMUL_ID} -i ${WIDGET_ID} >> compliance.${LOGTIME}.log
-checkCMDSuccess
-
-#debug-run project
-printlogln ">debug run test project"
-${CMD_WEB_DEBUGRUN} -d ${EMUL_ID} -w ${TESTPROJECT}.wgt -i ${WIDGET_ID} >> compliance.${LOGTIME}.log
-checkCMDSuccess debug
-printlogln ">>`cat compliance.${LOGTIME}.log | tail -1`"
-sed -i '$d' compliance.${LOGTIME}.log
-URL=$(cat compliance.${LOGTIME}.log | tail -1 | awk -F ' ' '{ printf $(NF) }')
-
-#chrome browser install check
-printlogln ">chrome browser install check"
-if [ "$OS" = "darwin" ] || [ "$(uname)" = "Darwin" ]; then
- CHROME_PATH=/Applications
- CHROME="$CHROME_PATH/Google Chrome.app/Contents/MacOS/Google Chrome"
- if ! test -e "$CHROME"; then
- CHROME_PATH=~/Desktop
- CHROME="$CHROME_PATH/Google Chrome.app/Contents/MacOS/Google Chrome"
- fi
-fi
-
-type ${CHROME} >> compliance.${LOGTIME}.log
-if [ `echo $?` != 0 ]
-then
- printlogln ">>please install chrome browser"
- exitMessage 1
-else
- printlogln ">>chrome browser installed"
-fi
-
-#chrome browser (inspector) launch
-printlogln ">inspector launch"
-${CHROME} --allow-file-access-from-files --app=${URL}& >> compliance.${LOGTIME}.log
-
-#chrome close
-#PID=$(cat compliance.${LOGTIME}.log | tail -1 | awk -F ' ' '{ printf $(NF) }')
-PID=`ps -a | grep chrome | head -1 | awk -F ' ' '{ print $1 }'`
-sleep 1
-if [ ${PID} ]
-then
- printlogln ">>inspector launch success"
- kill -9 ${PID}
-fi
-
-#user interaction
-exitMessage 0
-