class ViewHostPage(BuildFarmPage):
+ def _render_build(self, myself, build):
+ try:
+ (revision, revision_time) = build.revision_details()
+ except data.MissingRevisionInfo:
+ revision = None
+ age_mtime = build.age_mtime()
+ age_ctime = build.age_ctime()
+ warnings = build.err_count()
+ status = build_status_html(myself, build)
+ if row == 0:
+ if output_type == 'text':
+ yield "%-12s %-10s %-10s %-10s %-10s\n" % (
+ "Tree", "Compiler", "Build Age", "Status", "Warnings")
+ else:
+ yield "<div class='host summary'>"
+ yield "<a id='host' name='host'/>"
+ yield "<h3>%s - %s</h3>" % (host, self.buildfarm.hostdb.host(host).platform.encode("utf-8"))
+ 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>"
+
+ if output_type == 'text':
+ yield "%-12s %-10s %-10s %-10s %-10s\n" % (
+ tree, compiler, util.dhm_time(age_mtime),
+ util.strip_html(status), warnings)
+ else:
+ yield "<tr>"
+ yield "<td><span class='tree'>" + self.tree_link(myself, tree) +"</span>/" + compiler + "</td>"
+ yield "<td>" + revision_link(myself, revision, tree) + "</td>"
+ yield "<td><div class='age'>" + self.red_age(age_mtime) + "</div></td>"
+ yield "<td><div class='status'>%s</div></td>" % status
+ yield "<td>%s</td>" % warnings
+ yield "</tr>"
+ row+=1
+
def render(self, myself, output_type, *requested_hosts):
"""print the host's table of information"""
continue
row = 0
-
for compiler in self.buildfarm.compilers:
for tree in sorted(self.buildfarm.trees.keys()):
try:
except data.NoSuchBuildError:
pass
else:
- try:
- (revision, revision_time) = build.revision_details()
- except data.MissingRevisionInfo:
- revision = None
- age_mtime = build.age_mtime()
- age_ctime = build.age_ctime()
- warnings = build.err_count()
- status = build_status_html(myself, build)
- if row == 0:
- if output_type == 'text':
- yield "%-12s %-10s %-10s %-10s %-10s\n" % (
- "Tree", "Compiler", "Build Age", "Status", "Warnings")
- else:
- yield "<div class='host summary'>"
- yield "<a id='host' name='host'/>"
- yield "<h3>%s - %s</h3>" % (host, self.buildfarm.hostdb.host(host).platform.encode("utf-8"))
- 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>"
-
- if output_type == 'text':
- yield "%-12s %-10s %-10s %-10s %-10s\n" % (
- tree, compiler, util.dhm_time(age_mtime),
- util.strip_html(status), warnings)
- else:
- yield "<tr>"
- yield "<td><span class='tree'>" + self.tree_link(myself, tree) +"</span>/" + compiler + "</td>"
- yield "<td>" + revision_link(myself, revision, tree) + "</td>"
- yield "<td><div class='age'>" + self.red_age(age_mtime) + "</div></td>"
- yield "<td><div class='status'>%s</div></td>" % status
- yield "<td>%s</td>" % warnings
- yield "</tr>"
- row+=1
+ self._render_build(myself, build)
+
if row != 0:
if output_type == 'text':
yield "\n"
--- /dev/null
+#!/usr/bin/python
+# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2010
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+import testtools
+from buildfarm.web import build_link
+
+
+class BuildLinkTests(testtools.TestCase):
+
+ def test_build_link_no_rev(self):
+ self.assertEquals("<a href='myself?function=View+Build;host=charis;tree=tdb;compiler=gcc'>status</a>", build_link("myself", "tdb", "charis", "gcc", None, "status"))
+
+
+ def test_build_link_rev(self):
+ self.assertEquals("<a href='myself?function=View+Build;host=charis;tree=tdb;compiler=gcc;revision=42'>status</a>", build_link("myself", "tdb", "charis", "gcc", "42", "status"))