Browse Source

Merge pull request #5262 from AttilaVamos/HPCC-10512-improvement

HPCC-10512 Allow regression suite to contain summary queries

Reviewed-By: Gavin Halliday <gavin.halliday@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 11 years ago
parent
commit
b0426e2786

+ 5 - 0
testing/regress/README.rst

@@ -334,6 +334,11 @@ The format of result is same as above:
     To set individual timeout for test case
 //timeout <timeout_value_in_sec>
 
+    To switch off the test case output matching with key file
+    (If this tag exists in the test case source then its output stored into the result log file.)
+//nokey
+
+
 7. Key file generation:
 ------------------------------
 

+ 27 - 6
testing/regress/hpcc/common/report.py

@@ -55,13 +55,28 @@ class Report:
         reportStr += "Passing: %i\n" % len(self.report._pass)
         reportStr += "Failure: %i\n" % len(self.report._fail)
         reportStr += "-------------------------------------------------\n"
+        if self.report._pass:
+            passStr = ''
+            for result in self.report._pass:
+                try:
+                    if result.Diff !=  '':
+                        passStr += repr(result.Diff)
+                        passStr += "\n"
+                except AttributeError as ae:
+                    logging.debug("AttributeError Exception:'%s'",  repr(ae))
+                except Exception as ex:
+                    logging.debug("Exception:'%s'",  str(ex))
+                    #reportStr += str(result.Diff)
+            if len(passStr):
+                reportStr += passStr
+                reportStr += "-------------------------------------------------\n"
         if self.report._fail:
             for result in self.report._fail:
                 try:
-                    reportStr += result.Diff
+                    reportStr += result.Diff.replace('\\n',  '\n').replace('"',  '')
                 except Exception as ex:
-#                   logging.debug("Exception:'%s'",  str(ex))
-                    reportStr += str(result.Diff)
+                    logging.debug("Exception:'%s'",  str(ex))
+                    reportStr += repr(result.Diff).replace('\\n',  '\n').replace('"',  '')
                 reportStr += "\n"
             reportStr += "-------------------------------------------------\n"
         if log:
@@ -103,9 +118,15 @@ class Report:
         result = {}
         result['File'] = eclfile.ecl
         if eclfile.diff:
-            result['Result'] = 'Fail'
-            result['Diff'] = eclfile.diff
-            self.report._fail.append(_dict(result))
+            if eclfile.testNoKey():
+                result['Result'] = 'Pass'
+                result['Diff'] = eclfile.diff
+                self.report._pass.append(_dict(result))
+            else:
+                result['Result'] = 'Fail'
+                result['Diff'] = eclfile.diff
+                self.report._fail.append(_dict(result))
         else:
             result['Result'] = 'Pass'
+            result['Diff'] = ''
             self.report._pass.append(_dict(result))

+ 1 - 1
testing/regress/hpcc/regression/regress.py

@@ -206,7 +206,7 @@ class Regression:
                                 if self.taskParam[threadId]['retryCount'] > 0:
                                     self.timeouts[threadId] =  self.taskParam[threadId]['timeoutValue']
                                     self.loggermutex.acquire()
-                                    logging.info("%3d. Does not started yet. Reset timeout to %d sec." % (self.taskParam[threadId]['taskId']+1, self.taskParam[threadId]['timeoutValue']))
+                                    logging.warn("%3d. Does not started yet. Reset timeout to %d sec." % (self.taskParam[threadId]['taskId']+1, self.taskParam[threadId]['timeoutValue']))
                                     logging.debug("%3d. Task parameters: thread id: %d, ecl:'%s',state:'%s', retry count:%d." % (self.taskParam[threadId]['taskId']+1, threadId,  suiteItems[self.taskParam[threadId]['taskId']].ecl,   wuid['state'],  self.taskParam[threadId]['retryCount'] ),  extra={'taskId':self.taskParam[threadId]['taskId']+1})
                                     self.loggermutex.release()
                                 else:

+ 1 - 1
testing/regress/hpcc/util/ecl/cc.py

@@ -59,7 +59,7 @@ class ECLCC(Shell):
                     if  "Error" in line:
                         ecl.diff += line.replace("'",  "")
                     if "): error " in  line:
-                        ecl.diff += line
+                        ecl.diff += line.replace("\\'", "'")
                 #ecl.diff += repr(self.makeArchiveError).replace('\\n',  '\n\t')
             except Exception as ex:
                 logging.debug("Exception:'%s'",  str(ex))

+ 4 - 0
testing/regress/hpcc/util/ecl/command.py

@@ -100,6 +100,10 @@ class ECLcmd(Shell):
                 if queryWuid(eclfile.getJobname(), eclfile.getTaskId())['state'] == 'aborted':
                     eclfile.diff = eclfile.ecl+'\n\t'+'Aborted ( reason: '+eclfile.getAbortReason()+' )'
                     test = False
+                elif eclfile.testNoKey():
+                    # keyfile comparaison disabled with //nokey tag
+                    eclfile.diff = 'Output of '+eclfile.ecl +' test is:\n\t'+ data
+                    test = True
                 else:
                     test = eclfile.testResults()
             report.addResult(eclfile)

+ 9 - 0
testing/regress/hpcc/util/ecl/file.py

@@ -141,6 +141,15 @@ class ECLFile:
         logging.debug("%3d. Publish is %s",  self.taskId,  retVal)
         return retVal
 
+    def testNoKey(self):
+        # Standard string has a problem with unicode characters
+        # use byte arrays and binary file open instead
+        tag = b'//nokey'
+        logging.debug("%3d. testNoKey (ecl:'%s', tag:'%s')", self.taskId, self.ecl,  tag)
+        retVal = self.__checkTag(tag)
+        logging.debug("%3d. No key is %s",  self.taskId,  retVal)
+        return retVal
+
     def getTimeout(self):
         timeout = 0
         # Standard string has a problem with unicode characters