The branch, master has been updated via 74a3b6d Simplify status handling. via 6ccd329 Fix tests. via 3068034 Simplify host handling. from de658c7 Add log_checksum function.
http://gitweb.samba.org/?p=build-farm.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 74a3b6d82d1790a8ed798e792fc80abebc8d828e Author: Jelmer Vernooij <jel...@samba.org> Date: Sun Nov 7 22:13:16 2010 +0100 Simplify status handling. commit 6ccd329877c07e37091daf7bc266770478b9a46e Author: Jelmer Vernooij <jel...@samba.org> Date: Sun Nov 7 22:13:05 2010 +0100 Fix tests. commit 30680347bfbe5e79afcbb7d92682a4c1db50ecdc Author: Jelmer Vernooij <jel...@samba.org> Date: Sun Nov 7 22:05:52 2010 +0100 Simplify host handling. ----------------------------------------------------------------------- Summary of changes: buildfarm/data.py | 13 ++++--------- buildfarm/tests/test_data.py | 6 +++--- web/build.py | 40 +++++++++++++++------------------------- 3 files changed, 22 insertions(+), 37 deletions(-) Changeset truncated at 500 lines: diff --git a/buildfarm/data.py b/buildfarm/data.py index e6521ea..dd92b8e 100644 --- a/buildfarm/data.py +++ b/buildfarm/data.py @@ -39,11 +39,6 @@ class BuildStatus(object): def __str__(self): return repr((self.stages, self.other_failures)) - def setcheckerstage(self, val): - self.stages[4] = val - - def getcheckerstage(self): - return self.stages[4] def check_dir_exists(kind, path): if not os.path.isdir(path): @@ -98,13 +93,13 @@ def build_status_from_logs(log, err): if "maximum runtime exceeded" in log: other_failures.add("timeout") + stages = (cstatus, bstatus, istatus, tstatus) + m = re.search("CC_CHECKER STATUS:(\s*\d+)", log) if m: - sstatus = int(m.group(1).strip()) - else: - sstatus = None + stages = stages + (int(m.group(1).strip()),) - return BuildStatus([cstatus, bstatus, istatus, tstatus, sstatus], other_failures) + return BuildStatus(stages, other_failures) def lcov_extract_percentage(text): diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py index 71ad682..a8c2f2c 100755 --- a/buildfarm/tests/test_data.py +++ b/buildfarm/tests/test_data.py @@ -146,7 +146,7 @@ BUILD REVISION: 42 BUILD COMMIT TIME: 3 August 2010 """) build = self.x.get_build("tdb", "charis", "cc") - self.assertEquals(("42", "3 August 2010"), build.revision_details()) + self.assertEquals(("43", "3 August 2010"), build.revision_details()) def test_revision_details_no_timestamp(self): self.create_mock_logfile("tdb", "charis", "cc", contents=""" @@ -155,7 +155,7 @@ BUILD REVISION: 42 BLA """) build = self.x.get_build("tdb", "charis", "cc") - self.assertEquals(("42", None), build.revision_details()) + self.assertEquals(("43", None), build.revision_details()) def test_err_count(self): self.create_mock_logfile("tdb", "charis", "cc") @@ -175,7 +175,7 @@ class BuildStatusFromLogs(testtools.TestCase): def test_nothing(self): s = data.build_status_from_logs("", "") - self.assertEquals((None, None, None, None, None), s.stages) + self.assertEquals((None, None, None, None), s.stages) self.assertEquals(set(), s.other_failures) def test_disk_full(self): diff --git a/web/build.py b/web/build.py index 83b58c7..473af1d 100755 --- a/web/build.py +++ b/web/build.py @@ -50,7 +50,7 @@ history = history.History(db) hostsdb = hostdb.HostDatabase(os.path.join(os.path.dirname(__file__), "..", "hostdb.sqlite")) compilers = db.compilers -hostsiter = hostsdb.hosts() +hosts = dict([(host.name, host) for host in hostsdb.hosts()]) trees = db.trees OLDAGE = db.OLDAGE @@ -62,14 +62,6 @@ GITWEB_BASE = "http://gitweb.samba.org" # this is automatically filled in deadhosts = [] -def get_hosts(hostiterator): - d = {} - for h in hostiterator: - d[str(h.name)] = str(h.platform) - return d - -hosts = get_hosts(hostsiter) - def get_param(form, param): """get a param from the request, after sanitizing it""" if param not in form: @@ -120,8 +112,6 @@ def html_build_status(status): def build_status(myself, tree, host, compiler, rev=None): build = db.get_build(tree, host, compiler, rev) rawstatus = build.status() - if not rawstatus.getcheckerstage() and compiler != "checker": - rawstatus.setcheckerstage("-") status = html_build_status(rawstatus) return build_link(myself, tree, host, compiler, rev, status) @@ -170,12 +160,12 @@ def view_summary(myself, output_type): t = time.gmtime() yield "Build status as of %s\n\n" % t - for host in hosts.keys(): + for host in hosts.values(): for compiler in compilers: for tree in trees: try: - build = db.get_build(tree, host, compiler) - status = build_status(myself, tree, host, compiler) + build = db.get_build(tree, host.name, compiler) + status = build_status(myself, tree, host.name, compiler) except data.NoSuchBuildError: continue age_mtime = build.age_mtime() @@ -296,11 +286,11 @@ def view_recent_builds(myself, tree, sort_by): t = trees[tree] - for host in hosts.keys(): + for host in hosts.values(): for compiler in compilers: try: - status = build_status(myself, tree, host, compiler) - build = db.get_build(tree, host, compiler) + status = build_status(myself, tree, host.name, compiler) + build = db.get_build(tree, host.name, compiler) except data.NoSuchBuildError: pass else: @@ -308,7 +298,7 @@ def view_recent_builds(myself, tree, sort_by): age_ctime = build.age_ctime() (revision, revision_time) = build.revision_details() if revision: - all_builds.append([age_ctime, hosts[host], "<a href='%s?function=View+Host;host=%s;tree=%s;compiler=%s#%s'>%s</a>" % (myself, host, tree, compiler, host, host), compiler, tree, status, revision_link(myself, revision, tree), revision_time]) + all_builds.append([age_ctime, host.platform, "<a href='%s?function=View+Host;host=%s;tree=%s;compiler=%s#%s'>%s</a>" % (myself, host.name, tree, compiler, host.name, host.name), compiler, tree, status, revision_link(myself, revision, tree), revision_time]) all_builds.sort(cmp_funcs[sort_by]) @@ -361,7 +351,7 @@ def draw_dead_hosts(output_type, *deadhosts): for host in deadhosts: age_ctime = db.host_age(host) - yield "<tr><td>%s</td><td>%s</td><td>%s</td></tr>" % (host, hosts[host], util.dhm_time(age_ctime)) + yield "<tr><td>%s</td><td>%s</td><td>%s</td></tr>" % (host, hosts[host].platform, util.dhm_time(age_ctime)) yield "</tbody></table>" yield "</div>" @@ -398,7 +388,7 @@ def show_oldrevs(myself, tree, host, compiler): def view_build(myself, tree, host, compiler, rev, plain_logs=False): """view one build in detail""" # ensure the params are valid before using them - assert host in hosts.keys(), "unknown host %s" % host + assert host in hosts, "unknown host %s" % host assert compiler in compilers, "unknown compiler %s" % compiler assert tree in trees, "not a build tree %s" % tree @@ -439,7 +429,7 @@ def view_build(myself, tree, host, compiler, rev, plain_logs=False): yield "<table class='real'>\n" yield "<tr><td>Host:</td><td><a href='%s?function=View+Host;host=%s;tree=%s;"\ - "compiler=%s#'>%s</a> - %s</td></tr>\n" % (myself, host, tree, compiler, host, hosts[host]) + "compiler=%s#'>%s</a> - %s</td></tr>\n" % (myself, host, tree, compiler, host, hosts[host].platform) yield "<tr><td>Uname:</td><td>%s</td></tr>\n" % uname yield "<tr><td>Tree:</td><td>%s</td></tr>\n" % tree_link(myself, tree) yield "<tr><td>Build Revision:</td><td>%s</td></tr>\n" % revision_link(myself, revision, tree) @@ -509,7 +499,7 @@ def view_host(myself, output_type, *requested_hosts): yield '<h2>Host summary:</h2>' for host in requested_hosts: - assert host in hosts.keys(), "unknown host" + assert host in hosts, "unknown host" for host in requested_hosts: # make sure we have some data from it @@ -539,7 +529,7 @@ def view_host(myself, output_type, *requested_hosts): else: yield "<div class='host summary'>" yield "<a id='host' name='host'/>" - yield "<h3>%s - %s</h3>" % (host, hosts[host]) + yield "<h3>%s - %s</h3>" % (host, hosts[host].platform) yield "<table class='real'>" yield "<thead><tr><th>Target</th><th>Build<br/>Revision</th><th>Build<br />Age</th><th>Status<br />config/build<br />install/test</th><th>Warnings</th></tr></thead>" yield "<tbody>" @@ -754,8 +744,8 @@ def main_menu(): yield "<form method='GET'>" yield "<div id='build-menu'>" yield "<select name='host'>" - for host in hosts: - yield "<option value='%s'>%s -- %s</option>\n" % (host, hosts[host], host) + for name, host in hosts.iteritems(): + yield "<option value='%s'>%s -- %s</option>\n" % (name, host.platform, name) yield "</select>" yield "<select name='tree'>" for tree, t in trees.iteritems(): -- build.samba.org