[Buildbot-commits] buildbot/buildbot buildset.py,1.2,1.3

Brian Warner warner at users.sourceforge.net
Fri Oct 14 19:32:57 UTC 2005


Update of /cvsroot/buildbot/buildbot/buildbot
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30432/buildbot

Modified Files:
	buildset.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-324
Creator:  Brian Warner <warner at lothar.com>

BuildSet did not report failure correctly, breaking Dependent builds

	* buildbot/buildset.py (BuildSet): fix bug where BuildSet did not
	report failure correctly, causing Dependent builds to run when
	they shouldn't have.
	* buildbot/status/builder.py (BuildSetStatus): same
	* buildbot/test/test_buildreq.py (Set.testBuildSet): verify it
	(Set.testSuccess): test the both-pass case too
	* buildbot/test/test_dependencies.py (Dependencies.testRun_Fail):
	fix this test: it was ending too early, masking the failure before
	(Logger): specialized StatusReceiver to make sure the dependent
	builds aren't even started, much less completed.


Index: buildset.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/buildset.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- buildset.py	17 Aug 2005 02:15:36 -0000	1.2
+++ buildset.py	14 Oct 2005 19:32:55 -0000	1.3
@@ -19,7 +19,7 @@
         self.builderNames = builderNames
         self.source = source
         self.reason = reason
-        self.failed = False
+        self.stillHopeful = True
         self.status = bss = builder.BuildSetStatus(source, reason,
                                                    builderNames, bsid)
 
@@ -51,13 +51,27 @@
             b.submitBuildRequest(req)
 
     def requestFinished(self, buildstatus, req):
+        # TODO: this is where individual build status results are aggregated
+        # into a BuildSet-wide status. Consider making a rule that says one
+        # WARNINGS results in the overall status being WARNINGS too. The
+        # current rule is that any FAILURE means FAILURE, otherwise you get
+        # SUCCESS.
         self.requests.remove(req)
-        if buildstatus.getResults() == builder.FAILURE:
-            if not self.failed:
-                self.failed = self.status.failed = True
-                self.status.setResults(builder.FAILURE)
+        results = buildstatus.getResults()
+        if results == builder.FAILURE:
+            self.status.setResults(results)
+            if self.stillHopeful:
+                # oh, cruel reality cuts deep. no joy for you. This is the
+                # first failure. This flunks the overall BuildSet, so we can
+                # notify success watchers that they aren't going to be happy.
+                self.stillHopeful = False
+                self.status.giveUpHope()
                 self.status.notifySuccessWatchers()
         if not self.requests:
-            self.status.setResults(builder.SUCCESS)
+            # that was the last build, so we can notify finished watchers. If
+            # we haven't failed by now, we can claim success.
+            if self.stillHopeful:
+                self.status.setResults(builder.SUCCESS)
+                self.status.notifySuccessWatchers()
             self.status.notifyFinishedWatchers()
 





More information about the Commits mailing list