[SCM] build.samba.org - branch master updated

Jelmer Vernooij jelmer at samba.org
Wed Nov 17 02:06:05 MST 2010


The branch, master has been updated
       via  2d03606 Simplify build status code a bit.
      from  49380c5 Add tests for regressed_since.

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


- Log -----------------------------------------------------------------
commit 2d03606141dcfc69cb0e406ba9117acf2cbef762
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Wed Nov 17 10:05:33 2010 +0100

    Simplify build status code a bit.

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

Summary of changes:
 buildfarm/data.py            |   11 +++++------
 buildfarm/tests/test_data.py |   14 ++++++++++----
 2 files changed, 15 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index ffdb9e5..2ef40b0 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -53,7 +53,7 @@ class BuildStatus(object):
 
     def __init__(self, stages=None, other_failures=None):
         if stages is not None:
-            self.stages = stages
+            self.stages = [BuildStageResult(n, r) for (n, r) in stages]
         else:
             self.stages = []
         if other_failures is not None:
@@ -65,7 +65,7 @@ class BuildStatus(object):
     def failed(self):
         if self.other_failures:
             return True
-        return not all([x == 0 for x in self._status_tuple()])
+        return not all([x.result == 0 for x in self.stages])
 
     def __serialize__(self):
         return repr(self)
@@ -77,16 +77,13 @@ class BuildStatus(object):
     def __str__(self):
         if self.other_failures:
             return ",".join(self.other_failures)
-        return "/".join(map(str, self._status_tuple()))
+        return "/".join([str(x.result) for x in self.stages])
 
     def broken_host(self):
         if "disk full" in self.other_failures:
             return True
         return False
 
-    def _status_tuple(self):
-        return [sr.result for sr in self.stages]
-
     def regressed_since(self, older):
         """Check if this build has regressed since another build."""
         if "disk full" in self.other_failures:
@@ -136,6 +133,8 @@ def check_dir_exists(kind, path):
 
 def build_status_from_logs(log, err):
     """get status of build"""
+    # FIXME: Perhaps also extract revision here?
+
     test_failures = 0
     test_successes = 0
     test_seen = 0
diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index 4e17611..c96b266 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -306,16 +306,22 @@ class BuildStatusTest(testtools.TestCase):
         e = data.BuildStatus([("CONFIGURE", 2), ("TEST", 3), ("CC_CHECKER", 1)], set(["super error"]))
         self.assertEquals(cmp(d, e), -1)
 
+    def test_str(self):
+        a = data.BuildStatus([("CONFIGURE", 3), ("BUILD", 2)])
+        self.assertEquals("3/2", str(a))
+
+    def test_str_other_failures(self):
+        a = data.BuildStatus([("CONFIGURE", 3), ("BUILD", 2)], set(["panic"]))
+        self.assertEquals("panic", str(a))
+
 
 class BuildStatusRegressedSinceTests(testtools.TestCase):
 
     def assertRegressedSince(self, expected, old_status, new_status):
         (stages1, other_failures1) = old_status
         (stages2, other_failures2) = new_status
-        a = data.BuildStatus(
-            [data.BuildStageResult(n, r) for (n, r) in stages1], set(other_failures1))
-        b = data.BuildStatus(
-            [data.BuildStageResult(n, r) for (n, r) in stages2], set(other_failures2))
+        a = data.BuildStatus(stages1, set(other_failures1))
+        b = data.BuildStatus(stages2, set(other_failures2))
         self.assertEquals(expected, b.regressed_since(a))
 
     def test_same(self):


-- 
build.samba.org


More information about the samba-cvs mailing list