[TCT][TPK scripts][Non-ACR][Modified external wrapper for non-single processes]
authorShashank Shekhar Shukla <shekhar1.s@samsung.com>
Fri, 2 Sep 2016 11:36:39 +0000 (17:06 +0530)
committershobhit verma <shobhit.v@samsung.com>
Tue, 13 Sep 2016 06:40:16 +0000 (23:40 -0700)
Change-Id: Ic481c29a3910dd65d301523bda1c59d943287210
Signed-off-by: Shashank Shekhar Shukla <shekhar1.s@samsung.com>
scripts/tcbuild.sh
scripts/tcbuildsdk.sh
scripts_tpk/external_wrapper_non_single_process.sh [new file with mode: 0755]
scripts_tpk/tpk-install.py
scripts_tpk/tpksdk-install.py
templates/external_wrapper_non_single_process/external_wrapper.sh [new file with mode: 0755]

index 465c6910d733bc4032a29c73295af99bc44dc1f6..f4910b09a37d0b494a8debd7762a06495bb769fc 100755 (executable)
@@ -606,7 +606,11 @@ function inst {
                                cp templates/external_wrapper_asan/external_wrapper.sh /tmp/$TCT_DIR/
                        else
                                if [ $INSTALL_MODE == 0 ]; then
-                                       cp templates/external_wrapper_execution/external_wrapper.sh /tmp/$TCT_DIR/
+                                       if [[ $MOD_NAME == *"dali"* ]]; then
+                                               cp templates/external_wrapper_non_single_process/external_wrapper.sh /tmp/$TCT_DIR/
+                                       else
+                                               cp templates/external_wrapper_execution/external_wrapper.sh /tmp/$TCT_DIR/
+                                       fi
                                elif [ $INSTALL_MODE == 1 ]; then
                                        cp templates/external_wrapper_coverage/external_wrapper.sh /tmp/$TCT_DIR/
                                else
index e45089135358d4ba5930617b6eb1640e11b9528b..d9b80af702fe4a7e790ad30655bdf608172a54e3 100755 (executable)
@@ -607,7 +607,11 @@ function inst {
                                cp templates/external_wrapper_asan/external_wrapper.sh /tmp/$TCT_DIR/
                        else
                                if [ $INSTALL_MODE == 0 ]; then
-                                       cp templates/external_wrapper_execution/external_wrapper.sh /tmp/$TCT_DIR/
+                                       if [[ $MOD_NAME == *"dali"* ]]; then
+                                               cp templates/external_wrapper_non_single_process/external_wrapper.sh /tmp/$TCT_DIR/
+                                       else
+                                               cp templates/external_wrapper_execution/external_wrapper.sh /tmp/$TCT_DIR/
+                                       fi
                                elif [ $INSTALL_MODE == 1 ]; then
                                        cp templates/external_wrapper_coverage/external_wrapper.sh /tmp/$TCT_DIR/
                                else
diff --git a/scripts_tpk/external_wrapper_non_single_process.sh b/scripts_tpk/external_wrapper_non_single_process.sh
new file mode 100755 (executable)
index 0000000..f37c9ed
--- /dev/null
@@ -0,0 +1,125 @@
+
+
+#!/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"
+# 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_CORE=/tmp/utclog_core
+
+#Read timeout value from /tmp/TCT_Timeout.txt file
+if [ -f $FILE ];
+then
+       for next in `cat $FILE`
+       do
+           TIMEOUT_VALUE=$next
+       done
+fi
+
+function KillPackage {
+       pkgcmd --kill -n $1
+       sleep 2
+}
+
+
+function Execute {
+       rm -f $RESULT_PATH
+       rm -f $ERRLOG_PATH
+       rm -f $UTC_LOG_CORE
+
+       RET=`su -c "app_launcher -s $1 testcase_name $2" $DEVICE_EXECUTION_MODE_30`
+       if [[ $RET != *"successfully launched"* ]];then
+               su -c "app_launcher -k $1 > /dev/null" $DEVICE_EXECUTION_MODE_30
+               exit 1
+       fi
+
+       COUNTER=0
+       i=0
+       TIME_OUT=0
+       while [ ! -e $RESULT_PATH ];
+       do
+               if [ $COUNTER -eq $TIMEOUT_VALUE ];
+               then
+                       TIME_OUT=1
+                       break
+               fi
+               for i in {1..20}
+               do
+                       sleep 0.1
+                       RE=`su -c "app_launcher -r $1 " $DEVICE_EXECUTION_MODE_30`
+                       if [[ $RE == *"result: running"* ]];then
+                               continue
+                       else
+                               break
+                       fi
+               done
+               COUNTER=$(($COUNTER + 2))
+       done
+
+       su -c "app_launcher -k $1 > /dev/null" $DEVICE_EXECUTION_MODE_30
+       for i in {1..100}
+       do
+               sleep 0.1
+               RE=`su -c "app_launcher -r $1 " $DEVICE_EXECUTION_MODE_30`
+               if [[ $RE == *"result: running"* ]];then
+                       continue
+               else
+                       break
+               fi
+       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
+       if [[ $TIME_OUT == "1" ]];
+       then
+               exit 1
+       fi
+
+       exit `cat $RESULT_PATH`
+}
+
+
+Execute $1 $2
index 03b2ca9c250b200060886798657ddb1967bcf54b..329056e0b048e6da056eef796862b78dcf96782d 100755 (executable)
@@ -142,7 +142,11 @@ def install(TYPE, MODNAME, PROFILE):
                                sys.exit('Aborting...')
                        
                        # external_wrapper.sh
-                       shutil.copy('scripts_tpk'+dirSeparator+'external_wrapper.sh', dirSeparator+'tmp'+dirSeparator+TCT_DIR)
+                       process = "dali"
+                       if ( re.search(process, MODNAME) != None ):
+                               shutil.copy('scripts_tpk'+dirSeparator+'external_wrapper_non_single_process.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)
index 7644565a9da1d7db441cad679b61edc45f9b94b3..fd619259c42aad25ac538630cdb562d783305b7d 100755 (executable)
@@ -137,7 +137,11 @@ def install(TYPE, MODNAME, PROFILE):
                                sys.exit('Aborting...')
                        
                        # external_wrapper.sh
-                       shutil.copy('scripts_tpk'+dirSeparator+'external_wrapper.sh', dirSeparator+'tmp'+dirSeparator+TCT_DIR)
+                       process = "dali"
+                       if ( re.search(process, MODNAME) != None ):
+                               shutil.copy('scripts_tpk'+dirSeparator+'external_wrapper_non_single_process.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)
diff --git a/templates/external_wrapper_non_single_process/external_wrapper.sh b/templates/external_wrapper_non_single_process/external_wrapper.sh
new file mode 100755 (executable)
index 0000000..7e30672
--- /dev/null
@@ -0,0 +1,226 @@
+
+
+#!/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"
+UTC_LOG_CORE=/tmp/utclog_core
+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
+
+#Read timeout value from /tmp/TCT_Timeout.txt file
+
+if [ -f $FILE ];
+then
+       for next in `cat $FILE`
+       do
+           TIMEOUT_VALUE=$next
+       done
+fi
+
+
+function Execute {
+       RESULT_PATH=/tmp/tcresult
+       ERRLOG_PATH=/tmp/tclog
+       rm -f $RESULT_PATH
+       rm -f $ERRLOG_PATH
+       rm -f $UTC_LOG_CORE
+       
+       ## pre-launch script
+       if [ -f $SCRIPT_DIR/pre_launch.sh ];
+       then
+               bash $SCRIPT_DIR/pre_launch.sh $1 $3 $2
+       fi
+
+       RET=`su -c "app_launcher -s native.$1-$3 testcase_name $2" $DEVICE_EXECUTION_MODE_30`
+       if [[ $RET == *"successfully launched"* ]];then
+               echo "Successfully Launched"
+       
+       ## post-launch script
+       if [ -f $SCRIPT_DIR/post_launch.sh ];
+       then
+               bash $SCRIPT_DIR/post_launch.sh $1 $3 $2 
+       fi
+
+       else
+               echo "Launch Failed"
+               su -c "app_launcher -t native.$1-$3 > /dev/null" $DEVICE_EXECUTION_MODE_30
+               exit 1
+       fi
+
+       COUNTER=0
+       i=0
+       TIME_OUT=0
+       while [ ! -e $RESULT_PATH ];
+       do
+               if [ $COUNTER -eq $TIMEOUT_VALUE ];
+               then
+                       TIME_OUT=1
+                       break
+               fi
+               for i in {1..20}
+               do
+                       sleep 0.1
+                       RE=`su -c "app_launcher -r native.$1-$3 " $DEVICE_EXECUTION_MODE_30`
+                       if [[ $RE == *"result: running"* ]];then
+                               continue
+                       else
+                               break
+                       fi
+               done
+               COUNTER=$(($COUNTER + 2))
+       done
+
+       su -c "app_launcher -k native.$1-$3 > /dev/null" $DEVICE_EXECUTION_MODE_30
+       for i in {1..100}
+       do
+               sleep 0.1
+               RE=`su -c "app_launcher -r native.$1-$3 " $DEVICE_EXECUTION_MODE_30`
+               if [[ $RE == *"result: running"* ]];then
+                       continue
+               else
+                       break
+               fi
+       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
+       if [[ $TIME_OUT == "1" ]];
+       then
+               exit 1
+       fi
+               
+       exit `cat $RESULT_PATH`
+}
+
+function ExecuteUTC {
+       RESULT_PATH=/tmp/tcresult
+       ERRLOG_PATH=/tmp/utclog
+       rm -f $RESULT_PATH
+       rm -f $ERRLOG_PATH
+       rm -f $UTC_LOG_CORE
+
+       ## pre-launch script
+       if [ -f $SCRIPT_DIR/pre_launch.sh ];
+       then
+               bash $SCRIPT_DIR/pre_launch.sh $1 "utc" $2
+       fi
+
+       RET=`su -c "app_launcher -s core.$1-tests testcase_name $2" $DEVICE_EXECUTION_MODE_30`
+       if [[ $RET == *"successfully launched"* ]];then
+               echo "Successfully Launched"
+
+       ## post-launch script
+       if [ -f $SCRIPT_DIR/post_launch.sh ];
+       then
+               bash $SCRIPT_DIR/post_launch.sh $1 "utc" $2 
+       fi
+
+       else
+               echo "Launch Failed"
+               su -c "app_launcher -t core.$1-tests > /dev/null" $DEVICE_EXECUTION_MODE_30
+               exit 1
+       fi
+       COUNTER=0
+       i=0
+       TIME_OUT=0
+       while [ ! -e $RESULT_PATH ];
+       do
+               if [ $COUNTER -eq $TIMEOUT_VALUE ];
+               then
+                       TIME_OUT=1
+                       break
+               fi
+               for i in {1..20}
+               do
+                       sleep 0.1
+                       RE=`su -c "app_launcher -r core.$1-tests " $DEVICE_EXECUTION_MODE_30`
+                       if [[ $RE == *"result: running"* ]];then
+                               continue
+                       else
+                               break
+                       fi
+               done
+               COUNTER=$(($COUNTER + 2))
+       done
+
+       su -c "app_launcher -k native.$1-$3 > /dev/null" $DEVICE_EXECUTION_MODE_30
+       for i in {1..100}
+       do
+               sleep 0.1
+               RE=`su -c "app_launcher -r native.$1-$3 " $DEVICE_EXECUTION_MODE_30`
+               if [[ $RE == *"result: running"* ]];then
+                       continue
+               else
+                       break
+               fi
+       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
+       if [[ $TIME_OUT == "1" ]];
+       then
+               exit 1
+       fi
+       exit `cat $RESULT_PATH`
+}
+
+if [[ $3 == "itc" ]] || [[ $3 == "ctc" ]] ;then
+       Execute $1 $2 $3
+else
+       ExecuteUTC $1 $2
+fi
+
+
+
+
+
+