[Tools][Non-ACR][Updated tct shell scripts] 95/173195/1
authorSanghoon Lee <shooney.lee@samsung.com>
Tue, 20 Mar 2018 03:57:43 +0000 (12:57 +0900)
committerSanghoon Lee <shooney.lee@samsung.com>
Tue, 20 Mar 2018 03:57:43 +0000 (12:57 +0900)
Change-Id: I3be2eae0e23d337f318cd45e4d8e83d999f3bc99

15 files changed:
release/csharp-tct_5.0_dotnet/csharp-tct_5.0_dotnet/tools/tct-config-device.py
release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/intention_generator.py
release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/result_manager.py
release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/result_summary.py
release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/sdbmanager.py
release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/shellguider.py
release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/shellplanner.py
release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/shellwrapper.py
release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/commodule/autoexec.py
release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/commodule/impl/tizenmobile.py
release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/testkitlite/engines/default/runner.py
release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/testkitlite/engines/default/worker.py
release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite2.0/testkitlite/commodule/tizenmobile.py
release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite2.0/testkitlite/engines/default.py
release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite2.0/testkitlite/util/session.py

index 7bd4234..796ecb7 100755 (executable)
@@ -43,7 +43,7 @@ PKGS_DIR = JOIN(CURENT_DIR, "package")
 \r
 DEVID = ""\r
 \r
-TIZENV = "tizen_4.0"\r
+TIZENV = "tizen_5.0"\r
 \r
 DLOG_CLEAR = "dlogutil -c"\r
 DLOG_UTIL = "sdb -s %s shell dlogutil -v time"\r
@@ -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')\r
 DEVICE_EXECUTION_MODE_30 = tct_parser.get('DEVICE', 'DEVICE_EXECUTION_MODE_30')\r
 \r
-if TIZENV.find('tizen_4.0') > -1:\r
+if TIZENV.find('tizen_5.0') > -1:\r
     DEVICE_SUITE_TARGET = DEVICE_SUITE_TARGET_30\r
 else:\r
     DEVICE_SUITE_TARGET = DEVICE_SUITE_TARGET_24\r
@@ -127,7 +127,7 @@ def remove_stub():
 \r
 \r
 def uninstall_testconfig():\r
-    if TIZENV.find('tizen_4.0') > -1:\r
+    if TIZENV.find('tizen_5.0') > -1:\r
         inst_path = RESRC_DIR + os.sep + 'tct-testconfig' + os.sep + 'inst.py'\r
         SdbManager.hostCommand("python %s -s %s -u" % (inst_path, DEVID))\r
     else:\r
@@ -142,7 +142,7 @@ def uninstall_testconfig():
 \r
 def uninstall_behavior():\r
     print "info: Uninstall behavior tool."\r
-    if TIZENV.find('tizen_4.0') > -1:\r
+    if TIZENV.find('tizen_5.0') > -1:\r
         pass\r
     else:\r
         uninst_cmd = JOIN(DEVICE_SUITE_TARGET, 'tct/opt/tct-behavior-tests/inst.sh') + ' -u'\r
@@ -260,7 +260,7 @@ def check_testconfig():
 \r
 def install_testconfig():\r
     print "info: Install testconfig."\r
-    if TIZENV.find('tizen_4.0') > -1:\r
+    if TIZENV.find('tizen_5.0') > -1:\r
         instPath = RESRC_DIR + os.sep + 'tct-testconfig' + os.sep + 'inst.py'\r
         SdbManager.hostCommand("python %s -s %s" % (instPath, DEVID))\r
     else:\r
@@ -286,8 +286,8 @@ def install_behavior(profile_name):
         print "#WARNING#: Invalid device profile value %s" % profile_name\r
         return False\r
 \r
-    if TIZENV.find('tizen_4.0') > -1:\r
-        RPMPKG = "tct-behavior-tests-3.0.zip"\r
+    if TIZENV.find('tizen_5.0') > -1:\r
+        RPMPKG = "tct-behavior-tests-5.0.zip"\r
         opt_rpm_path = PKGS_DIR + "s" + os.sep + profile_name + os.sep + RPMPKG\r
         local_rpm_path = PKGS_DIR + os.sep + profile_name + os.sep + RPMPKG\r
 \r
@@ -327,7 +327,7 @@ def install_getCap():
     widgetCap = LS(RESRC_DIR, 'getCap', 'wgt')\r
     SdbManager.sdbPush(DEVID, JOIN(RESRC_DIR, widgetCap), JOIN(DEVICE_SUITE_TARGET, 'tct/') + widgetCap)\r
 \r
-    if TIZENV.find('4.0') > -1:\r
+    if TIZENV.find('5.0') > -1:\r
         SdbManager.sdbShell(DEVID, "su - " + DEVICE_EXECUTION_MODE_30 + \\r
                 " -c 'pkgcmd -i -t wgt -q -p " + JOIN(DEVICE_SUITE_TARGET, 'tct/') + widgetCap + '\'')\r
         SdbManager.sdbShell(DEVID, 'pkgcmd -i -t wgt -q -p ' + JOIN(DEVICE_SUITE_TARGET, 'tct/') + widgetCap)\r
@@ -338,7 +338,7 @@ def install_ngetCap():
     getcap_pkg = LS(RESRC_DIR, 'getCap', 'tpk')\r
     SdbManager.sdbPush(DEVID, JOIN(RESRC_DIR, getcap_pkg), JOIN(DEVICE_SUITE_TARGET, 'tct/') + getcap_pkg)\r
 \r
-    if TIZENV.find('tizen_4.0') > -1:\r
+    if TIZENV.find('tizen_5.0') > -1:\r
         SdbManager.sdbShell(DEVID, "su - " + DEVICE_EXECUTION_MODE_30 + \\r
                 " -c 'pkgcmd -ipt tpk -p " + JOIN(DEVICE_SUITE_TARGET, 'tct/') + getcap_pkg + '\'')\r
     else:\r
@@ -349,7 +349,7 @@ def uninstall_getCap():
     wgt_id = getCap_appid()\r
     if wgt_id:\r
         uninst_cmd = ""\r
-        if TIZENV.find('tizen_4.0') > -1:\r
+        if TIZENV.find('tizen_5.0') > -1:\r
             uninst_cmd = "su - " + DEVICE_EXECUTION_MODE_30 + \\r
                     " -c 'pkgcmd -qun " + wgt_id.split('.')[0] + '\''\r
         elif TIZENV.find('tizen_2.4') > -1:\r
@@ -369,7 +369,7 @@ def uninstall_ngetCap():
 \r
 def getCap_appid():\r
     widgetid_cmd = ""\r
-    if TIZENV.find('tizen_4.0') > -1:\r
+    if TIZENV.find('tizen_5.0') > -1:\r
         widgetid_cmd = "su - " + DEVICE_EXECUTION_MODE_30 + \\r
                 " -c \"app_launcher -l | grep getCapabilities\""\r
     else:\r
@@ -404,7 +404,7 @@ def launch_getCap():
     wgt_id = getCap_appid()\r
     if wgt_id:\r
         launchResult = None\r
-        if TIZENV.find('tizen_4.0') > -1:\r
+        if TIZENV.find('tizen_5.0') > -1:\r
             launchResult = SdbManager.sdbShell(DEVID, 'su - ' + \\r
                     DEVICE_EXECUTION_MODE_30 + ' -c \"app_launcher -s ' + wgt_id + '\"')\r
         else:\r
@@ -436,7 +436,7 @@ def launch_getCap():
 \r
 def launch_ngetCap():\r
     launch_result = None\r
-    if TIZENV.find('tizen_4.0') > -1:\r
+    if TIZENV.find('tizen_5.0') > -1:\r
         launch_result = SdbManager.sdbShell(DEVID, 'su - ' + \\r
                 DEVICE_EXECUTION_MODE_30 + ' -c \"launch_app org.example.getcap\"')\r
     else:\r
@@ -568,7 +568,7 @@ def runProcess():
         kill_process("tinyweb")\r
         kill_process("testkit-stub")\r
         remove_stub()\r
-        if TIZENV.find('4.0') > -1:\r
+        if TIZENV.find('5.0') > -1:\r
             uninstall_storage()\r
         print "Clean the tct packages in device successfully."\r
 \r
@@ -598,14 +598,14 @@ def runProcess():
                 check_ngetCap()\r
             else:\r
                 check_getCap()\r
-            if TIZENV.find('4.0') > -1:\r
+            if TIZENV.find('5.0') > -1:\r
                 check_storage()\r
 \r
         print "Check finished."\r
 \r
     elif options.bhtest:\r
         check_resource_dir()\r
-        if TIZENV.find('4.0') > -1:\r
+        if TIZENV.find('5.0') > -1:\r
             uninstall_storage()\r
             install_storage()\r
             launch_storage()\r
@@ -640,7 +640,7 @@ def runProcess():
             uninstall_testconfig()\r
             uninstall_getCap()\r
             uninstall_ngetCap()\r
-            if TIZENV.find('4.0') > -1:\r
+            if TIZENV.find('5.0') > -1:\r
                 uninstall_storage()\r
 \r
         print "Clean the tct packages in device successfully."\r
@@ -677,7 +677,7 @@ def runProcess():
                 install_getCap()\r
                 launch_getCap()\r
 \r
-            if TIZENV.find('4.0') > -1:\r
+            if TIZENV.find('5.0') > -1:\r
                 install_storage()\r
                 launch_storage()\r
 \r
index e620722..7ea93b2 100755 (executable)
@@ -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
index dc10476..40fee25 100755 (executable)
@@ -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]))
index 7a7f3d0..3b7d0e5 100755 (executable)
@@ -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 \
index b95ad43..de2274f 100755 (executable)
@@ -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()
index 2fef182..7d1f4dc 100755 (executable)
@@ -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"):
index 2fe3c77..d9c0d6d 100755 (executable)
@@ -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:
index 7122c2f..1be4700 100755 (executable)
@@ -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
index 9900476..240b6c3 100755 (executable)
@@ -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()
index d5da8c1..3d27b25 100755 (executable)
@@ -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()
index 2074417..0d52646 100755 (executable)
@@ -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
index 57638b1..8d9dc04 100755 (executable)
@@ -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)
index 951aae9..cbc7513 100755 (executable)
@@ -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'] = ''
index 8643f01..d18a0db 100755 (executable)
@@ -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'
index 5ca81d9..c9b4630 100755 (executable)
@@ -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"]