The branch, master has been updated
       via  5b5ab12 include stage name in stages list.
      from  f400877 Cast unicode strings to utf-8 strings

http://gitweb.samba.org/?p=build-farm.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 5b5ab12f09c68d2a2ece7eaea3cb30b2ede8cbd3
Author: Jelmer Vernooij <jel...@samba.org>
Date:   Tue Nov 9 16:35:20 2010 +0100

    include stage name in stages list.

-----------------------------------------------------------------------

Summary of changes:
 buildfarm/data.py            |   31 ++++++++++++++++++++++++-------
 buildfarm/tests/test_data.py |   17 +++++++++++------
 web/build.py                 |    2 +-
 3 files changed, 36 insertions(+), 14 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 15afd31..80a633c 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -34,12 +34,29 @@ import util
 class BuildStatus(object):
 
     def __init__(self, stages=None, other_failures=None):
-        self.stages = stages
+        if stages is not None:
+            self.stages = stages
+        else:
+            self.stages = []
         if other_failures is not None:
             self.other_failures = other_failures
         else:
             self.other_failures = set()
 
+    def broken_host(self):
+        if "disk full" in self.other_failures:
+            return True
+        return False
+
+    def _status_tuple(self):
+        return [v for (k, v) in self.stages]
+
+    def regressed_since(self, other):
+        """Check if this build has regressed since another build."""
+        if "disk full" in self.other_failures:
+            return False
+        return cmp(self._status_tuple(), other._status_tuple())
+
     def __str__(self):
         return repr((self.stages, self.other_failures))
 
@@ -87,17 +104,17 @@ def build_status_from_logs(log, err):
     stage_results = dict(stages)
     def map_stage(name, result):
         if name != "TEST":
-            return result
+            return (name, result)
         # TEST is special
         if test_successes + test_failures == 0:
             # No granular test output
-            return result
+            return ("TEST", result)
         if result == 0 and test_failures == 0:
             ret.other_failures.add("inconsistent test result")
-            return -1
-        return test_failures
+            return ("TEST", -1)
+        return ("TEST", test_failures)
 
-    ret.stages = tuple([map_stage(k, v) for k, v in stages])
+    ret.stages = [map_stage(name, result) for (name, result) in stages]
     return ret
 
 
@@ -312,7 +329,6 @@ class CachingBuild(Build):
         return ret
 
 
-
 def read_trees_from_conf(path):
     """Read trees from a configuration file."""
     ret = {}
@@ -442,6 +458,7 @@ class BuildResultStore(object):
 
     def host_age(self, host):
         """get the overall age of a host"""
+        # FIXME: Turn this into a simple SQL query, or use something in hostdb 
?
         ret = None
         for compiler in self.compilers:
             for tree in self.trees:
diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index 6b776ca..66e4f06 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -184,7 +184,7 @@ class BuildStatusFromLogs(testtools.TestCase):
 
     def test_nothing(self):
         s = self.parse_logs("", "")
-        self.assertEquals((), s.stages)
+        self.assertEquals([], s.stages)
         self.assertEquals(set(), s.other_failures)
 
     def test_disk_full(self):
@@ -205,14 +205,16 @@ class BuildStatusFromLogs(testtools.TestCase):
 TEST STATUS:1
 """
         res = self.parse_logs(log, "")
-        self.assertEquals(res.stages, (1,))
+        self.assertEquals(res.stages, [
+            ("TEST", 1)])
 
     def test_failed_test_whitespace(self):
         log = """
 TEST STATUS:  1
 """
         res = self.parse_logs(log, "")
-        self.assertEquals(res.stages, (1,))
+        self.assertEquals(res.stages,
+            [("TEST", 1)])
 
     def test_failed_test_noise(self):
         log = """
@@ -221,7 +223,8 @@ TEST STATUS:  1
 CC_CHECKER STATUS:     2
 """
         res = self.parse_logs(log, "")
-        self.assertEquals(res.stages, (2,1,2))
+        self.assertEquals(res.stages,
+            [("CONFIGURE", 2), ("TEST", 1), ("CC_CHECKER", 2)])
 
     def test_no_test_output(self):
         log = """
@@ -230,7 +233,8 @@ TEST STATUS: 0
 CC_CHECKER STATUS:     2
 """
         res = self.parse_logs(log, "")
-        self.assertEquals(res.stages, (2, 0, 2))
+        self.assertEquals(res.stages,
+            [("CONFIGURE", 2), ("TEST", 0), ("CC_CHECKER", 2)])
 
     def test_granular_test(self):
         log = """
@@ -243,5 +247,6 @@ TEST STATUS: 1
 CC_CHECKER STATUS:     2
 """
         res = self.parse_logs(log, "")
-        self.assertEquals(res.stages, (2, 3, 2))
+        self.assertEquals(res.stages,
+            [("CONFIGURE", 2), ("TEST", 3), ("CC_CHECKER", 2)])
 
diff --git a/web/build.py b/web/build.py
index b3f991c..5933a20 100755
--- a/web/build.py
+++ b/web/build.py
@@ -107,7 +107,7 @@ def html_build_status(status):
         ostatus += "/"+span("status failed", "timeout")
     if "make test error" in status.other_failures:
         ostatus += "/"+span("status failed", "unexpected return code")
-    bstatus = "/".join([span_status(s) for s in status.stages])
+    bstatus = "/".join([span_status(s) for (n, s) in status.stages])
     return bstatus + ostatus
 
 


-- 
build.samba.org

Reply via email to