[zorg] r174137 - LitTestCommand: Simplify result bookkeeping.

Daniel Dunbar daniel at zuster.org
Thu Jan 31 17:39:48 PST 2013


Author: ddunbar
Date: Thu Jan 31 19:39:48 2013
New Revision: 174137

URL: http://llvm.org/viewvc/llvm-project?rev=174137&view=rev
Log:
LitTestCommand: Simplify result bookkeeping.

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

Modified: zorg/trunk/zorg/buildbot/commands/LitTestCommand.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/commands/LitTestCommand.py?rev=174137&r1=174136&r2=174137&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/commands/LitTestCommand.py (original)
+++ zorg/trunk/zorg/buildbot/commands/LitTestCommand.py Thu Jan 31 19:39:48 2013
@@ -17,7 +17,12 @@ class LitLogObserver(LogLineObserver):
     self.resultCounts = {}
     self.inFailure = None
     self.inFailureContext = False
-    self.failed = False
+
+  def hadFailure(self):
+    for code in self.failingCodes:
+      if self.resultCounts.get(code):
+        return True
+
   def outLineReceived(self, line):
     # See if we are inside a failure log.
     if self.inFailureContext:
@@ -50,10 +55,7 @@ class LitLogObserver(LogLineObserver):
         self.inFailure = None
       if code in self.failingCodes:
         self.inFailure = (name, [line])
-        self.failed = True
-      if not code in self.resultCounts:
-        self.resultCounts[code] = 0
-      self.resultCounts[code] += 1
+      self.resultCounts[code] = self.resultCounts.get(code, 0) + 1
 
 class LitTestCommand(Test):
   resultNames = {'FAIL':'unexpected failures',
@@ -80,7 +82,7 @@ class LitTestCommand(Test):
       return FAILURE
 
     # Otherwise, report failure if there were failures in the log.
-    if self.logObserver.failed:
+    if self.logObserver.hadFailure():
       return FAILURE
 
     return SUCCESS





More information about the llvm-commits mailing list