[tct-shell][non-acr][Updated tctshell as latest] 48/192748/1
authorSanghoon Lee <shooney.lee@samsung.com>
Fri, 9 Nov 2018 04:04:56 +0000 (13:04 +0900)
committerLee Sanghoon <shooney.lee@samsung.com>
Fri, 9 Nov 2018 04:05:30 +0000 (04:05 +0000)
Change-Id: I3b4892c03c3eee59a34dd6a6f2a477d2881276e6
(cherry picked from commit d4221293c07c8e1e22236170881fe835710fdd24)

release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/shell/tctshell/constants.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/shellplanner.py
release/csharp-tct_5.0_dotnet/tct-tools_r4_rc1/testkitlite1.0/testkitlite/engines/default/runner.py

index 0eec787..41141a3 100755 (executable)
@@ -183,132 +183,84 @@ class Constants:
 
     @staticmethod
     def getDEVICE_TESTS_FILE(_tizenV):
-        if _tizenV and _tizenV.find('3.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/%s/tests.xml")
-        elif _tizenV and _tizenV.find('4.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/%s/tests.xml")
-        elif _tizenV and _tizenV.find('5.0') > -1:
+        if _tizenV and float(_tizenV.split('_')[-1]) >= 3.0:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/%s/tests.xml")
         else:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_24, "tct/opt/%s/tests.xml")
 
     @staticmethod
     def getDEVICE_SUITE_TARGET(_tizenV):
-        if _tizenV and _tizenV.find('3.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/")
-        elif _tizenV and _tizenV.find('4.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/")
-        elif _tizenV and _tizenV.find('5.0') > -1:
+        if _tizenV and float(_tizenV.split('_')[-1]) >= 3.0:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/")
         else:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_24, "tct/")
 
     @staticmethod
     def getDEVICE_SUITE_FOLDER(_tizenV):
-        if _tizenV and _tizenV.find('3.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/")
-        elif _tizenV and _tizenV.find('4.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/")
-        elif _tizenV and _tizenV.find('5.0') > -1:
+        if _tizenV and float(_tizenV.split('_')[-1]) >= 3.0:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/")
         else:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_24, "tct/opt/")
 
     @staticmethod
     def getDEVICE_BUILD_INFO_PATH(_tizenV):
-        if _tizenV and _tizenV.find('3.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "Documents/tct/buildinfo.xml")
-        elif _tizenV and _tizenV.find('4.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "Documents/tct/buildinfo.xml")
-        elif _tizenV and _tizenV.find('5.0') > -1:
+        if _tizenV and float(_tizenV.split('_')[-1]) >= 3.0:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "Documents/tct/buildinfo.xml")
         else:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_24, "Documents/tct/buildinfo.xml")
 
     @staticmethod
     def getDEVICE_CAPABILITY_PATH(_tizenV):
-        if _tizenV and _tizenV.find('3.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "Documents/tct/capability.xml")
-        elif _tizenV and _tizenV.find('4.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "Documents/tct/capability.xml")
-        elif _tizenV and _tizenV.find('5.0') > -1:
+        if _tizenV and float(_tizenV.split('_')[-1]) >= 3.0:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "Documents/tct/capability.xml")
         else:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_24, "Documents/tct/capability.xml")
 
     @staticmethod
     def getPRE_CONF_DEVICE_INI(_tizenV):
-        if _tizenV and _tizenV.find('3.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/tct-testconfig/tct-testconfig.ini")
-        elif _tizenV and _tizenV.find('4.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/tct-testconfig/tct-testconfig.ini")
-        elif _tizenV and _tizenV.find('5.0') > -1:
+        if _tizenV and float(_tizenV.split('_')[-1]) >= 3.0:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/tct-testconfig/tct-testconfig.ini")
         else:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_24, "tct/opt/tct-testconfig/tct-testconfig.ini")
 
     @staticmethod
     def getPRE_CONF_DEVICE_JSON(_tizenV):
-        if _tizenV and _tizenV.find('3.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/tct-testconfig/preconfigure.json")
-        elif _tizenV and _tizenV.find('4.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/tct-testconfig/preconfigure.json")
-        elif _tizenV and _tizenV.find('5.0') > -1:
+        if _tizenV and float(_tizenV.split('_')[-1]) >= 3.0:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/tct-testconfig/preconfigure.json")
         else:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_24, "tct/opt/tct-testconfig/preconfigure.json")
 
     @staticmethod
     def getPRE_CONF_DEVICE_XML(_tizenV):
-        if _tizenV and _tizenV.find('3.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/tct-testconfig/tests.xml")
-        elif _tizenV and _tizenV.find('4.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/tct-testconfig/tests.xml")
-        elif _tizenV and _tizenV.find('5.0') > -1:
+        if _tizenV and float(_tizenV.split('_')[-1]) >= 3.0:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/tct-testconfig/tests.xml")
         else:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_24, "tct/opt/tct-testconfig/tests.xml")
 
     @staticmethod
     def getPORT_CONF_DEVICE_JSON(_tizenV):
-        if _tizenV and _tizenV.find('3.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/tct-testconfig/portconfigure.json")
-        elif _tizenV and _tizenV.find('4.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/tct-testconfig/portconfigure.json")
-        elif _tizenV and _tizenV.find('5.0') > -1:
+        if _tizenV and float(_tizenV.split('_')[-1]) >= 3.0:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/tct-testconfig/portconfigure.json")
         else:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_24, "tct/opt/tct-testconfig/portconfigure.json")
 
     @staticmethod
     def getTCT_PORT_CONF_DEVICE_JSON(_tizenV):
-        if _tizenV and _tizenV.find('3.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/portconfigure.json")
-        elif _tizenV and _tizenV.find('4.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/portconfigure.json")
-        elif _tizenV and _tizenV.find('5.0') > -1:
+        if _tizenV and float(_tizenV.split('_')[-1]) >= 3.0:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/portconfigure.json")
         else:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_24, "tct/portconfigure.json")
 
     @staticmethod
     def getTCT_PRE_CONF_DEVICE_JSON(_tizenV):
-        if _tizenV and _tizenV.find('3.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/preconfigure.json")
-        elif _tizenV and _tizenV.find('4.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/preconfigure.json")
-        elif _tizenV and _tizenV.find('5.0') > -1:
+        if _tizenV and float(_tizenV.split('_')[-1]) >= 3.0:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/preconfigure.json")
         else:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_24, "tct/preconfigure.json")
 
     @staticmethod
     def getNAT_CONF_DEVICE_TXT(_tizenV):
-        if _tizenV and _tizenV.find('3.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/tct-testconfig/TC_Config.txt")
-        elif _tizenV and _tizenV.find('4.0') > -1:
-            return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/tct-testconfig/TC_Config.txt")
-        elif _tizenV and _tizenV.find('5.0') > -1:
+        if _tizenV and float(_tizenV.split('_')[-1]) >= 3.0:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_30, "tct/opt/tct-testconfig/TC_Config.txt")
         else:
             return os.path.join(Constants.DEVICE_SUITE_TARGET_24, "tct/opt/tct-testconfig/TC_Config.txt")
index 36f1c51..a329b7c 100755 (executable)
@@ -509,20 +509,8 @@ def _geneSuiteName(suite_zipname, _tizenV):
     suite_name = ""
     match_ext = ""
 
-    if _tizenV and _tizenV.find("5.0") > -1:
-        match_ext = "-5.0.zip"
-    elif _tizenV and _tizenV.find("4.0") > -1:
-        match_ext = "-4.0.zip"
-    elif _tizenV and _tizenV.find("3.0") > -1:
-        match_ext = "-3.0.zip"
-    elif _tizenV and _tizenV.find("2.4") > -1:
-        match_ext = "-2.4.zip"
-    elif _tizenV and _tizenV.find("2.3.2") > -1:
-        match_ext = "-2.3.2.zip"
-    elif _tizenV and _tizenV.find("2.3.1") > -1:
-        match_ext = "-2.3.1.zip"
-
     if _tizenV:
+        match_ext = "-{}.zip".format(_tizenV.split('_')[-1])
         find_idx = suite_zipname.find(match_ext)
         if find_idx > -1:
             suite_name = suite_zipname[0:find_idx]
index d608f5a..ea62381 100755 (executable)
@@ -654,7 +654,7 @@ class TctShellSuite:
         LOGGER.info("Entering checkSuiteExisted(String suiteName : %s)" \
                 % suiteName)
         try:
-            if self.tizenV and (self.tizenV.find("3.0") > -1 or self.tizenV.find("4.0") > -1 or self.tizenV.find("5.0") > -1):
+            if self.tizenV and float(self.tizenV.split('_')[-1]) >= 3.0:
                 rep_suiteName = suiteName.replace("tct-", "")
                 host_check_cmd = "su - owner -c \"app_launcher -l | grep %s\"" \
                              % rep_suiteName
index 0d52646..0d9a246 100755 (executable)
@@ -519,9 +519,23 @@ class TRunner:
                             LOGGER.info("[ copy result dlog to output file:"
                                     " %s ]" % afile)
                             dlogfile = os.path.join(root, afile)
+                           finalName = afile
+                            rerunString = self.resultfile.split('.')[-2]
+                            if(rerunString == 'rerun'):
+                               extraNames = afile.split('.')
+                               extraName = ""
+                               if not extraNames[1].isdigit():
+                                       extraName = extraNames[1] + '.'
+                               for i in range(2, len(extraNames)-1):
+                                       extraName += extraNames[i]+'.'
+                               finalName = self.resultfile.split('/')[-1].split('.')[0]+"."+extraName[:-1]+"_rerun_"+str(datetime.now())+".dlog"
                             destdfile = os.path.join(\
-                                    os.path.dirname(self.resultfile), afile)
+                                    os.path.dirname(self.resultfile), finalName)
+                           print("destdfile = "+destdfile)
                             copyfile(dlogfile, destdfile)
+#                 for afile in os.listdir(os.path.dirname(self.resultfile)):
+#                      if ".dlog" in afile and "tct" not in afile:
+#                              os.remove(afile)
 
         except IOError as error:
             LOGGER.error("[ Error: fail to copy the result file to: %s,"