[common][sp02][change path for supporting global user] 96/111396/1
authorwei.ji <wei.ji@samsung.com>
Fri, 20 Jan 2017 07:43:51 +0000 (15:43 +0800)
committerwei.ji <wei.ji@samsung.com>
Fri, 20 Jan 2017 07:45:05 +0000 (15:45 +0800)
- change path for supporting global user in inst.wgt.py, .sh scripts and tests.xml

Change-Id: If762f5df2bf0ebdff79f2f4b37bba7db4459d236
Signed-off-by: wei.ji <wei.ji@samsung.com>
common/tct-sp02-wrt-tests/inst.wgt.py
common/tct-sp02-wrt-tests/scripts/wrt_sp02_installer.sh
common/tct-sp02-wrt-tests/scripts/wrt_sp02_localstorage_check.sh
common/tct-sp02-wrt-tests/scripts/xwalk_common.sh
common/tct-sp02-wrt-tests/tests.full.xml
common/tct-sp02-wrt-tests/tests.xml

index 7cdee07aa893194dbba83a48a6701bcf7be77b16..c33fe4085ac57475a036d72c3e18395d000b8a86 100755 (executable)
@@ -7,7 +7,7 @@ import time
 import sys
 import subprocess
 import string
-from optparse import OptionParser, make_option\r
+from optparse import OptionParser, make_option
 import ConfigParser
 
 
@@ -20,6 +20,15 @@ tct_parser = ConfigParser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
+EXECUTION_MODE_30 = tct_parser.get('DEVICE', 'DEVICE_EXECUTION_MODE_30')
+ADMIN_USER_30 = tct_parser.get('DEVICE', 'DEVICE_ADMIN_USER_30')
+
+def userCheck():
+    global GLOVAL_OPT
+    if ADMIN_USER_30 == EXECUTION_MODE_30:
+        GLOVAL_OPT="--global"
+    else:
+        GLOVAL_OPT=""
 
 
 def doCMD(cmd):
@@ -114,7 +123,7 @@ def uninstPKGs():
                     action_status = False
                     continue
                 (return_code, output) = doRemoteCMD(
-                    "pkgcmd -u -t wgt -q -n %s" % pkg_id)
+                    "pkgcmd %s -q -u -n %s" % (GLOVAL_OPT, pkg_id))
                 for line in output:
                     if "Failure" in line:
                         action_status = False
@@ -143,7 +152,7 @@ def instPKGs():
 #                if not doRemoteCopy(os.path.join(root, file), "%s/%s" % (SRC_DIR, file)):
 #                    action_status = False
 #                (return_code, output) = doRemoteCMD(
-#                    "pkgcmd -i -t wgt -q -p %s/%s" % (SRC_DIR, file))
+#                    "pkgcmd %s -i -t wgt -q -p %s/%s" % (GLOVAL_OPT, SRC_DIR, file))
 #                doRemoteCMD("rm -rf %s/%s" % (SRC_DIR, file))
 #                for line in output:
 #                    if "Failure" in line:
@@ -191,7 +200,7 @@ def main():
         sys.exit(1)
 
     if not PARAMETERS.user:
-        PARAMETERS.user = "owner"
+        PARAMETERS.user = EXECUTION_MODE_30
     if not PARAMETERS.mode:
         PARAMETERS.mode = "SDB"
 
@@ -208,7 +217,9 @@ def main():
     if not PARAMETERS.device:
         print "No device provided"
         sys.exit(1)
-
+    
+    userCheck()
+    
     user_info = getUSERID()
     re_code = user_info[0]
     if re_code == 0 :
index c7c7d189b57611f5a79d163256e3aa6a55b47bf7..e10fdfe1d3dd7cfe14b7888a94fab1f3367be455 100755 (executable)
@@ -48,6 +48,9 @@ if [ $pkgnum -ge 1 ]; then
     exit 1
   fi
 fi
+echo $PACKAGENAME
+echo $PACKAGENAME
+echo $PACKAGENAME
 install_app $PACKAGENAME
 find_app $APP_NAME
 pkgnum=`echo "$pkgids"|wc -w`
index 6c8aa1648052ca9894543118a028c6a73a2ba168..3bd028435d5e60984d09f2310f73097671a752b8 100755 (executable)
 #
 # Authors:
 #        Zhang Ge <gex.zhang@intel.com>
-
+TCT_CONFIG_FILE=/tmp/TCT_CONFIG
+if [ ! -f $TCT_CONFIG_FILE ];then
+       echo ""
+       echo "****************FATAL ERROR : inst.sh***************************"
+       echo "$TCT_CONFIG_FILE is not Found : Can Not Read TCT Configuration Directory"
+       echo "$PKG_NAME : INSTALLATION/UNINSTALLATION Can Not Proceed"
+       echo "********************************************************************"
+       echo ""
+       return;
+fi
+ADMIN_USER_30=`cat $TCT_CONFIG_FILE | grep DEVICE_ADMIN_USER_30 | cut -f 2- -d '='`
+if [[ $ADMIN_USER_30 == "" ]]; then
+       echo ""
+       echo "****************FATAL ERROR : inst.sh***************************"
+       echo "'DEVICE_ADMIN_USER_30' key-value pair is not Found"
+       echo "$PKG_NAME : INSTALLATION/UNINSTALLATION Can Not Proceed"
+       echo "********************************************************************"
+       echo ""
+       return;
+fi
+DEVICE_SUITE_TARGET_30=`cat $TCT_CONFIG_FILE | grep DEVICE_SUITE_TARGET_30 | cut -f 2- -d '='`
+if [ $DEVICE_SUITE_TARGET_30 == "" ]; then
+       echo ""
+       echo "****************FATAL ERROR : inst.sh***************************"
+       echo "'DEVICE_SUITE_TARGET_30' key-value pair is not Found"
+       echo "$PKG_NAME : INSTALLATION/UNINSTALLATION Can Not Proceed"
+       echo "********************************************************************"
+       echo ""
+       return;
+fi
+DEVICE_PHYSICAL_STORAGE_30=`cat $TCT_CONFIG_FILE | grep DEVICE_PHYSICAL_STORAGE_30 | cut -f 2- -d '='`
+if [ $DEVICE_PHYSICAL_STORAGE_30 == "" ]; then
+       echo ""
+       echo "****************FATAL ERROR : inst.sh***************************"
+       echo "'DEVICE_PHYSICAL_STORAGE_30' key-value pair is not Found"
+       echo "$PKG_NAME : INSTALLATION/UNINSTALLATION Can Not Proceed"
+       echo "********************************************************************"
+       echo ""
+       return;
+fi
+DEVICE_USER_30=`cat $TCT_CONFIG_FILE | grep DEVICE_USER_30 | cut -f 2- -d '='`
+if [[ $DEVICE_USER_30 == "" ]]; then
+       echo ""
+       echo "****************FATAL ERROR : inst.sh***************************"
+       echo "'DEVICE_USER_30' key-value pair is not Found"
+       echo "$PKG_NAME : INSTALLATION/UNINSTALLATION Can Not Proceed"
+       echo "********************************************************************"
+       echo ""
+       return;
+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 ""
+       echo "****************FATAL ERROR : inst.sh***************************"
+       echo "'DEVICE_EXECUTION_MODE_30' key-value pair is not Found"
+       echo "$PKG_NAME : INSTALLATION/UNINSTALLATION Can Not Proceed"
+       echo "********************************************************************"
+       echo ""
+       return;
+fi
+if [[ "$DEVICE_EXECUTION_MODE_30" == "$ADMIN_USER_30" ]]; then
+APPS_ROOT=`cat $TCT_CONFIG_FILE | grep DEVICE_ADMIN_USER_APPS_ROOT_30 | cut -f 2- -d '='`
+GLOBAL_OPT="--global"
+else
+APPS_ROOT=`cat $TCT_CONFIG_FILE | grep DEVICE_OTHER_USER_APPS_ROOT_30 | cut -f 2- -d '='`
+GLOBAL_OPT=""
+fi
+echo "ADMIN_USER_30 = $ADMIN_USER_30"
+echo "APPS_ROOT = $APPS_ROOT"
+if [ $APPS_ROOT == "" ]; then
+       echo ""
+       echo "****************FATAL ERROR : inst.sh***************************"
+       echo "'DEVICE_ADMIN(or OTHER)_USER_APPS_ROOT_30' key-value pair is not Found"
+       echo "$PKG_NAME : INSTALLATION/UNINSTALLATION Can Not Proceed"
+       echo "********************************************************************"
+       echo ""
+       return;
+fi
 path=$(dirname $(dirname $0))
 source $path/scripts/xwalk_common.sh
 APP_NAME="private_localstorage_check"
@@ -48,7 +125,10 @@ if [ -z "$appids" ]; then
   echo "Failed to get appid."
   exit 1
 fi
-widgetpath="/home/owner/apps_rw/$pkgids/res/wgt"
+widgetpath="$APPS_ROOT/$pkgids/res/wgt"
+echo $widgetpath
+echo $widgetpath
+echo $widgetpath
 if [ ! -d $widgetpath ]
 then
   existbh "The path of the application does not exist." 1
index 01491d0a7cc91c5ae4d1a0110af731cdba6d9cf8..8e24c5b662013fe39dea6e82ecf2f2d438653a9e 100755 (executable)
 
 #Authors:
 #        Lin, Wanming <wanmingx.lin@intel.com>
-
+TCT_CONFIG_FILE=/tmp/TCT_CONFIG
+if [ ! -f $TCT_CONFIG_FILE ];then
+       echo ""
+       echo "****************FATAL ERROR : inst.sh***************************"
+       echo "$TCT_CONFIG_FILE is not Found : Can Not Read TCT Configuration Directory"
+       echo "$PKG_NAME : INSTALLATION/UNINSTALLATION Can Not Proceed"
+       echo "********************************************************************"
+       echo ""
+       return;
+fi
+ADMIN_USER_30=`cat $TCT_CONFIG_FILE | grep DEVICE_ADMIN_USER_30 | cut -f 2- -d '='`
+if [[ $ADMIN_USER_30 == "" ]]; then
+       echo ""
+       echo "****************FATAL ERROR : inst.sh***************************"
+       echo "'DEVICE_ADMIN_USER_30' key-value pair is not Found"
+       echo "$PKG_NAME : INSTALLATION/UNINSTALLATION Can Not Proceed"
+       echo "********************************************************************"
+       echo ""
+       return;
+fi
+DEVICE_SUITE_TARGET_30=`cat $TCT_CONFIG_FILE | grep DEVICE_SUITE_TARGET_30 | cut -f 2- -d '='`
+if [ $DEVICE_SUITE_TARGET_30 == "" ]; then
+       echo ""
+       echo "****************FATAL ERROR : inst.sh***************************"
+       echo "'DEVICE_SUITE_TARGET_30' key-value pair is not Found"
+       echo "$PKG_NAME : INSTALLATION/UNINSTALLATION Can Not Proceed"
+       echo "********************************************************************"
+       echo ""
+       return;
+fi
+DEVICE_PHYSICAL_STORAGE_30=`cat $TCT_CONFIG_FILE | grep DEVICE_PHYSICAL_STORAGE_30 | cut -f 2- -d '='`
+if [ $DEVICE_PHYSICAL_STORAGE_30 == "" ]; then
+       echo ""
+       echo "****************FATAL ERROR : inst.sh***************************"
+       echo "'DEVICE_PHYSICAL_STORAGE_30' key-value pair is not Found"
+       echo "$PKG_NAME : INSTALLATION/UNINSTALLATION Can Not Proceed"
+       echo "********************************************************************"
+       echo ""
+       return;
+fi
+DEVICE_USER_30=`cat $TCT_CONFIG_FILE | grep DEVICE_USER_30 | cut -f 2- -d '='`
+if [[ $DEVICE_USER_30 == "" ]]; then
+       echo ""
+       echo "****************FATAL ERROR : inst.sh***************************"
+       echo "'DEVICE_USER_30' key-value pair is not Found"
+       echo "$PKG_NAME : INSTALLATION/UNINSTALLATION Can Not Proceed"
+       echo "********************************************************************"
+       echo ""
+       return;
+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 ""
+       echo "****************FATAL ERROR : inst.sh***************************"
+       echo "'DEVICE_EXECUTION_MODE_30' key-value pair is not Found"
+       echo "$PKG_NAME : INSTALLATION/UNINSTALLATION Can Not Proceed"
+       echo "********************************************************************"
+       echo ""
+       return;
+fi
+if [[ "$DEVICE_EXECUTION_MODE_30" == "$ADMIN_USER_30" ]]; then
+APPS_ROOT=`cat $TCT_CONFIG_FILE | grep DEVICE_ADMIN_USER_APPS_ROOT_30 | cut -f 2- -d '='`
+GLOBAL_OPT="--global"
+else
+APPS_ROOT=`cat $TCT_CONFIG_FILE | grep DEVICE_OTHER_USER_APPS_ROOT_30 | cut -f 2- -d '='`
+GLOBAL_OPT=""
+fi
+echo "ADMIN_USER_30 = $ADMIN_USER_30"
+echo "APPS_ROOT = $APPS_ROOT"
+if [ $APPS_ROOT == "" ]; then
+       echo ""
+       echo "****************FATAL ERROR : inst.sh***************************"
+       echo "'DEVICE_ADMIN(or OTHER)_USER_APPS_ROOT_30' key-value pair is not Found"
+       echo "$PKG_NAME : INSTALLATION/UNINSTALLATION Can Not Proceed"
+       echo "********************************************************************"
+       echo ""
+       return;
+fi
 ###below functions just for crosswalk ivi testing###
 
-##usage: install_app $app_path(e.g. uninstall_app /home/owner/share/tct/opt/tct-sp02-wrt-tests/tct-sp02-wrt-tests.wgt)##
+##usage: install_app $app_path(e.g. admin user: install_app /home/usr/globalapps/tct/opt/tct-sp02-wrt-tests/tct-sp02-wrt-tests.wgt
+                                                             ##local user: install_app /home/{user}/apps_rw/tct/opt/tct-sp02-wrt-tests/tct-sp02-wrt-tests.wgt)##
 function install_app(){
-    pkgcmd -i -t wgt -q -p $1
+    pkgcmd $GLOBAL_OPT -i -t wgt -q -p $1
 }
 
 ##usage: uninstall_app $app_name(e.g. uninstall_app tct-sp02-wrt-tests)##
@@ -40,7 +118,7 @@ function uninstall_app(){
     pkgids=`pkgcmd -l |grep $1 |awk -F "pkgid" '{print $2}' |awk -F '[' '{print $2}'|awk -F ']' '{print $1}'`
     for pkgid in $pkgids
     do
-        pkgcmd -u -n $pkgid -q
+        pkgcmd $GLOBAL_OPT -u -n $pkgid -q
     done
 }
 
index a002b59c22b5a4538abba50713112e98dd975dd4..9442f71d80f6225d67bad152cdb991d98b98ea1b 100755 (executable)
@@ -13,7 +13,7 @@
             <expected>Application has its own localStorage space.</expected>
           </step>
         </steps>
-        <test_script_entry test_script_expected_result="0">owner_user@/home/owner/share/tct/opt/tct-sp02-wrt-tests/scripts/wrt_sp02_localstorage_check.sh</test_script_entry>
+        <test_script_entry test_script_expected_result="0">{DEVICE_EXECUTION_MODE_30}_user@{DEVICE_SUITE_TARGET_30}/tct/opt/tct-sp02-wrt-tests/scripts/wrt_sp02_localstorage_check.sh</test_script_entry>
         <notes />
       </description>
       <specs>
index c0743af75b3f257f343a17e2529a618b49256984..fe85a791d5ceedc380da558fb09f24bb92116491 100755 (executable)
@@ -5,7 +5,7 @@
     <set name="SecurityPrivacy" type="script">
       <testcase component="Tizen WRT Core Spec/Security Privacy" execution_type="auto" id="private_localstorage_check" purpose="Check that Application has its own localStorage space.">
         <description>
-          <test_script_entry test_script_expected_result="0">owner_user@/home/owner/share/tct/opt/tct-sp02-wrt-tests/scripts/wrt_sp02_localstorage_check.sh</test_script_entry>
+          <test_script_entry test_script_expected_result="0">{DEVICE_EXECUTION_MODE_30}_user@{DEVICE_SUITE_TARGET_30}/tct/opt/tct-sp02-wrt-tests/scripts/wrt_sp02_localstorage_check.sh</test_script_entry>
         </description>
       </testcase>
     </set>