[PATCH] Lit parser should ignore leading whitespace in log file.

Rick Foos rfoos at codeaurora.org
Tue Apr 7 12:46:54 PDT 2015


Use case: MSBuild indents Lit test output, and test results are not displayed.

Everything except the Stop RE strips the log line, and this one line change allows indented logs to be displayed.

http://reviews.llvm.org/D8878

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
@@ -42,10 +42,10 @@
     return f
 
 # CMake Windows builds
-def getLLDBWindowsCMakeBuildFactory(
+    def getLLDBWindowsCMakeBuildFactory(
             clean=False,
             cmake='cmake',
-            jobs="%(jobs)s",
+                jobs="%(jobs)s",
 
             # Source directory containing a built python
             python_source_dir=r'C:/src/python',
Index: zorg/buildbot/commands/LitTestCommand.py
===================================================================
--- zorg/buildbot/commands/LitTestCommand.py
+++ zorg/buildbot/commands/LitTestCommand.py
@@ -48,7 +48,7 @@
     self.activeVerboseLog.append(line)
 
     # If this is a stop marker, process the test info.
-    if self.kTestVerboseLogStopRE.match(line):
+    if self.kTestVerboseLogStopRE.match(line.strip()):
       self.testInfoFinished()
 
   def testInfoFinished(self):
@@ -225,6 +225,25 @@
 **********"""),
         ('FAIL: test-three', 'FAIL: test-three')])
 
+  def test_indented_log(self):
+    obs = self.parse_log("""
+    FAIL: test-one (1 of 3)
+    FAIL: test-two (2 of 3)
+    **** TEST 'test-two' FAILED ****
+    bla bla bla
+    **********
+    FAIL: test-three (3 of 3)
+""")
+
+    self.assertEqual(obs.resultCounts, { 'FAIL' : 3 })
+    self.assertEqual(obs.step.logs, [
+        ('FAIL: test-one', 'FAIL: test-one'),
+        ('FAIL: test-two', """\
+    **** TEST 'test-two' FAILED ****
+    bla bla bla
+    **********"""),
+        ('FAIL: test-three', 'FAIL: test-three')])
+
 class TestCommand(unittest.TestCase):
   def parse_log(self, text, **kwargs):
     cmd = LitTestCommand(**kwargs)

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8878.23362.patch
Type: text/x-patch
Size: 1796 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150407/5825acdf/attachment.bin>


More information about the llvm-commits mailing list