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

Jelmer Vernooij jelmer at samba.org
Mon Nov 8 15:32:30 MST 2010


The branch, master has been updated
       via  9e6974d Make build_status_from_logs take files rather than huge strings.
      from  5471061 Remove updating of samba-docs and lorikeet. Move samba-web and build-farm to git.

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


- Log -----------------------------------------------------------------
commit 9e6974dc5ba1e112a1c35893858e9d90d9ba4961
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Nov 8 23:33:11 2010 +0100

    Make build_status_from_logs take files rather than huge strings.

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

Summary of changes:
 buildfarm/data.py            |   26 ++++++++++++++------------
 buildfarm/tests/test_data.py |   22 +++++++++++++---------
 2 files changed, 27 insertions(+), 21 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 5fe1fea..0b30cdc 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -48,6 +48,7 @@ def check_dir_exists(kind, path):
 
 def build_status_from_logs(log, err):
     """get status of build"""
+    log = log.read()
     m = re.search("TEST STATUS:(\s*\d+)", log)
     other_failures = set()
     if m:
@@ -89,7 +90,7 @@ def build_status_from_logs(log, err):
     if m:
         other_failures.add("panic")
 
-    if "No space left on device" in err or "No space left on device" in log:
+    if "No space left on device" in log:
         other_failures.add("disk full")
 
     if "maximum runtime exceeded" in log:
@@ -101,6 +102,11 @@ def build_status_from_logs(log, err):
     if m:
         stages = stages + (int(m.group(1).strip()),)
 
+    # Scan err file for specific
+    for l in err:
+        if "No space left on device" in l:
+            other_failures.add("disk full")
+
     return BuildStatus(stages, other_failures)
 
 
@@ -217,19 +223,15 @@ class Build(object):
 
         :return: tuple with build status
         """
-
-        f = self.read_log()
+        log = self.read_log()
         try:
-            log = f.read()
-        finally:
-            f.close()
-        f = self.read_err()
-        try:
-            err = f.read()
+            err = self.read_err()
+            try:
+                return build_status_from_logs(log, err)
+            finally:
+                err.close()
         finally:
-            f.close()
-
-        return build_status_from_logs(log, err)
+            log.close()
 
     def err_count(self):
         """get status of build"""
diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index 6184a64..7db834d 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -15,6 +15,7 @@
 #   along with this program; if not, write to the Free Software
 #   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
+from cStringIO import StringIO
 import os
 import tempfile
 import testtools
@@ -178,48 +179,51 @@ error3""")
 
 class BuildStatusFromLogs(testtools.TestCase):
 
+    def parse_logs(self, log, err):
+        return data.build_status_from_logs(StringIO(log), StringIO(err))
+
     def test_nothing(self):
-        s = data.build_status_from_logs("", "")
+        s = self.parse_logs("", "")
         self.assertEquals((None, None, None, None), s.stages)
         self.assertEquals(set(), s.other_failures)
 
     def test_disk_full(self):
         self.assertEquals(set(["disk full"]),
-            data.build_status_from_logs("foo\nbar\nNo space left on device\nla\n",
+            self.parse_logs("foo\nbar\nNo space left on device\nla\n",
                 "").other_failures)
         self.assertEquals(set(["disk full"]),
-            data.build_status_from_logs(
+            self.parse_logs(
                 "", "foo\nbar\nNo space left on device\nla\n").other_failures)
 
     def test_timeout(self):
         self.assertEquals(set(["timeout"]),
-            data.build_status_from_logs("foo\nbar\nmaximum runtime exceeded\nla\n",
+            self.parse_logs("foo\nbar\nmaximum runtime exceeded\nla\n",
                 "").other_failures)
 
     def test_status(self):
         log = """
 TEST STATUS:1
 """
-        res = data.build_status_from_logs(log, "")
+        res = self.parse_logs(log, "")
         self.assertEquals(res.stages[3], 1)
         log = """
 TEST STATUS:  1
 """
-        res = data.build_status_from_logs(log, "")
+        res = self.parse_logs(log, "")
         self.assertEquals(res.stages[3], 1)
         log = """
 CONFIGURE STATUS: 2
 TEST STATUS:  1
 CC_CHECKER STATUS:	2
 """
-        res = data.build_status_from_logs(log, "")
+        res = self.parse_logs(log, "")
         self.assertEquals(res.stages[4], 2)
         log = """
 CONFIGURE STATUS: 2
 ACTION PASSED: test
 CC_CHECKER STATUS:	2
 """
-        res = data.build_status_from_logs(log, "")
+        res = self.parse_logs(log, "")
         self.assertEquals(res.stages[4], 2)
         self.assertEquals(res.stages[3], 255)
         log = """
@@ -231,7 +235,7 @@ testsuite-failure: bar
 testsuite-failure: biz
 CC_CHECKER STATUS:	2
 """
-        res = data.build_status_from_logs(log, "")
+        res = self.parse_logs(log, "")
         self.assertEquals(res.stages[0], 2)
         self.assertEquals(res.stages[3], 3)
 


-- 
build.samba.org


More information about the samba-cvs mailing list