The branch, master has been updated via 73e47d1 Refactor html out of buildfarm.data. via 8ad36a0 Extract some generic functions. from 6d5e933 Try to override make test that is broken
http://gitweb.samba.org/?p=build-farm.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 73e47d19b2aaeb79cb7856251fa853c6bd77c561 Author: Jelmer Vernooij <jel...@samba.org> Date: Fri Nov 5 16:51:01 2010 +0100 Refactor html out of buildfarm.data. commit 8ad36a03ef67addb7c7c5b07faa545121b4a2dc6 Author: Jelmer Vernooij <jel...@samba.org> Date: Fri Nov 5 16:42:39 2010 +0100 Extract some generic functions. ----------------------------------------------------------------------- Summary of changes: buildfarm/data.py | 139 ++++++++++++++++++++++++++++------------------------ web/build.py | 10 +++- 2 files changed, 82 insertions(+), 67 deletions(-) Changeset truncated at 500 lines: diff --git a/buildfarm/data.py b/buildfarm/data.py index 0c0383d..665492f 100644 --- a/buildfarm/data.py +++ b/buildfarm/data.py @@ -34,6 +34,69 @@ def check_dir_exists(kind, path): raise Exception("%s directory %s does not exist" % (kind, path)) +def build_status_from_logs(log, err): + """get status of build""" + m = re.search("TEST STATUS:(.*)", log) + if m: + tstatus = m.group(1) + else: + m = re.search("ACTION (PASSED|FAILED): test", log) + if m: + test_failures = len(re.findall("testsuite-(failure|error): ", log)) + test_successes = len(re.findall("testsuite-success: ", log)) + if test_successes > 0: + tstatus = test_failures + else: + tstatus = 255 + else: + tstatus = None + + m = re.search("INSTALL STATUS:(.*)", log) + if m: + istatus = m.group(1) + else: + istatus = None + + m = re.search("BUILD STATUS:(.*)", log) + if m: + bstatus = m.group(1) + else: + bstatus = None + + m = re.search("CONFIGURE STATUS:(.*)", log) + if m: + cstatus = m.group(1) + else: + cstatus = None + + other_failures = set() + m = re.search("(PANIC|INTERNAL ERROR):.*", log) + if m: + other_failures.add("panic") + + if "No space left on device" in err or "No space left on device" in log: + other_failures.add("disk full") + + if "maximum runtime exceeded" in log: + other_failures.add("timeout") + + m = re.search("CC_CHECKER STATUS: (.*)", log) + if m: + sstatus = m.group(1) + else: + sstatus = None + + return ((cstatus, bstatus, istatus, tstatus, sstatus), other_failures) + + +def lcov_extract_percentage(text): + m = re.search('\<td class="headerItem".*?\>Code\ \;covered\:\<\/td\>.*?\n.*?\<td class="headerValue".*?\>([0-9.]+) \%', text) + if m: + return m.group(1) + else: + return None + + class NoSuchBuildError(Exception): """The build with the specified name does not exist.""" @@ -126,14 +189,13 @@ class Build(object): def status(self): """get status of build - :return: string with build status + :return: tuple with build status """ - # FIXME: This should return a tuple log = self.read_log() err = self.read_err() - return self._store.build_status_from_logs(log, err) + return build_status_from_logs(log, err) def err_count(self): """get status of build""" @@ -283,60 +345,6 @@ class BuildResultStore(object): return os.path.join(self.datadir, "oldrevs/build.%s.%s.%s-%s" % (tree, host, compiler, rev)) return os.path.join(self.datadir, "upload/build.%s.%s.%s" % (tree, host, compiler)) - def build_status_from_logs(self, log, err): - """get status of build""" - m = re.search("TEST STATUS:(.*)", log) - if m: - tstatus = m.group(1) - else: - m = re.search("ACTION (PASSED|FAILED): test", log) - if m: - test_failures = len(re.findall("testsuite-(failure|error): ", log)) - test_successes = len(re.findall("testsuite-success: ", log)) - if test_successes > 0: - tstatus = test_failures - else: - tstatus = 255 - else: - tstatus = None - - m = re.search("INSTALL STATUS:(.*)", log) - if m: - istatus = m.group(1) - else: - istatus = None - - m = re.search("BUILD STATUS:(.*)", log) - if m: - bstatus = m.group(1) - else: - bstatus = None - - m = re.search("CONFIGURE STATUS:(.*)", log) - if m: - cstatus = m.group(1) - else: - cstatus = None - - other_failures = set() - m = re.search("(PANIC|INTERNAL ERROR):.*", log) - if m: - other_failures.add("panic") - - if "No space left on device" in err or "No space left on device" in log: - other_failures.add("disk full") - - if "maximum runtime exceeded" in log: - other_failures.add("timeout") - - m = re.search("CC_CHECKER STATUS: (.*)", log) - if m: - sstatus = m.group(1) - else: - sstatus = None - - return ((cstatus, bstatus, istatus, tstatus, sstatus), other_failures) - def lcov_status(self, tree): """get status of build""" cachefile = os.path.join(self.cachedir, "lcov.%s.%s.status" % ( @@ -354,17 +362,20 @@ class BuildResultStore(object): st2 = None if st2 and st1.st_ctime <= st2.st_mtime: - return util.FileLoad(cachefile) + ret = util.FileLoad(cachefile) + if ret == "": + return None + return ret lcov_html = util.FileLoad(file) - m = re.search('\<td class="headerItem".*?\>Code\ \;covered\:\<\/td\>.*?\n.*?\<td class="headerValue".*?\>([0-9.]+) \%', lcov_html) - if m: - ret = "<a href=\"/lcov/data/%s/%s\">%s %%</a>" % (self.LCOVHOST, tree, m.group(1)) - else: + perc = lcov_extract_percentage(lcov_html) + if perc is None: ret = "" + else: + ret = perc if self.readonly: util.FileSave(cachefile, ret) - return ret + return perc def get_old_revs(self, tree, host, compiler): """get a list of old builds and their status.""" @@ -383,7 +394,7 @@ class BuildResultStore(object): r = { "STATUS": build.status(), "REVISION": rev, - "TIMESTAMP": stat.st_ctime + "TIMESTAMP": build.age_ctime(), } ret.append(r) diff --git a/web/build.py b/web/build.py index 1aacd7e..3b8aa50 100755 --- a/web/build.py +++ b/web/build.py @@ -192,10 +192,14 @@ def view_summary(myself, output_type): yield "<td>" yield "%d</td>" % panic_count[tree] try: - lcov_data = db.lcov_status(tree) + lcov_status = db.lcov_status(tree) except data.NoSuchBuildError: - lcov_data = "" - yield "<td>%s</td>" % lcov_data + yield "<td></td>" + else: + if lcov_status is not None: + yield "<td><a href=\"/lcov/data/%s/%s\">%s %%</a></td>" % (db.LCOVHOST, tree, lcov_status) + else: + yield "<td></td>" yield "</tr>" if output_type == 'text': -- build.samba.org