[llvm-commits] [zorg] r82961 - /zorg/trunk/zorg/buildbot/commands/ClangTestCommand.py

Daniel Dunbar daniel at zuster.org
Sun Sep 27 18:55:44 PDT 2009


Author: ddunbar
Date: Sun Sep 27 20:55:43 2009
New Revision: 82961

URL: http://llvm.org/viewvc/llvm-project?rev=82961&view=rev
Log:
Improve Clang (now 'lit') test parser to extract failure logs into
individual reports.

Modified:
    zorg/trunk/zorg/buildbot/commands/ClangTestCommand.py

Modified: zorg/trunk/zorg/buildbot/commands/ClangTestCommand.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/commands/ClangTestCommand.py?rev=82961&r1=82960&r2=82961&view=diff

==============================================================================
--- zorg/trunk/zorg/buildbot/commands/ClangTestCommand.py (original)
+++ zorg/trunk/zorg/buildbot/commands/ClangTestCommand.py Sun Sep 27 20:55:43 2009
@@ -1,5 +1,6 @@
 import itertools
 import re
+import os
 
 import buildbot
 import buildbot.steps.shell
@@ -7,19 +8,42 @@
 class ClangTestCommand(buildbot.steps.shell.Test):
   description = "testing clang"
   descriptionDone = "test clang"
+
   kTestLineRE = re.compile(r'([^ ]*): (.*) \(.*.*\)')
+  kTestFailureLogStartRE = re.compile(r"""\*{4,80} TEST '(.*)' .*""")
+  kTestFailureLogStopRE = re.compile(r"""\*{10,80}""")
+
+  # Show a maximum of 20 individual failure logs.
+  kMaxFailureLogs = 20
+
   def evaluateCommand(self, cmd):
     rc = 0
     grouped = {}
-    failureLog = []
+    failureLogs = []
     lines = self.getLog('stdio').readlines()
 
     it = iter(lines)
+    inFailure = None
     for ln in it:
+      # See if we are inside a failure log.
+      if inFailure:
+        inFailure[1].append(ln)
+        if ClangTestCommand.kTestFailureLogStopRE.match(ln):
+          failureLogs.append(tuple(inFailure))
+          inFailure = None
+        continue
+
       ln = ln.strip()
       if not ln:
         continue
-      
+
+      # Check for test failure logs.
+      m = ClangTestCommand.kTestFailureLogStartRE.match(ln)
+      if m:
+        inFailure = (m.group(1), [ln])
+        continue
+
+      # Otherwise expect a test status line.
       m = ClangTestCommand.kTestLineRE.match(ln)
       if m:
         groupName = m.group(1)
@@ -28,10 +52,17 @@
           grouped[groupName] = []
         grouped[groupName].append(testName)
 
-    # FIXME: Get logs for failures.
+    if inFailure:
+      # FIXME: Different error?
+      raise ValueError,"Unexpected clang test running output, unterminated failure log!"
+
     for name,items in grouped.items():
       if name != 'PASS' and items:
         self.addCompleteLog(name.lower(), '\n'.join(items) + '\n')
+    for name,items in failureLogs[:self.kMaxFailureLogs]:
+      self.addCompleteLog(os.path.basename(name.lower()),
+                          ''.join(items) + '\n')
+      
     numPass = len(grouped.get('PASS',()))
     numFail = len(grouped.get('FAIL',()))
     numXFail = len(grouped.get('XFAIL',()))





More information about the llvm-commits mailing list