[common][tct-download-tizen-tests][change path for supporting global user] 80/111280/1
authorxy.qian <xy.qian@samsung.com>
Fri, 20 Jan 2017 05:25:14 +0000 (13:25 +0800)
committerxy.qian <xy.qian@samsung.com>
Fri, 20 Jan 2017 05:25:14 +0000 (13:25 +0800)
Change-Id: I258b37db4e70de084b2ea99176d54bccf6464c23
Signed-off-by: xy.qian <xy.qian@samsung.com>
common/tct-download-tizen-tests/inst.wgt.py

index b7d19b96a273f88bdf3118558a036d72a272c474..dccbfe5ebff1d5664bc1cfa5ee52c1d94f3c4e9e 100644 (file)
@@ -24,6 +24,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 getInternalStorage():
     global INTERNAL_STORAGE
@@ -31,8 +40,7 @@ def getInternalStorage():
         shell_mgr = ShellManager()
         shell_mgr.open_shellpipe(PARAMETERS.device.strip())
         #shell_mgr.open_shellpipe('0000d8dd00006200')
-        shell_mgr.write_cmd('export `tzplatform-get TZ_SYS_DEFAULT_USER`', '', None)
-        shell_mgr.write_cmd('export `tzplatform-get --user $TZ_SYS_DEFAULT_USER TZ_USER_CONTENT`','', None)
+        shell_mgr.write_cmd('export `tzplatform-get --user ' +PARAMETERS.user+' TZ_USER_CONTENT`', '', None)
         INTERNAL_STORAGE=shell_mgr.write_cmd('echo $TZ_USER_CONTENT','', None)
         INTERNAL_STORAGE=str(INTERNAL_STORAGE[len(INTERNAL_STORAGE)-1])
         print str(INTERNAL_STORAGE)
@@ -136,7 +144,7 @@ def uninstPKGs():
                     action_status = False
                     continue
                 (return_code, output) = doRemoteCMD(
-                    "pkgcmd -u -t wgt -q -n %s" % pkg_id)
+                    "pkgcmd %s -u -t wgt -q -n %s" % (GLOVAL_OPT, pkg_id))
                 for line in output:
                     if "Failure" in line:
                         action_status = False
@@ -169,7 +177,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:
@@ -213,7 +221,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"
 
@@ -230,6 +238,9 @@ def main():
     if not PARAMETERS.device:
         print "No device provided"
         sys.exit(1)
+
+    userCheck()
+
     print "1"
     getInternalStorage()
     print "2"