--- /dev/null
+
+
+#!/bin/bash
+#
+# Copyright (c) 2014 Samsung Electronics Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the License);
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http:#www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+TIMEOUT_VALUE=60 #default timeout value
+FILE="/tmp/TC_Timeout.txt"
+SCRIPT_DIR="/home/owner/share"
+
+# extract TCT configuration directory from TCT_CONFIG_FILE (/tmp/TCT_CONFIG)
+TCT_CONFIG_FILE=/tmp/TCT_CONFIG
+if [ ! -f $TCT_CONFIG_FILE ];then
+ echo "$TCT_CONFIG_FILE is not Found : Can Not Read TCT Configuration File to get Execution Mode"
+ exit 1;
+fi
+DEVICE_EXECUTION_MODE_30=`cat $TCT_CONFIG_FILE | grep DEVICE_EXECUTION_MODE_30 | cut -f 2- -d '='`
+if [ $DEVICE_EXECUTION_MODE_30 == "" ]; then
+ echo "'DEVICE_EXECUTION_MODE_30' key-value pair is not Found in $TCT_CONFIG_FILE. Unable to get Execution Mode"
+ exit 1;
+fi
+
+if [[ "$1" == "" || "$2" == "" || "$3" == "" ]];
+then
+ echo "module name, TC name and build type type needed"
+ exit 1
+fi
+
+TIME_FACTOR=10
+RESULT_PATH=/tmp/tcresult
+ERRLOG_PATH=/tmp/tclog
+UTC_LOG=/tmp/utclog
+UTC_LOG_CORE=/tmp/utclog_core
+
+DIR_COV1=/tmp/usr
+DIR_COV2=/tmp/home
+DIR_COV3=/home/abuild
+DIR_COV4=/usr/src
+
+#Read timeout value from /tmp/TCT_Timeout.txt file
+if [ -f $FILE ];
+then
+ for next in `cat $FILE`
+ do
+ TIMEOUT_VALUE=$next
+ done
+fi
+
+if [ -d $DIR_COV1 ];
+then
+ chsmack -a "*" $(find $DIR_COV1 -type d)
+fi
+
+if [ -d $DIR_COV2 ];
+then
+ chsmack -a "*" $(find $DIR_COV2 -type d)
+fi
+
+if [ -d $DIR_COV3 ];
+then
+ chsmack -a "*" $(find $DIR_COV3 -type d)
+fi
+
+if [ -d $DIR_COV4 ];
+then
+ chsmack -a "*" $(find $DIR_COV4 -type d)
+fi
+
+function KillPackage {
+ pkgcmd --kill -n $1
+ sleep 2
+}
+
+
+function Execute {
+ rm -f $RESULT_PATH
+ rm -f $ERRLOG_PATH
+ rm -f $UTC_LOG
+ rm -f $UTC_LOG_CORE
+
+ ## pre-launch script
+ if [ -f $SCRIPT_DIR/pre_launch.sh ];
+ then
+ bash $SCRIPT_DIR/pre_launch.sh $1 $2
+ fi
+
+ RET=`su -c "app_launcher -s $1 testcase_name $2" $DEVICE_EXECUTION_MODE_30`
+ if [[ $RET != *"successfully launched"* ]];then
+ echo "Launch Failed"
+ su -c "app_launcher -s $1 > /dev/null" $DEVICE_EXECUTION_MODE_30
+ exit 1
+ fi
+ ## post-launch script
+ if [ -f $SCRIPT_DIR/post_launch.sh ];
+ then
+ bash $SCRIPT_DIR/post_launch.sh $1 $2
+ fi
+
+
+ COUNTER=0
+
+ while [ ! -e $RESULT_PATH ];
+ do
+ if [ $COUNTER -eq $TIMEOUT_VALUE ];
+ then
+ # terminate launched application
+ su -c "app_launcher -s $1 > /dev/null" $DEVICE_EXECUTION_MODE_30
+ echo "Timeout! [ Execution exceeded $TIMEOUT_VALUE seconds ]"
+ if [ -e $ERRLOG_PATH ];
+ then
+ echo `cat $ERRLOG_PATH`
+ rm -f $ERRLOG_PATH
+ fi
+ if [ -e $UTC_LOG_CORE ];
+ then
+ echo `cat $UTC_LOG_CORE`
+ rm -f $UTC_LOG_CORE
+ fi
+ alive=`su -c "app_launcher -r $1" $DEVICE_EXECUTION_MODE_30 | grep "not"`
+ if [ "$alive" == "" ]; then
+ su -c "app_launcher -t $1 > /dev/null" $DEVICE_EXECUTION_MODE_30
+ fi
+
+ su -c "app_launcher -s $1 > /dev/null" $DEVICE_EXECUTION_MODE_30
+ exit 1
+ fi
+ sleep 1
+ COUNTER=$(($COUNTER + 1))
+ done
+
+ if [ -e $ERRLOG_PATH ];
+ then
+ echo `cat $ERRLOG_PATH`
+ rm -f $ERRLOG_PATH
+ fi
+ if [ -e $UTC_LOG_CORE ];
+ then
+ echo `cat $UTC_LOG_CORE`
+ rm -f $UTC_LOG_CORE
+ fi
+ alive=`su -c "app_launcher -r $1" $DEVICE_EXECUTION_MODE_30 | grep "not"`
+ if [ "$alive" == "" ]; then
+ su -c "app_launcher -t $1 > /dev/null" $DEVICE_EXECUTION_MODE_30
+ fi
+ exit `cat $RESULT_PATH`
+}
+
+
+Execute $1 $2
+
+
+
+
return True
-def install(TYPE, MODNAME, PROFILE, TC_COUNT, ARCH):
+def install(TYPE, MODNAME, PROFILE, TC_COUNT, ARCH, COVERAGE):
+
rpmCheck=False
global INSTALL_PKG_COUNT
if ( TYPE == None ):
# scripts_tpk/inst.sh > /tmp/'+TCT_DIR+'/inst.sh')
src_f=open('scripts_tpk'+dirSeparator+'inst.sh')
dest_f=open(dirSeparator+'tmp'+dirSeparator+TCT_DIR+dirSeparator+'inst.sh', 'w')
+
for line in src_f:
+
pkg_dir_m=re.search('^\sPKG_DIR=(?P<pkg_dir>%{PKG_DIR})', line)
pkg_name_m=re.search('^\sPKG_NAME=(?P<pkg_name>%{PKG_NAME})', line)
pkg_fname_m=re.search('^\sPKG_FULLNAME=(?P<pkg_fname>%{PKG_FULLNAME})', line)
line=line.replace('%{PKG_NAME}', '"'+PKG_NAME+'"')
elif ( pkg_fname_m != None ):
line=line.replace('%{PKG_FULLNAME}', '"'+PKG_FNAME+'"')
+
dest_f.write(line)
src_f.close()
sys.exit('Aborting...')
# external_wrapper.sh
+
process_dali_application = "dali-application"
process = "dali"
if ( re.search(process_dali_application, MODNAME) != None ):
shutil.copy('scripts_tpk'+dirSeparator+'external_wrapper_dali_app_launch.sh', dirSeparator+'tmp'+dirSeparator+TCT_DIR+dirSeparator+'external_wrapper.sh')
elif ( re.search(process, MODNAME) != None ):
shutil.copy('scripts_tpk'+dirSeparator+'external_wrapper_dali_binary_launch.sh', dirSeparator+'tmp'+dirSeparator+TCT_DIR+dirSeparator+'external_wrapper.sh')
+ elif ( COVERAGE == '1' ):
+ print('-- Using Coverage Wrapper...')
+ shutil.copy('scripts_tpk'+dirSeparator+'external_wrapper_coverage.sh', dirSeparator+'tmp'+dirSeparator+TCT_DIR+dirSeparator+'external_wrapper.sh')
else:
shutil.copy('scripts_tpk'+dirSeparator+'external_wrapper.sh', dirSeparator+'tmp'+dirSeparator+TCT_DIR)
-
+
# LICENSE, add_all_smack_rule.sh, all_smack.rule
shutil.copy('scripts_tpk'+dirSeparator+'LICENSE', dirSeparator+'tmp'+dirSeparator+TCT_DIR)
build_ctype=None
profile=None
tc_count=None
+is_coverage=0
INSTALL_PKG_COUNT=0
### script starts here ###
build_ctype=sys.argv[4]
if ( len(sys.argv) >= 6 ):
module=sys.argv[5]
+if ( len(sys.argv) >= 7 ):
+ is_coverage=sys.argv[6]
if ( os.path.exists('install.log') ):
os.remove('install.log')
instLog.write('Following packages get installed successfully:\n')
instLog.close()
-install(build_ctype, module, profile,tc_count, arch)
+install(build_ctype, module, profile,tc_count, arch, is_coverage)
if ( module == None ):
instLog=open('install.log', 'a')
cd $PWD
fi
}
+function install_coverage {
+
+ TC_TYPE=$1
+ MOD_NAME=$2
+ TC_COUNT=1
+ IS_COVERAGE=1
+
+ if [ "$ARCH_TYPE" == "arm" ] || [ "$ARCH_TYPE" == "aarch64" ] ; then
+ ln -sf ./scripts_tpk/tpk-install.py $PWD/tpk-install
+ python tpk-install $ARCH_TYPE $PROFILE_TYPE $TC_COUNT $TC_TYPE $MOD_NAME $IS_COVERAGE
+ elif [ "$ARCH_TYPE" == "x86" ] || [ "$ARCH_TYPE" == "x86_64" ] ; then
+ ln -sf ./scripts_tpk/tpksdk-install.py $PWD/tpksdk-install
+ python tpksdk-install $ARCH_TYPE $PROFILE_TYPE $TC_COUNT $TC_TYPE $MOD_NAME $IS_COVERAGE
+ fi
+
+ if [ $INSTALL_CHILD == 1 ]; then
+ echo "------ Generating child packages..."
+ bash $PWD/scripts_tpk/child-package-generator.sh $TC_TYPE $MOD_NAME $PROFILE_TYPE $TC_CHILD_COUNT
+ if [ $? -ne 0 ]; then
+ cd $PWD
+ echo "------ child-package-generator script Failed to generate child packages"
+ exit 1;
+ fi
+ cd $PWD
+ fi
+}
function install_custom {
helpusage
fi
+elif [ "install_coverage" == "$1" ]; then
+
+ if [ "$#" -eq "3" ]; then
+ install_coverage
+
+ elif [ "$#" -eq "4" ]; then
+ check_tc_type $2 $3 $4
+ install_coverage $TESTCASE_TYPE
+
+ elif [ "$#" -eq "5" ]; then
+ check_tc_type $2 $3 $4 $5
+ MODULE_NAME=$3
+ install_coverage $TESTCASE_TYPE $MODULE_NAME
+
+ else
+ echo "Entered wrong number of arguments"
+ helpusage
+ fi
+
elif [ "install_child" == "$1" ]; then
INSTALL_CHILD=1
return True
-def install(TYPE, MODNAME, PROFILE, TC_COUNT, ARCH):
+def install(TYPE, MODNAME, PROFILE, TC_COUNT, ARCH, COVERAGE):
rpmCheck=False
global INSTALL_PKG_COUNT
if ( TYPE == None ):
shutil.copy('scripts_tpk'+dirSeparator+'external_wrapper_dali_app_launch.sh', dirSeparator+'tmp'+dirSeparator+TCT_DIR+dirSeparator+'external_wrapper.sh')
elif ( re.search(process, MODNAME) != None ):
shutil.copy('scripts_tpk'+dirSeparator+'external_wrapper_dali_binary_launch.sh', dirSeparator+'tmp'+dirSeparator+TCT_DIR+dirSeparator+'external_wrapper.sh')
+ elif ( COVERAGE == '1' ):
+ print('-- Using Coverage Wrapper...')
+ shutil.copy('scripts_tpk'+dirSeparator+'external_wrapper_coverage.sh', dirSeparator+'tmp'+dirSeparator+TCT_DIR+dirSeparator+'external_wrapper.sh')
else:
shutil.copy('scripts_tpk'+dirSeparator+'external_wrapper.sh', dirSeparator+'tmp'+dirSeparator+TCT_DIR)
build_ctype=None
profile=None
tc_count=None
+is_coverage=0
INSTALL_PKG_COUNT=0
+
### script starts here ###
OS=platform.system()
build_ctype=sys.argv[4]
if ( len(sys.argv) >= 6 ):
module=sys.argv[5]
+if ( len(sys.argv) >= 7 ):
+ is_coverage=sys.argv[6]
if ( arch == 'x86' ):
arch='i386'
instLog.write('Following packages get installed successfully:\n')
instLog.close()
-install(build_ctype, module, profile,tc_count, arch)
+install(build_ctype, module, profile,tc_count, arch, is_coverage)
if ( module == None ):
instLog=open('install.log', 'a')