bug 600694: Slave disconnect exceptions should auto-retry. r=rail
authorBen Hearsum <bhearsum@mozilla.com>
Tue, 26 Oct 2010 15:11:47 -0400
changeset 95 58225ba726780fbe6ce9adce00690952b5920906
parent 94 71c8d03e90100b18d8af687f2bff180ac0d79ae3
child 96 b7b751d9df42c8bf0d87435aed538389bb2a6a15
child 98 d23e1cd7604b797cd845b2290e8b9db06909f1c5
push id39
push userbhearsum@mozilla.com
push dateTue, 26 Oct 2010 19:12:29 +0000
reviewersrail
bugs600694
bug 600694: Slave disconnect exceptions should auto-retry. r=rail
master/buildbot/process/base.py
--- a/master/buildbot/process/base.py
+++ b/master/buildbot/process/base.py
@@ -3,17 +3,18 @@
 import types
 
 from zope.interface import implements
 from twisted.python import log
 from twisted.python.failure import Failure
 from twisted.internet import reactor, defer, error
 
 from buildbot import interfaces, locks
-from buildbot.status.builder import SUCCESS, WARNINGS, FAILURE, EXCEPTION, RETRY
+from buildbot.status.builder import SUCCESS, WARNINGS, FAILURE, EXCEPTION, \
+  RETRY, worst_status
 from buildbot.status.builder import Results
 from buildbot.status.progress import BuildProgress
 
 
 class Build:
     """I represent a single build by a single slave. Specialized Builders can
     use subclasses of Build to hold status information unique to those build
     processes.
@@ -375,36 +376,38 @@ class Build:
             result, text = result
         assert type(result) == type(SUCCESS)
         log.msg(" step '%s' complete: %s" % (step.name, Results[result]))
         self.results.append(result)
         if text:
             self.text.extend(text)
         if not self.remote:
             terminate = True
+
+        possible_overall_result = result
         if result == FAILURE:
+            if not step.flunkOnFailure:
+                possible_overall_result = SUCCESS
             if step.warnOnFailure:
-                if self.result != FAILURE:
-                    self.result = WARNINGS
+                possible_overall_result = WARNINGS
             if step.flunkOnFailure:
-                self.result = FAILURE
+                possible_overall_result = FAILURE
             if step.haltOnFailure:
                 terminate = True
         elif result == WARNINGS:
-            if step.warnOnWarnings:
-                if self.result != FAILURE:
-                    self.result = WARNINGS
+            if not step.warnOnWarnings:
+                possible_overall_result = SUCCESS
+            else:
+                possible_overall_result = WARNINGS
             if step.flunkOnWarnings:
-                self.result = FAILURE
-        elif result == EXCEPTION:
-            self.result = EXCEPTION
+                possible_overall_result = FAILURE
+        elif result in (EXCEPTION, RETRY):
             terminate = True
-        elif result == RETRY:
-            self.result = RETRY
-            terminate = True
+
+        self.result = worst_status(self.result, possible_overall_result)
         return terminate
 
     def lostRemote(self, remote=None):
         # the slave went away. There are several possible reasons for this,
         # and they aren't necessarily fatal. For now, kill the build, but
         # TODO: see if we can resume the build when it reconnects.
         log.msg("%s.lostRemote" % self)
         self.remote = None