[common][tct-archive-tizen-tests][change info for supporting global user] 51/111451/1
authorwxch <xiaochn.wang@samsung.com>
Fri, 20 Jan 2017 09:49:30 +0000 (17:49 +0800)
committerwxch <xiaochn.wang@samsung.com>
Fri, 20 Jan 2017 09:51:59 +0000 (17:51 +0800)
Change-Id: Iadad3d9df7b73d36e0730c1e7c4750a2a8152e79
Signed-off-by: wxch <xiaochn.wang@samsung.com>
common/tct-archive-tizen-tests/archive/support/archive_common.js
common/tct-archive-tizen-tests/inst.wgt.py

index 1929294456772b743d64a5126e528d9b42bce0df..3370aa59b809f128d7f16b26f695ec268fcd0f1b 100644 (file)
@@ -25,19 +25,3 @@ var TEST_ARCHIVE_FILE_TXT = "downloads/file.txt";
 var TEST_ARCHIVE_FILE_TXT1 = "downloads/my_file.txt";
 var TEST_ARCHIVE_FILE_PATH = "downloads/";
 var TEST_ARCHIVE_READ_TXT = "downloads/read.txt";
-
-/*
-var TEST_ARCHIVE_FILE_ZIP = "wgt-package/opt/tct-archive-tizen-tests/archive/support/test.zip";
-var TEST_ARCHIVE_FILE_ZIP1 = "downloads/new_archive.zip";
-var TEST_ARCHIVE_FILE_TXT = "wgt-package/opt/tct-archive-tizen-tests/archive/support/file.txt";
-var TEST_ARCHIVE_FILE_TXT1 = "wgt-package/opt/tct-archive-tizen-tests/archive/support/my_file.txt";
-var TEST_ARCHIVE_FILE_PATH = "wgt-package/opt/tct-archive-tizen-tests/archive/support/";
-var TEST_ARCHIVE_READ_TXT = "wgt-package/opt/tct-archive-tizen-tests/archive/support/read.txt";
-
-var TEST_ARCHIVE_FILE_ZIP = "/home/owner/apps_rw/api1Arch01/res/wgt/opt/tct-archive-tizen-tests/resources/test.zip";
-var TEST_ARCHIVE_FILE_ZIP1 = "/home/owner/apps_rw/api1Arch01/res/wgt/opt/tct-archive-tizen-tests/resources/test1.zip";
-var TEST_ARCHIVE_FILE_TXT = "/home/owner/apps_rw/api1Arch01/res/wgt/opt/tct-archive-tizen-tests/resources/file.txt";
-var TEST_ARCHIVE_FILE_TXT1 = "/home/owner/apps_rw/api1Arch01/res/wgt/opt/tct-archive-tizen-tests/resources/my_file.txt";
-var TEST_ARCHIVE_FILE_PATH = "/home/owner/apps_rw/api1Arch01/res/wgt/opt/tct-archive-tizen-tests/resources/";
-var TEST_ARCHIVE_READ_TXT = "/home/owner/apps_rw/api1Arch01/res/wgt/opt/tct-archive-tizen-tests/resources/read.txt"
-*/
index d5b2ec68039a302e27ae296e1fdb9f62b2a2e14c..d6ff4d2e1b8944c678dd71a88281deb106d84406 100644 (file)
@@ -23,7 +23,15 @@ tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 USER_DIR = tct_parser.get('DEVICE', 'DEVICE_USER_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
@@ -42,8 +50,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)
@@ -95,7 +102,6 @@ def doCMD(cmd):
 
     return (cmd_return_code, output)
 
-
 def updateCMD(cmd=None):
     if "pkgcmd" in cmd:
         cmd = "su - %s -c '%s;%s'" % (PARAMETERS.user, XW_ENV, cmd)
@@ -110,8 +116,6 @@ def getUSERID():
     return doCMD(cmd)
 
 
-
-
 def getPKGID(pkg_name=None):
     if PARAMETERS.mode == "SDB":
         cmd = "sdb -s %s shell %s" % (
@@ -171,7 +175,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
@@ -205,7 +209,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:
@@ -246,7 +250,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"
 
@@ -264,6 +268,8 @@ def main():
         print "No device provided"
         sys.exit(1)
 
+    userCheck()
+
     getInternalStorage()
     #recordInternalStorage()
     user_info = getUSERID()