From: zhangwei Date: Sat, 21 Jan 2017 17:11:27 +0000 (+0800) Subject: [wearable][tct-badge-tizen-tests][Testcase sync from Suprem] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=62f9df2c5a1d96fc5f7d1c5ec2d634c7f2da0352;p=test%2Ftct%2Fweb%2Fapi.git [wearable][tct-badge-tizen-tests][Testcase sync from Suprem] Change-Id: I42a2df28d376a8bd95abf3f33dbc45fbfab1ffb7 Signed-off-by: zhangwei --- diff --git a/wearable/tct-badge-tizen-tests/inst.wgt.py b/wearable/tct-badge-tizen-tests/inst.wgt.py index 28b1eb42a..18690763e 100644 --- a/wearable/tct-badge-tizen-tests/inst.wgt.py +++ b/wearable/tct-badge-tizen-tests/inst.wgt.py @@ -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): @@ -107,6 +116,9 @@ def doRemoteCopy(src=None, dest=None): def uninstPKGs(): action_status = True for root, dirs, files in os.walk(SCRIPT_DIR): + if root.endswith("mediasrc"): + continue + for file in files: if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) @@ -114,7 +126,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 @@ -135,27 +147,31 @@ def instPKGs(): if return_code != 0: action_status = False for root, dirs, files in os.walk(SCRIPT_DIR): + if root.endswith("mediasrc"): + continue + for file in files: - if file.endswith("%s.wgt" % PKG_NAME): + if file.endswith(".wgt"): 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: action_status = False break - for item in glob.glob("%s/*" % SCRIPT_DIR): - if item.endswith(".wgt"): - continue - elif item.endswith("inst.py"): - continue - else: - item_name = os.path.basename(item) - if not doRemoteCopy(item, "%s/%s" % (PKG_SRC_DIR, item_name)): - action_status = False + # Do some special copy/delete... steps + ''' + (return_code, output) = doRemoteCMD( + "mkdir -p %s/tests" % PKG_SRC_DIR) + if return_code != 0: + action_status = False + + if not doRemoteCopy("specname/tests", "%s/tests" % PKG_SRC_DIR): + action_status = False + ''' return action_status @@ -181,7 +197,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" @@ -199,6 +215,8 @@ def main(): print "No device provided" sys.exit(1) + userCheck() + user_info = getUSERID() re_code = user_info[0] if re_code == 0 :