ostatus = []
if "panic" in status.other_failures:
- return span("status panic", "PANIC")
+ ostatus.append(span("status panic", "PANIC"))
if "disk full" in status.other_failures:
- return span("status failed", "disk full")
+ ostatus.append(span("status failed", "disk full"))
if "timeout" in status.other_failures:
- return span("status failed", "timeout")
+ ostatus.append(span("status failed", "timeout"))
if "inconsistent test result" in status.other_failures:
ostatus.append(span("status failed", "unexpected return code"))
bstatus = "/".join([span_status(s) for s in status.stages])
- if bstatus == "":
- bstatus = "?"
- return "/".join([bstatus] + ostatus)
+ ret = bstatus
+ if ostatus:
+ ret += "(%s)" % ",".join(ostatus)
+ if ret == "":
+ ret = "?"
+ return ret
-def build_status_html(myself, build):
+def build_link(myself, build):
params = {
"host": build.host,
"tree": build.tree,
for old_build in old_builds:
yield "<tr><td>%s</td><td>%s</td><td>%s</td></tr>\n" % (
revision_link(myself, old_build.revision, tree),
- build_status_html(myself, old_build),
+ build_link(myself, old_build),
util.dhm_time(old_build.age))
yield "</tbody></table>\n"
yield "<tr><td>Tree:</td><td>%s</td></tr>\n" % self.tree_link(myself, tree)
yield "<tr><td>Build Revision:</td><td>%s</td></tr>\n" % revision_link(myself, build.revision, tree)
yield "<tr><td>Build age:</td><td><div class='age'>%s</div></td></tr>\n" % self.red_age(build.age)
- yield "<tr><td>Status:</td><td>%s</td></tr>\n" % build_status_html(myself, build)
+ yield "<tr><td>Status:</td><td>%s</td></tr>\n" % build_link(myself, build)
yield "<tr><td>Compiler:</td><td>%s</td></tr>\n" % compiler
if cflags is not None:
yield "<tr><td>CFLAGS:</td><td>%s</td></tr>\n" % cflags
yield "<td>%s</td>" % build_platform(build)
yield "<td>%s</td>" % host_link(myself, build.host)
yield "<td>%s</td>" % build.compiler
- yield "<td>%s</td>" % build_status_html(myself, build)
+ yield "<td>%s</td>" % build_link(myself, build)
yield "</tr>"
yield "</tbody></table>"
yield "</div>"
yield "<td><span class='tree'>" + self.tree_link(myself, build.tree) +"</span>/" + build.compiler + "</td>"
yield "<td>" + revision_link(myself, build.revision, build.tree) + "</td>"
yield "<td><div class='age'>" + self.red_age(build.age) + "</div></td>"
- yield "<td><div class='status'>%s</div></td>" % build_status_html(myself, build)
+ yield "<td><div class='status'>%s</div></td>" % build_link(myself, build)
yield "<td>%s</td>" % warnings
yield "</tr>"
yield "<span class=\"label\">Builds: </span>\n"
builds = self.buildfarm.get_revision_builds(tree.name, entry.revision)
for build in builds:
- yield "%s(%s) " % (build_status_html(myself, build),
- host_link(myself, build.host))
+ yield "%s(%s) " % (build_link(myself, build), host_link(myself, build.host))
yield "</div>\n"
yield "</div>\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.
+
+from buildfarm.data import BuildStatus
+from buildfarm.web import html_build_status
+
+import testtools
+
+class BuildStatusHtmlTests(testtools.TestCase):
+
+ def test_empty(self):
+ status = BuildStatus()
+ self.assertEquals("?", html_build_status(status))
+
+ def test_failed_build(self):
+ status = BuildStatus([("CONFIGURE", 0), ("BUILD", 4)])
+ self.assertEquals(
+ '<span class="status passed">ok</span>/<span class="status failed">4</span>',
+ html_build_status(status))
+
+ def test_disk_full(self):
+ status = BuildStatus([("CONFIGURE", 0), ("BUILD", 4)], set(["timeout"]))
+ self.assertEquals(
+ '<span class="status passed">ok</span>/<span class="status failed">4</span>'
+ '(<span class="status failed">timeout</span>)', html_build_status(status))