[PATCH] Modify LitTestCommand class to accept optional argument to parse summary lines only

Ying Chen chying at google.com
Tue Feb 24 17:50:58 PST 2015


Hi sivachandra, ovyalov, chaoren,

Modify LitTestCommand class to accept optional argument to parse summary lines only 
- Add optional argument parseSummaryOnly with default value False 
- If the argument is not specified, the behavior will be all the same as before 
- If the argument is passed as True, only the lines after "r'^Failing Tests \(\d*\)$'" will be parsed as test results 
- This is supposed to address the test result display problem with ninja command

http://reviews.llvm.org/D7877

Files:
  zorg/buildbot/builders/LLDBBuilder.py
  zorg/buildbot/commands/LitTestCommand.py

Index: zorg/buildbot/builders/LLDBBuilder.py
===================================================================
--- zorg/buildbot/builders/LLDBBuilder.py
+++ zorg/buildbot/builders/LLDBBuilder.py
@@ -303,6 +303,7 @@
                                       'ninja',
                                       'check-lldb'],
                              description="test lldb",
+                             parseSummaryOnly=True,
                              env=env,
                              workdir='%s' % llvm_builddir))
     return f
Index: zorg/buildbot/commands/LitTestCommand.py
===================================================================
--- zorg/buildbot/commands/LitTestCommand.py
+++ zorg/buildbot/commands/LitTestCommand.py
@@ -19,9 +19,11 @@
 
   # These are the codes for which we will include the log output in the buildbot
   # step results.
-  failingCodes = set(['FAIL', 'XPASS', 'KPASS', 'UNRESOLVED'])
+  failingCodes = set(['FAIL', 'XPASS', 'KPASS', 'UNRESOLVED', 'TIMEOUT'])
+  # Regular expressions to indicate start of result line.
+  kTestResultRE = re.compile(r'^Failing Tests \(\d*\)$')
 
-  def __init__(self, maxLogs=None):
+  def __init__(self, maxLogs=None, isSummaryOnly=False):
     LogLineObserver.__init__(self)
     self.resultCounts = {}
     self.maxLogs = maxLogs
@@ -32,6 +34,9 @@
 
     # If non-null, a list of lines in the current log.
     self.activeVerboseLog = None
+    # If it's true, current line will be parsed as result steps
+    # If false, current line will be skipped
+    self.parserStarted = not isSummaryOnly
 
   def hadFailure(self):
     for code in self.failingCodes:
@@ -97,13 +102,17 @@
     if self.lastTestResult:
       self.testInfoFinished()
 
-    # Check for a new test status line.
-    m = self.kTestLineRE.match(line.strip())
-    if m:
-      # Remember the last test result and update the result counts.
-      self.lastTestResult = (code, name) = m.groups()
-      self.resultCounts[code] = self.resultCounts.get(code, 0) + 1
-      return
+    if self.kTestResultRE.match(line):
+      self.parserStarted = True;
+
+    if self.parserStarted is True:
+      # Check for a new test status line.
+      m = self.kTestLineRE.match(line.strip())
+      if m:
+        # Remember the last test result and update the result counts.
+        self.lastTestResult = (code, name) = m.groups()
+        self.resultCounts[code] = self.resultCounts.get(code, 0) + 1
+        return
 
 class LitTestCommand(Test):
   resultNames = {'FAIL':'unexpected failures',
@@ -118,12 +127,13 @@
                  'IMPROVED':'runtime performance improvement',
                  'UNSUPPORTED':'unsupported tests'}
 
-  def __init__(self, ignore=[], flaky=[], max_logs=20,
+  def __init__(self, ignore=[], flaky=[], max_logs=20, parseSummaryOnly=False,
                *args, **kwargs):
     Test.__init__(self, *args, **kwargs)
     self.maxLogs = int(max_logs)
-    self.logObserver = LitLogObserver(self.maxLogs)
+    self.logObserver = LitLogObserver(self.maxLogs, parseSummaryOnly)
     self.addFactoryArguments(max_logs=max_logs)
+    self.addFactoryArguments(parseSummaryOnly=parseSummaryOnly)
     self.addLogObserver('stdio', self.logObserver)
 
   def evaluateCommand(self, cmd):

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7877.20651.patch
Type: text/x-patch
Size: 3252 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150225/ae8170f5/attachment.bin>


More information about the llvm-commits mailing list