From: Sanghoon Lee Date: Tue, 20 Mar 2018 03:57:43 +0000 (+0900) Subject: [Tools][Non-ACR][Updated tct shell scripts] X-Git-Tag: public_m1_final~106 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6484a7c837cfcaf8895b54355bc8bb179592692f;p=test%2Ftct%2Fcsharp%2Fapi.git [Tools][Non-ACR][Updated tct shell scripts] Change-Id: I3be2eae0e23d337f318cd45e4d8e83d999f3bc99 --- diff --git a/release/csharp-tct_5.0_dotnet/csharp-tct_5.0_dotnet/tools/tct-config-device.py b/release/csharp-tct_5.0_dotnet/csharp-tct_5.0_dotnet/tools/tct-config-device.py index 7bd4234..796ecb7 100755 --- a/release/csharp-tct_5.0_dotnet/csharp-tct_5.0_dotnet/tools/tct-config-device.py +++ b/release/csharp-tct_5.0_dotnet/csharp-tct_5.0_dotnet/tools/tct-config-device.py @@ -43,7 +43,7 @@ PKGS_DIR = JOIN(CURENT_DIR, "package") DEVID = "" -TIZENV = "tizen_4.0" +TIZENV = "tizen_5.0" DLOG_CLEAR = "dlogutil -c" DLOG_UTIL = "sdb -s %s shell dlogutil -v time" @@ -56,7 +56,7 @@ DEVICE_SUITE_TARGET_24 = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_24') DEVICE_SUITE_TARGET_30 = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30') DEVICE_EXECUTION_MODE_30 = tct_parser.get('DEVICE', 'DEVICE_EXECUTION_MODE_30') -if TIZENV.find('tizen_4.0') > -1: +if TIZENV.find('tizen_5.0') > -1: DEVICE_SUITE_TARGET = DEVICE_SUITE_TARGET_30 else: DEVICE_SUITE_TARGET = DEVICE_SUITE_TARGET_24 @@ -127,7 +127,7 @@ def remove_stub(): def uninstall_testconfig(): - if TIZENV.find('tizen_4.0') > -1: + if TIZENV.find('tizen_5.0') > -1: inst_path = RESRC_DIR + os.sep + 'tct-testconfig' + os.sep + 'inst.py' SdbManager.hostCommand("python %s -s %s -u" % (inst_path, DEVID)) else: @@ -142,7 +142,7 @@ def uninstall_testconfig(): def uninstall_behavior(): print "info: Uninstall behavior tool." - if TIZENV.find('tizen_4.0') > -1: + if TIZENV.find('tizen_5.0') > -1: pass else: uninst_cmd = JOIN(DEVICE_SUITE_TARGET, 'tct/opt/tct-behavior-tests/inst.sh') + ' -u' @@ -260,7 +260,7 @@ def check_testconfig(): def install_testconfig(): print "info: Install testconfig." - if TIZENV.find('tizen_4.0') > -1: + if TIZENV.find('tizen_5.0') > -1: instPath = RESRC_DIR + os.sep + 'tct-testconfig' + os.sep + 'inst.py' SdbManager.hostCommand("python %s -s %s" % (instPath, DEVID)) else: @@ -286,8 +286,8 @@ def install_behavior(profile_name): print "#WARNING#: Invalid device profile value %s" % profile_name return False - if TIZENV.find('tizen_4.0') > -1: - RPMPKG = "tct-behavior-tests-3.0.zip" + if TIZENV.find('tizen_5.0') > -1: + RPMPKG = "tct-behavior-tests-5.0.zip" opt_rpm_path = PKGS_DIR + "s" + os.sep + profile_name + os.sep + RPMPKG local_rpm_path = PKGS_DIR + os.sep + profile_name + os.sep + RPMPKG @@ -327,7 +327,7 @@ def install_getCap(): widgetCap = LS(RESRC_DIR, 'getCap', 'wgt') SdbManager.sdbPush(DEVID, JOIN(RESRC_DIR, widgetCap), JOIN(DEVICE_SUITE_TARGET, 'tct/') + widgetCap) - if TIZENV.find('4.0') > -1: + if TIZENV.find('5.0') > -1: SdbManager.sdbShell(DEVID, "su - " + DEVICE_EXECUTION_MODE_30 + \ " -c 'pkgcmd -i -t wgt -q -p " + JOIN(DEVICE_SUITE_TARGET, 'tct/') + widgetCap + '\'') SdbManager.sdbShell(DEVID, 'pkgcmd -i -t wgt -q -p ' + JOIN(DEVICE_SUITE_TARGET, 'tct/') + widgetCap) @@ -338,7 +338,7 @@ def install_ngetCap(): getcap_pkg = LS(RESRC_DIR, 'getCap', 'tpk') SdbManager.sdbPush(DEVID, JOIN(RESRC_DIR, getcap_pkg), JOIN(DEVICE_SUITE_TARGET, 'tct/') + getcap_pkg) - if TIZENV.find('tizen_4.0') > -1: + if TIZENV.find('tizen_5.0') > -1: SdbManager.sdbShell(DEVID, "su - " + DEVICE_EXECUTION_MODE_30 + \ " -c 'pkgcmd -ipt tpk -p " + JOIN(DEVICE_SUITE_TARGET, 'tct/') + getcap_pkg + '\'') else: @@ -349,7 +349,7 @@ def uninstall_getCap(): wgt_id = getCap_appid() if wgt_id: uninst_cmd = "" - if TIZENV.find('tizen_4.0') > -1: + if TIZENV.find('tizen_5.0') > -1: uninst_cmd = "su - " + DEVICE_EXECUTION_MODE_30 + \ " -c 'pkgcmd -qun " + wgt_id.split('.')[0] + '\'' elif TIZENV.find('tizen_2.4') > -1: @@ -369,7 +369,7 @@ def uninstall_ngetCap(): def getCap_appid(): widgetid_cmd = "" - if TIZENV.find('tizen_4.0') > -1: + if TIZENV.find('tizen_5.0') > -1: widgetid_cmd = "su - " + DEVICE_EXECUTION_MODE_30 + \ " -c \"app_launcher -l | grep getCapabilities\"" else: @@ -404,7 +404,7 @@ def launch_getCap(): wgt_id = getCap_appid() if wgt_id: launchResult = None - if TIZENV.find('tizen_4.0') > -1: + if TIZENV.find('tizen_5.0') > -1: launchResult = SdbManager.sdbShell(DEVID, 'su - ' + \ DEVICE_EXECUTION_MODE_30 + ' -c \"app_launcher -s ' + wgt_id + '\"') else: @@ -436,7 +436,7 @@ def launch_getCap(): def launch_ngetCap(): launch_result = None - if TIZENV.find('tizen_4.0') > -1: + if TIZENV.find('tizen_5.0') > -1: launch_result = SdbManager.sdbShell(DEVID, 'su - ' + \ DEVICE_EXECUTION_MODE_30 + ' -c \"launch_app org.example.getcap\"') else: @@ -568,7 +568,7 @@ def runProcess(): kill_process("tinyweb") kill_process("testkit-stub") remove_stub() - if TIZENV.find('4.0') > -1: + if TIZENV.find('5.0') > -1: uninstall_storage() print "Clean the tct packages in device successfully." @@ -598,14 +598,14 @@ def runProcess(): check_ngetCap() else: check_getCap() - if TIZENV.find('4.0') > -1: + if TIZENV.find('5.0') > -1: check_storage() print "Check finished." elif options.bhtest: check_resource_dir() - if TIZENV.find('4.0') > -1: + if TIZENV.find('5.0') > -1: uninstall_storage() install_storage() launch_storage() @@ -640,7 +640,7 @@ def runProcess(): uninstall_testconfig() uninstall_getCap() uninstall_ngetCap() - if TIZENV.find('4.0') > -1: + if TIZENV.find('5.0') > -1: uninstall_storage() print "Clean the tct packages in device successfully." @@ -677,7 +677,7 @@ def runProcess(): install_getCap() launch_getCap() - if TIZENV.find('4.0') > -1: + if TIZENV.find('5.0') > -1: install_storage() launch_storage() diff --git a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/intention_generator.py b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/intention_generator.py index e620722..7ea93b2 100755 --- a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/intention_generator.py +++ b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/intention_generator.py @@ -168,7 +168,7 @@ def _parsTestScenario(scen_name, file_path, stubPort, skip_package, \ # return : TctShellSuite [] def _parsTestPlan(file_path, plan_name, deviceId, executeType, tizenVersion, \ resultFolder, stubPort, skip_package, skip_count, skip_tc, devmgr, \ - scen_name=None): + scen_name=None, make_ne_package=None): suites = [] profile = "" if not _verifyPlan(file_path, tizenVersion): @@ -193,12 +193,17 @@ def _parsTestPlan(file_path, plan_name, deviceId, executeType, tizenVersion, \ if skip_package and str(skip_package).find(packName) > -1: LOGGER.info("[skip package : %s]" % packName) else: + is_make_ne = False + if make_ne_package and str(make_ne_package).find(packName) > -1: + is_make_ne = True + suite = TctShellSuite(packName, None, \ xml_suite.find("auto_tcn").text, \ xml_suite.find("manual_tcn").text, \ xml_suite.find("pkg_name").text, \ xml_suite.get("launcher"), xml_suite.get("category"), \ - tizenVersion, skip_count, skip_tc, devmgr) + tizenVersion, skip_count, skip_tc, devmgr, \ + is_make_ne=is_make_ne) suites.append(suite) plan = TctShellPlan(plan_name, devmgr, deviceId, profile, executeType, \ @@ -213,7 +218,7 @@ def _parsTestPlan(file_path, plan_name, deviceId, executeType, tizenVersion, \ def _parsTestProfile(path_suites, deviceId, executeType, tizenV, profile, \ resultFolder, stubPort, skip_package, skip_count, skip_tc, devmgr, \ - distribute_count): + distribute_count, make_ne_package=None): suites = [] LOGGER.debug("Preparing Test Suite ") suite_profile = os.path.basename(os.path.dirname(path_suites[0])) @@ -238,9 +243,14 @@ def _parsTestProfile(path_suites, deviceId, executeType, tizenV, profile, \ elif auto_num == 0 and manual_num == 0: pass else: + is_make_ne = False + if make_ne_package and str(make_ne_package).find(suite_name) > -1: + is_make_ne = True + suite = TctShellSuite(suite_name, None, auto_num, manual_num, \ suite_pkg_name, suite_launcher, suite_category, \ - suite_tizenVer, skip_count, skip_tc, devmgr) + suite_tizenVer, skip_count, skip_tc, devmgr, \ + is_make_ne=is_make_ne) if not distribute_count: suites.append(suite) @@ -261,7 +271,8 @@ def _parsTestProfile(path_suites, deviceId, executeType, tizenV, profile, \ def _parsTestSuite(path_suites, deviceId, executeType, tizenVersion, tc_name, \ - resultFolder, stubPort, devmgr, skip_count=None, skip_tc=None): + resultFolder, stubPort, devmgr, skip_count=None, skip_tc=None, \ + make_ne_package=None): #type(suites) -> list suites = [] LOGGER.debug("Preparing Test Suite ") @@ -279,9 +290,16 @@ def _parsTestSuite(path_suites, deviceId, executeType, tizenVersion, tc_name, \ suite_tizenVer = tizenVersion suite_pkg_name = os.path.join(suite_profile, \ os.path.basename(suite_path)) + + is_make_ne = False + if make_ne_package and str(make_ne_package).find(suite_name) > -1: + is_make_ne = True + suite = TctShellSuite(suite_name, tc_name, auto_num, manual_num, \ suite_pkg_name, suite_launcher, suite_category, \ - suite_tizenVer, skip_count, skip_tc, devmgr) + suite_tizenVer, skip_count, skip_tc, devmgr, \ + is_make_ne=is_make_ne) + suites.append(suite) Constants.clean_unzip_file() @@ -306,7 +324,7 @@ def _parsTestCase(path_suites, deviceId, executeType, tizenVersion, \ def _parsAutoPlan(planFile, plan_name, executeType, tizenVer, \ resultFolderPath, stubPort, skip_package, skip_count, skip_tc, \ - devmgr): + devmgr, make_ne_package=None): if not _verifyPlan(planFile, tizenVer): LOGGER.warning("Please check the plan xml file: %s" % planFile) return None @@ -353,11 +371,16 @@ def _parsAutoPlan(planFile, plan_name, executeType, tizenVer, \ if skip_package and str(skip_package).find(suite_name) > -1: LOGGER.error("[skip package : %s]" % suite_name) else: - suite = TctShellSuite(xml_suite.get("name"), None, \ + is_make_ne = False + if make_ne_package and str(make_ne_package).find(suite_name) > -1: + is_make_ne = True + + suite = TctShellSuite(suite_name, None, \ xml_suite.find("auto_tcn").text, xml_suite.find("manual_tcn").text,\ xml_suite.find("pkg_name").text, xml_suite.get("launcher"), \ xml_suite.get("category"), tizenVer, skip_count, skip_tc, \ - devmgr) + devmgr, is_make_ne=is_make_ne) + suite.setExpectedTime(etime) if suite.suite_pkg_name is None: LOGGER.warning("suite: [%s] has missing information" \ @@ -378,7 +401,7 @@ def _parsAutoPlan(planFile, plan_name, executeType, tizenVer, \ def _parsResultForRerun(wrapper, skip_package, skip_count, skip_tc, devmgr, \ - distribute_count): + distribute_count, make_ne_package=None): result = wrapper.get_result_for_rerun() rerun_plan_creator = ResultSummary() rerun_data = rerun_plan_creator.prepareRerun(result) @@ -439,15 +462,20 @@ def _parsResultForRerun(wrapper, skip_package, skip_count, skip_tc, devmgr, \ if skip_package and str(skip_package).find(suite_name) > -1: LOGGER.error("[skip package : %s]" % suite_name) else: + is_make_ne = False + if make_ne_package and str(make_ne_package).find(suite_name) > -1: + is_make_ne = True + suite = TctShellSuite(suite_name, None, auto_num, manual_num, \ suite_pkg_name, suite_launcher, suite_category, \ - tizenVer, skip_count, skip_tc, devmgr) + tizenVer, skip_count, skip_tc, devmgr, \ + is_make_ne=is_make_ne) + if not distribute_count: suites.append(suite) elif dist_res: suites.append(suite) - plan = TctShellPlan(plan_name, devmgr, deviceId, profile, executeType, suites,\ tizenVer, resultFolderPath, wrapper.get_stubPort()) plan.setScenResultFolderPath(scen_resultFolderPath) @@ -514,11 +542,13 @@ class IntentionGenerator: skip_package = wrapper.get_skip_package() skip_count = wrapper.get_skip_count() skip_tc = wrapper.get_skip_tc() + make_ne_package = wrapper.get_make_ne() distribute_count = wrapper.get_distribute_count() if wrapper.get_running_mode() == Constants.RUNNING_MODE_RERUN: return _parsResultForRerun(wrapper, skip_package, skip_count, \ - skip_tc, devmgr, distribute_count) + skip_tc, devmgr, distribute_count, \ + make_ne_package=make_ne_package) intention_type = wrapper.getIntentionType() deviceId = None @@ -558,20 +588,20 @@ class IntentionGenerator: planFile = wrapper.get_planfile() plans = _parsTestPlan(planFile, name, deviceId, executeType, \ tizenVer, resultFolderPath, stubPort, skip_package, \ - skip_count, skip_tc, devmgr) + skip_count, skip_tc, devmgr, make_ne_package=make_ne_package) elif intention_type == IntentionType.TestCase: plans = _parsTestCase(suites, deviceId, executeType, tizenVer, \ tcId, resultFolderPath, stubPort, devmgr) elif intention_type == IntentionType.TestSuite: plans = _parsTestSuite(suites, deviceId, executeType, tizenVer, \ None, resultFolderPath, stubPort, devmgr, skip_count, \ - skip_tc) + skip_tc, make_ne_package=make_ne_package) elif intention_type == IntentionType.AutoPlan: name = wrapper.get_plan_name() autoFile = wrapper.get_autoplanfile() plans = _parsAutoPlan(autoFile, name, executeType, tizenVer, \ resultFolderPath, stubPort, skip_package, skip_count, \ - skip_tc, devmgr) + skip_tc, devmgr, make_ne_package=make_ne_package) elif intention_type == IntentionType.TestProfile: profile_suites = wrapper.get_profile_suites() if not profile_suites: @@ -579,6 +609,7 @@ class IntentionGenerator: profile = wrapper.get_profile() plans = _parsTestProfile(profile_suites, deviceId, executeType, \ tizenVer, profile, resultFolderPath, stubPort, \ - skip_package, skip_count, skip_tc, devmgr, distribute_count) + skip_package, skip_count, skip_tc, devmgr, distribute_count, \ + make_ne_package=make_ne_package) return plans diff --git a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/result_manager.py b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/result_manager.py index dc10476..40fee25 100755 --- a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/result_manager.py +++ b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/result_manager.py @@ -120,9 +120,13 @@ class ResultManager: def print_result_summaries(self): resultFolderPaths = [] + tizenV = None if self.plans: scen_resultFolderPath = None for plan in self.plans: + if tizenV is None: + tizenV = plan.getTizenVersion() + if plan.scen_resultFolderPath is None or \ not os.path.isdir(plan.scen_resultFolderPath): resultFolderPath = plan.getResultFolderPath() @@ -139,7 +143,8 @@ class ResultManager: (plan.getScenName(), resultFolderPath)) distribute = " --distribute" if Constants.isDistMode() else "" - rerun_command = "tct-shell --rerun-fail %s" + distribute + rerun_command = "tct-shell --tizen-version {0} --rerun-fail %s {1}".\ + format(tizenV, distribute) for result in resultFolderPaths: LOGGER.info("[%s] Rerun command: %s" \ % (result[0], rerun_command % result[1])) diff --git a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/result_summary.py b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/result_summary.py index 7a7f3d0..3b7d0e5 100755 --- a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/result_summary.py +++ b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/result_summary.py @@ -230,7 +230,7 @@ class ResultSummary: LOGGER.warning("[%s] suite does not exist." % (suiteName)) yesorno = None while not (yesorno in ['y', 'n']): - yesorno = raw_input(\ + yesorno = input(\ "Continue without this suite? [y/n]") if yesorno == 'n': LOGGER.warning("please check the default suite \ diff --git a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/sdbmanager.py b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/sdbmanager.py index b95ad43..de2274f 100755 --- a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/sdbmanager.py +++ b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/sdbmanager.py @@ -14,8 +14,12 @@ class SdbManager: @staticmethod def hostLiteCommand(command, failct=None): LOGGER.info(command) - proc = subprocess.Popen(command, shell=True, \ - stdout=subprocess.PIPE, stderr=subprocess.PIPE) + proc = subprocess.Popen(command, \ + shell=True, \ + bufsize=0, \ + stdin=subprocess.PIPE, \ + stdout=subprocess.PIPE, \ + stderr=subprocess.PIPE) curr_fail = 0 while True: @@ -138,8 +142,12 @@ class SdbManager: errs = None proc = None try: - proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, \ - stderr=subprocess.PIPE) + proc = subprocess.Popen(command, \ + shell=True, \ + bufsize=0, \ + stdin=subprocess.PIPE, \ + stdout=subprocess.PIPE, \ + stderr=subprocess.PIPE) outs, errs = proc.communicate(timeout=timeout) except subprocess.TimeoutExpired: exc = sys.exc_info() diff --git a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/shellguider.py b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/shellguider.py index 2fef182..7d1f4dc 100755 --- a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/shellguider.py +++ b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/shellguider.py @@ -216,7 +216,7 @@ class Guider: LOGGER.info("\nIf needed, please update %s file. " % (Constants.PRE_CONF_HOST_INI % str(self.deviceIds))) result = True while result: - next_step = raw_input("Continue to run test? [Yes/No]: ") + next_step = input("Continue to run test? [Yes/No]: ") if next_step and (next_step.lower() == "n" or next_step.lower() == "no"): self._exit(0) if next_step and (next_step.lower() == "yes" or next_step.lower() == "y"): diff --git a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/shellplanner.py b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/shellplanner.py index 2fe3c77..d9c0d6d 100755 --- a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/shellplanner.py +++ b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/shellplanner.py @@ -270,7 +270,13 @@ class TctShellPlan: def sortSuites(self): sorted_suites = [] suites = self.getSuites() + connection_suite = None for suite in suites: + suite_name = suite.getSuiteName() + if suite_name == 'tct-connection-native-utc': + connection_suite = suite + continue + autoCount = int(suite.getAutoNum()) category = suite.category if category and category.find('Runtime') > -1: @@ -281,6 +287,9 @@ class TctShellPlan: suite.setExpectedTime(etime) sorted_suites.append(suite) sorted_suites.sort(key=lambda x: x.expectedTime, reverse=True) + if connection_suite: + sorted_suites.append(connection_suite) + self.suites = sorted_suites @@ -295,7 +304,7 @@ class TctShellSuite: #PARAM tizenV = 'tizen_web_2.4' def __init__(self, suiteName, tcName, auto_num, manual_num, \ suite_pkg_name, launcher, category, tizenV, skip_count, skip_tc, \ - devmgr): + devmgr, is_make_ne=False): self.suiteName = suiteName self.tcName = tcName self.auto_num = auto_num @@ -312,12 +321,13 @@ class TctShellSuite: self.skip_count = skip_count self.skip_tc = skip_tc self.devmgr = devmgr + self.is_make_ne = is_make_ne def _liteCommand(self, deviceId, resultFolder, extype, \ tcName, isRerun, stubPort, isSkip=None, reverse_tests=None): lcmd = "" - if self.tizenV and (self.tizenV.find("web_3.0") > -1 or self.tizenV.find("web_4.0") > -1 or self.tizenV.find("web_5.0") > -1 or \ - self.tizenV.find("csharp_3.0") > -1 or self.tizenV.find("csharp_4.0") > -1 or self.tizenV.find("csharp_5.0") > -1): + if self.tizenV and \ + (self.tizenV.find("web") > -1 or self.tizenV.find("csharp") > -1): lcmd += Constants.LITE_CMD2 + " " else: lcmd += Constants.LITE_CMD1 + " " @@ -326,6 +336,15 @@ class TctShellSuite: if Constants.PRIORITY_VALUE: lcmd += Constants.PRIORITY + lcmd += Constants.LITE_DEVICE_PARAM + " " + + if isSkip: + lcmd += 'None' + " " + elif self.is_make_ne: + lcmd += 'NE_{}'.format(str(deviceId)) + " " + else: + lcmd += str(deviceId) + " " + if isRerun: lcmd += Constants.LOCAL_PRE lcmd += os.path.join(resultFolder, \ @@ -334,8 +353,7 @@ class TctShellSuite: lcmd += Constants.LOCAL_PRE lcmd += reverse_tests + " " else: - if self.tizenV.find('csharp_3.0') > -1 or self.tizenV.find('csharp_4.0') > -1 or self.tizenV.find('csharp_5.0') > -1 or \ - self.tizenV.find('web_3.0') > -1 or self.tizenV.find('web_4.0') > -1 or self.tizenV.find('web_5.0') > -1 or deviceId is None: + if self.tizenV.find('csharp') > -1 or self.tizenV.find('web') > -1 or deviceId is None: lcmd += Constants.LOCAL_PRE lcmd += (Constants.LOCAL_SHELL_TEMP_PATH % deviceId) lcmd += "opt/" + self.suiteName + "/" @@ -349,13 +367,6 @@ class TctShellSuite: lcmd += extype.toLiteParam() + " " lcmd += Constants.LITE_NON_ACTIVE_PARAM + " " - lcmd += Constants.LITE_DEVICE_PARAM + " " - - if isSkip: - lcmd += 'None' + " " - else: - lcmd += str(deviceId) + " " - if tcName is not None: lcmd += Constants.TESTCASE_ID + " " lcmd += tcName + " " @@ -372,8 +383,7 @@ class TctShellSuite: lcmd += str(tc) lcmd += " " - if self.tizenV and (self.tizenV.find("web_3.0") > -1 or self.tizenV.find("web_4.0") > -1 or self.tizenV.find("web_5.0") > -1 or \ - self.tizenV.find('csharp_3.0') > -1 or self.tizenV.find('csharp_4.0') > -1 or self.tizenV.find('csharp_5.0') > -1): + if self.tizenV and (self.tizenV.find("web") > -1 or self.tizenV.find('csharp') > -1): lcmd += Constants.EXT_TYPE_PARAM + " " lcmd += Constants.COMM_TYPE_PARAM + " " lcmd += Constants.ENV_TYPE_PARAM + " " @@ -439,23 +449,26 @@ class TctShellSuite: if line and len(line) > 0 and line.find(self.suiteName) > -1: proc_id = line.split()[1] SdbManager.hostCommand('kill -9 %s' % proc_id) - if self.tizenV and (self.tizenV.find("web_3.0") > -1 or self.tizenV.find("web_4.0") > -1 or self.tizenV.find("web_5.0") > -1 or \ - self.tizenV.find("csharp_3.0") > -1 or self.tizenV.find("csharp_4.0") > -1 or self.tizenV.find("csharp_5.0") > -1): + if self.tizenV and (self.tizenV.find("web") > -1 or self.tizenV.find("csharp") > -1): exCmd = self._liteCommand(deviceId, resultFolder, exeType, tcName, \ isRerun, stubport, True) SdbManager.hostRecLiteCommand(exCmd) else: - hostTmpFolder = Constants.LOCAL_SHELL_TEMP_PATH % None - localSuitePath = Constants.SUITES_REPOSITORY \ - % self.tizenV + self.suite_pkg_name - self._installSuiteinHost(None, localSuitePath, hostTmpFolder) - reverse_tests = hostTmpFolder + "opt/" + self.suiteName + "/tests.xml" + reverse_tests = self._naitve_installSuiteinHost() exCmd = self._liteCommand(deviceId, resultFolder, exeType, tcName, \ isRerun, stubport, True, reverse_tests) SdbManager.hostRecLiteCommand(exCmd) LOGGER.error("[skip package : %s]" % self.suiteName) break + def _native_installSuiteinHost(self): + hostTmpFolder = Constants.LOCAL_SHELL_TEMP_PATH % None + localSuitePath = Constants.SUITES_REPOSITORY \ + % self.tizenV + self.suite_pkg_name + self._installSuiteinHost(None, localSuitePath, hostTmpFolder) + tmp_suite = hostTmpFolder + "opt/" + self.suiteName + "/tests.xml" + return tmp_suite + def getSuitePackageName(self): return self.suite_pkg_name @@ -567,8 +580,8 @@ class TctShellSuite: % self.tizenV + self.suite_pkg_name instResult = True - if self.tizenV.find("csharp_3.0") > -1 or self.tizenV.find("csharp_4.0") > -1 or self.tizenV.find("csharp_5.0") > -1 or \ - self.tizenV.find("web_3.0") > -1 or self.tizenV.find("web_4.0") > -1 or self.tizenV.find("web_5.0") > -1 or deviceId is None: + if self.tizenV.find("csharp") > -1 or \ + self.tizenV.find("web") > -1 or deviceId is None: hostTmpFolder = Constants.LOCAL_SHELL_TEMP_PATH % deviceId instResult = self._installSuiteinHost(\ deviceId, localSuitePath, hostTmpFolder) @@ -617,8 +630,7 @@ class TctShellSuite: return False def unInstallSuite(self, deviceId, remoteFolder): - if self.tizenV.find("csharp_3.0") > -1 or self.tizenV.find("csharp_4.0") > -1 or self.tizenV.find("csharp_5.0") > -1 or \ - self.tizenV.find("web_3.0") > -1 or self.tizenV.find("web_4.0") > -1 or self.tizenV.find("web_5.0") > -1 or deviceId is None: + if self.tizenV.find("csharp") > -1 or self.tizenV.find("web") > -1 or deviceId is None: hostTmpFolder = Constants.LOCAL_SHELL_TEMP_PATH % deviceId self._unInstallSuiteInHost(deviceId, hostTmpFolder) else: diff --git a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/shellwrapper.py b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/shellwrapper.py index 7122c2f..1be4700 100755 --- a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/shellwrapper.py +++ b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/shellwrapper.py @@ -182,6 +182,8 @@ class ShellWrapper: callback=varnarg, help="Set the end time of test (unit : minute"), make_option("--skip-package", dest="skip_package", action="callback", \ callback=varnarg, help="Specify the package names for exclude from the test"), + make_option("--make-ne", dest="make_ne", action="callback", \ + callback=varnarg, help="Spectify the package names for make NE of results"), make_option("--skip-count", dest="skip_count", action="callback", \ callback=varnarg, help="Specify the fail/block/na count. The test is terminated when the same skip-count value and fail/block/na count on the result"), make_option("--skip-tc", dest="skip_tc", action="callback", \ @@ -355,6 +357,9 @@ class ShellWrapper: if self.options.trackingdump and len(self.options.trackingdump) > 0: if not self.check_tracking_dump(): opt = "--tracking-dump" + if self.options.make_ne and len(self.options.make_ne) > 0: + if not self.check_make_ne(): + opt = "--make-ne" if len(opt) > 0: os.system("tct-shell -h") @@ -393,6 +398,8 @@ class ShellWrapper: opt = "--make-summary" elif self.options.trackingdump is not None and len(self.options.trackingdump) < 1: opt = "--tracking-dump" + elif self.options.make_ne is not None and len(self.options.make_ne) < 1: + opt = "--make-ne" if len(opt) > 0: os.system("tct-shell -h") @@ -455,6 +462,11 @@ class ShellWrapper: def check_makesummary(self): return os.path.exists(self.options.makesummary[0]) + def check_make_ne(self): + packages = self.options.make_ne[0] + packLen = len(packages) + return packLen > 0 + def getIntentionType(self): if self.options.scenario_file is not None: return IntentionType.TestScenario @@ -673,6 +685,10 @@ class ShellWrapper: def get_tracking_dump(self): if (self.options.trackingdump is not None) and (self.options.trackingdump[0] is not None): return self.options.trackingdump[0] + + def get_make_ne(self): + if self.options.make_ne is not None: + return self.options.make_ne def is_testplan_mode(self): return self.options.testplan_file is not None diff --git a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/commodule/autoexec.py b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/commodule/autoexec.py index 9900476..240b6c3 100755 --- a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/commodule/autoexec.py +++ b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/commodule/autoexec.py @@ -35,8 +35,10 @@ def shell_command(cmd, timeout=15): """shell communication for quick return in sync mode""" proc = subprocess.Popen(cmd, shell=True, + bufsize=0, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + stderr=subprocess.PIPE, + stdin=subprocess.PIPE) time_cnt = 0 exit_code = None while time_cnt < timeout: @@ -66,8 +68,10 @@ def shell_command_ext(cmd="", """ cmd_open = subprocess.Popen(args=cmd, shell=True, + bufsize=0, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + stderr=subprocess.PIPE, + stdin=subprocess.PIPE) while True: exit_code = cmd_open.poll() diff --git a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/commodule/impl/tizenmobile.py b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/commodule/impl/tizenmobile.py index d5da8c1..3d27b25 100755 --- a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/commodule/impl/tizenmobile.py +++ b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/commodule/impl/tizenmobile.py @@ -30,6 +30,7 @@ import re import shutil import ConfigParser import platform +import xml.etree.ElementTree as etree from commodule.log import LOGGER from commodule.autoexec import shell_command, shell_command_ext @@ -40,6 +41,7 @@ tct_parser = ConfigParser.ConfigParser() tct_parser.read(TCT_CONFIG_FILE) DEVICE_SUITE_TARGET_24 = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_24') +DEVICE_SUITE_TARGET_30 = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30') LOCAL_HOST_NS = "127.0.0.1" RPM_INSTALL = "sdb -s %s shell rpm -ivh %s" @@ -108,8 +110,19 @@ class TizenMobile: def __init__(self, device_id=None): self.deviceid = device_id + self.is_NE = False + if self.deviceid and self.deviceid.find('NE_') > -1: + self.deviceid = self.deviceid.replace('NE_', '') + self.is_NE = True + self._wrt = False + def is_NE_mode(self): + return self.is_NE + + def get_devid(self): + return self.deviceid + def shell_cmd(self, cmd="", timeout=15): cmdline = "sdb -s %s shell \"%s\" " % (self.deviceid, cmd) return shell_command(cmdline, timeout) @@ -131,6 +144,7 @@ class TizenMobile: boutput=False, stdout_file=None, stderr_file=None): + cmdline = SDB_COMMAND_RTN % ( self.deviceid, cmd) return shell_command_ext(cmdline, timeout, boutput, \ @@ -183,6 +197,7 @@ class TizenMobile: build_id_str = line.split('=')[1].strip('\"\r\n') os_version_str = os_version_str[0:-1] + device_info["device_id"] = self.deviceid device_info["resolution"] = resolution_str device_info["screen_size"] = screen_size_str @@ -192,6 +207,48 @@ class TizenMobile: device_info["build_id"] = build_id_str return device_info + def get_buildinfo(self, _tizenV): + """ get builf info""" + device_file = "" + if _tizenV and _tizenV.find("3.0") > -1: + device_file = DEVICE_SUITE_TARGET_30 + '/Documents/tct/buildinfo.xml' + elif _tizenV and _tizenV.find("4.0") > -1: + device_file = DEVICE_SUITE_TARGET_30 + '/Documents/tct/buildinfo.xml' + elif _tizenV and _tizenV.find("5.0") > -1: + device_file = DEVICE_SUITE_TARGET_30 + '/Documents/tct/buildinfo.xml' + else: + device_file = DEVICE_SUITE_TARGET_24 + '/Documents/tct/buildinfo.xml' + + builfinfo_file = '/opt/testkit/lite2.4/' + self.deviceid + '/buildinfo.xml' + build_info = {} + build_info['buildid'] = '' + build_info['manufacturer'] = '' + build_info['model'] = '' + + if self.download_file(device_file, builfinfo_file) \ + and os.path.exists(builfinfo_file): + root = etree.parse(builfinfo_file).getroot() + for element in root.findall("buildinfo"): + if element is not None: + if element.get("name").lower() == 'buildversion': + child = etree.Element.getchildren(element) + if child and child[0].text: + buildid = child[0].text + build_info['buildid'] = buildid + if element.get("name").lower() == 'manufacturer': + child = etree.Element.getchildren(element) + if child and child[0].text: + manufacturer = child[0].text + build_info['manufacturer'] = manufacturer + if element.get("name").lower() == 'model': + child = etree.Element.getchildren(element) + if child and child[0].text: + model = child[0].text + build_info['model'] = model + os.remove(builfinfo_file) + return build_info + + def get_server_url(self, remote_port="8000"): """forward request a host tcp port to targe tcp port""" if remote_port is None: @@ -225,6 +282,7 @@ class TizenMobile: def download_file(self, remote_path, local_path): """download file from device""" + local_path_dir = os.path.dirname(local_path) if not os.path.exists(local_path_dir): os.makedirs(local_path_dir) @@ -331,9 +389,11 @@ class TizenMobile: cmd = RPM_LIST % self.deviceid exit_code, ret = shell_command(cmd) return ret - + def start_debug(self, dlogfile): global debug_flag, metux + if self.is_NE_mode(): + return debug_flag = True metux = threading.Lock() cmdline = DLOG_CLEAR % self.deviceid @@ -346,6 +406,9 @@ class TizenMobile: def stop_debug(self): global debug_flag, metux + if self.is_NE_mode(): + return + metux.acquire() debug_flag = False metux.release() diff --git a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/testkitlite/engines/default/runner.py b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/testkitlite/engines/default/runner.py index 2074417..0d52646 100755 --- a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/testkitlite/engines/default/runner.py +++ b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/testkitlite/engines/default/runner.py @@ -610,26 +610,19 @@ class TRunner: def __get_environment(self): """ get environment """ device_info = self.connector.get_device_info() - build_infos = get_buildinfo(self.connector, self.deviceid, self.tizenV) + build_info = self.connector.get_buildinfo(self.tizenV) # add environment node environment = etree.Element('environment') - - if device_info["device_id"] is None: - index_key = ''.join(random.choice(string.ascii_uppercase) \ - for i in range(12)) - environment.attrib['device_id'] = index_key - else: - environment.attrib['device_id'] = device_info["device_id"] - + environment.attrib['device_id'] = device_info['device_id'] environment.attrib['device_model'] = device_info["device_model"] environment.attrib['device_name'] = device_info["device_name"] - environment.attrib['build_id'] = build_infos['buildid'] + environment.attrib['build_id'] = build_info['buildid'] environment.attrib['host'] = platform.platform() environment.attrib['resolution'] = device_info["resolution"] environment.attrib['screen_size'] = device_info["screen_size"] - environment.attrib['device_model'] = build_infos['model'] - environment.attrib['manufacturer'] = build_infos['manufacturer'] + environment.attrib['device_model'] = build_info['model'] + environment.attrib['manufacturer'] = build_info['manufacturer'] other = etree.Element('other') other.text = "" environment.append(other) @@ -1199,42 +1192,3 @@ def write_json_result(set_result_xml, set_result): LOGGER.error( "[ Error: fail to write cases result, error: %s ]\n" % error) - -def get_buildinfo(conn, deviceid, _tizenV): - """ get builf info""" - device_file = "" - if _tizenV and _tizenV.find("native_3.0") > -1: - device_file = DEVICE_SUITE_TARGET_30 + '/Documents/tct/buildinfo.xml' - elif _tizenV and _tizenV.find("native_4.0") > -1: - device_file = DEVICE_SUITE_TARGET_30 + '/Documents/tct/buildinfo.xml' - else: - device_file = DEVICE_SUITE_TARGET_24 + '/Documents/tct/buildinfo.xml' - - builfinfo_file = '/opt/testkit/lite2.4/' + deviceid + '/buildinfo.xml' - build_info = {} - build_info['buildid'] = '' - build_info['manufacturer'] = '' - build_info['model'] = '' - - if conn.download_file(device_file, builfinfo_file) \ - and EXISTS(builfinfo_file): - root = etree.parse(builfinfo_file).getroot() - for element in root.findall("buildinfo"): - if element is not None: - if element.get("name").lower() == 'buildversion': - child = etree.Element.getchildren(element) - if child and child[0].text: - buildid = child[0].text - build_info['buildid'] = buildid - if element.get("name").lower() == 'manufacturer': - child = etree.Element.getchildren(element) - if child and child[0].text: - manufacturer = child[0].text - build_info['manufacturer'] = manufacturer - if element.get("name").lower() == 'model': - child = etree.Element.getchildren(element) - if child and child[0].text: - model = child[0].text - build_info['model'] = model - os.remove(builfinfo_file) - return build_info diff --git a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/testkitlite/engines/default/worker.py b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/testkitlite/engines/default/worker.py index 57638b1..8d9dc04 100755 --- a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/testkitlite/engines/default/worker.py +++ b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/testkitlite/engines/default/worker.py @@ -570,8 +570,28 @@ class TestWorker(object): self.result_obj = TestSetResut( self.opts['testsuite_name'], self.opts['testset_name']) + cases, exetype, ctype = test_set[ "cases"], test_set["exetype"], test_set["type"] + + devid = self.conn.get_devid() + if self.conn.is_NE_mode() or (devid and devid.find('None') > -1): + result_list = [] + for case in cases: + test_case = {} + test_case['case_id'] = case['case_id'] + test_case['result'] = 'N/A' + if devid.find('None') > -1: + test_case['stdout'] = "target not found" + else: + test_case['stdout'] = 'precondition failed' + + result_list.append(test_case) + + self.result_obj.extend_result(result_list) + self.result_obj.set_status(1) + return True + if self.opts['test_type'] == "webapi": return self.__run_web_test(sessionid, \ self.opts['testset_name'], exetype, ctype, cases) diff --git a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite2.0/testkitlite/commodule/tizenmobile.py b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite2.0/testkitlite/commodule/tizenmobile.py index 951aae9..cbc7513 100755 --- a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite2.0/testkitlite/commodule/tizenmobile.py +++ b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite2.0/testkitlite/commodule/tizenmobile.py @@ -166,6 +166,10 @@ class TizenMobile: def __init__(self, device_id=None): self.deviceid = device_id + self.is_NE = False + if self.deviceid and str(self.deviceid).find('NE_') > -1: + self.deviceid = self.deviceid.replace('NE_', '') + self.is_NE = True self._wrt = False self._xwalk = False self.support_remote = True @@ -174,6 +178,12 @@ class TizenMobile: #default user is changed "app" to "owner" #jh0219.han@samsung.com + def is_NE_mode(self): + return self.is_NE + + def get_devid(self): + return self.deviceid + def get_user_id(self): if TIZEN_USER == 'owner': self.port = '5000' @@ -190,7 +200,6 @@ class TizenMobile: def shell_cmd(self, cmd="", timeout=15): cmdline = SDB_COMMAND % (self.deviceid, cmd) - #print "cmdline : " , cmdline return shell_command(cmdline, timeout) def check_process(self, process_name): @@ -488,6 +497,8 @@ class TizenMobile: def start_debug(self, dlogfile): global debug_flag, metux + if self.is_NE_mode(): + return debug_flag = True metux = threading.Lock() cmdline = DLOG_CLEAR % self.deviceid @@ -499,6 +510,8 @@ class TizenMobile: def stop_debug(self): global debug_flag, metux + if self.is_NE_mode(): + return metux.acquire() debug_flag = False metux.release() @@ -580,11 +593,11 @@ class TizenMobile: exit_code, ret = shell_command(cmd) return True - def get_buildinfo(self, deviceid, _tizenV): + def get_buildinfo(self, _tizenV): """ get builf info""" device_file = DEVICE_SUITE_TARGET_30 + '/Documents/tct/buildinfo.xml' - buildinfo_file = '/opt/testkit/lite3.0/' + deviceid + '/buildinfo.xml' + buildinfo_file = '/opt/testkit/lite3.0/' + self.deviceid + '/buildinfo.xml' build_info = {} build_info['buildid'] = '' build_info['manufacturer'] = '' diff --git a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite2.0/testkitlite/engines/default.py b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite2.0/testkitlite/engines/default.py index 8643f01..d18a0db 100755 --- a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite2.0/testkitlite/engines/default.py +++ b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite2.0/testkitlite/engines/default.py @@ -561,8 +561,28 @@ class TestWorker(object): else: self.conn.start_debug(self.opts['debug_log_base']) time.sleep(1) + self.result_obj = TestSetResut( self.opts['testsuite_name'], self.opts['testset_name']) + + devid = self.conn.get_devid() + if self.conn.is_NE_mode() or (devid and devid.find('None') > -1): + result_list = [] + for case in cases: + test_case = {} + test_case['case_id'] = case['case_id'] + test_case['result'] = 'N/A' + if devid.find('None') > -1: + test_case['stdout'] = "target not found" + else: + test_case['stdout'] = 'precondition failed' + + result_list.append(test_case) + + self.result_obj.extend_result(result_list) + self.result_obj.set_status(1) + return True + if self.opts['test_type'] == "webapi": if ctype == 'ref': exetype = 'manual' diff --git a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite2.0/testkitlite/util/session.py b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite2.0/testkitlite/util/session.py index 5ca81d9..c9b4630 100755 --- a/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite2.0/testkitlite/util/session.py +++ b/release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite2.0/testkitlite/util/session.py @@ -774,7 +774,7 @@ class TestSession: def __get_environment(self): """ get environment """ device_info = self.connector.get_device_info() - build_infos = self.connector.get_buildinfo(self.deviceid, self.tizenV) + build_infos = self.connector.get_buildinfo(self.tizenV) # add environment node environment = etree.Element('environment') environment.attrib['device_id'] = device_info["device_id"]