return "failed"
elif subunit_result == "xfail":
return "xfailed"
+ elif subunit_result == "uxsuccess":
+ return "uxpassed"
else:
return "unknown"
log = re.sub("""
^test: ([\w\-=,_:\ /.&; \(\)]+).*?
(.*?)
- (success|xfail|failure|skip): [\w\-=,_:\ /.&; \(\)]+( \[.*?\])?.*?
+ (success|xfail|failure|skip|uxsuccess): [\w\-=,_:\ /.&; \(\)]+( \[.*?\])?.*?
""", self._format_test, log)
return "<pre>%s</pre>" % log
:param title: the title to be displayed
"""
if status.lower() in ("", "failed"):
- icon = 'icon_hide_16.png'
+ icon = '/icon_hide_16.png'
else:
- icon = 'icon_unhide_16.png'
+ icon = '/icon_unhide_16.png'
# trim leading and trailing whitespace
output = output.strip()
return "<span class='old'>%s</span>" % util.dhm_time(age)
return util.dhm_time(age)
+ def tree_link(self, myself, treename):
+ try:
+ return tree_link(myself, self.buildfarm.trees[treename])
+ except KeyError:
+ return treename
def render(self, output_type):
raise NotImplementedError(self.render)
(myself, build.host, build.tree, build.compiler, build.host, self.buildfarm.hostdb[build.host].platform.encode("utf-8"))
if uname is not None:
yield "<tr><td>Uname:</td><td>%s</td></tr>\n" % uname
- yield "<tr><td>Tree:</td><td>%s</td></tr>\n" % tree_link(myself, self.buildfarm.trees[build.tree])
+ yield "<tr><td>Tree:</td><td>%s</td></tr>\n" % self.tree_link(myself, build.tree)
yield "<tr><td>Build Revision:</td><td>%s</td></tr>\n" % revision_link(myself, build.revision, build.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_link(myself, build)
yield "<div id='log'>"
- yield "<p><a href='%s/+subunit'>Subunit output</a></p>" % build_uri(myself, build)
+ yield "<p><a href='%s/+subunit'>Subunit output</a>" % build_uri(myself, build)
+ try:
+ previous_build = self.buildfarm.builds.get_previous_build(build.tree, build.host, build.compiler, build.revision)
+ except NoSuchBuildError:
+ pass
+ else:
+ yield ", <a href='%s/+subunit-diff/%s'>diff against previous</a>" % (
+ build_uri(myself, build), previous_build.log_checksum())
+ yield "</p>"
+ yield "<p><a href='%s/+stdout'>Standard output (as plain text)</a>, " % build_uri(myself, build)
+ yield "<a href='%s/+stderr'>Standard error (as plain text)</a>" % build_uri(myself, build)
+ yield "</p>"
if not plain_logs:
yield "<p>Switch to the <a href='%s?function=View+Build;host=%s;tree=%s"\
all_builds = []
def build_platform(build):
+ host = self.buildfarm.hostdb[build.host]
+ return host.platform.encode("utf-8")
+
+ def build_platform_safe(build):
try:
host = self.buildfarm.hostdb[build.host]
except hostdb.NoSuchHost:
"revision": lambda a, b: cmp(a.revision, b.revision),
"age": lambda a, b: cmp(a.age, b.age),
"host": lambda a, b: cmp(a.host, b.host),
- "platform": lambda a, b: cmp(build_platform(a), build_platform(b)),
+ "platform": lambda a, b: cmp(build_platform_safe(a), build_platform_safe(b)),
"compiler": lambda a, b: cmp(a.compiler, b.compiler),
"status": lambda a, b: cmp(a.status(), b.status()),
}
yield "<tbody>"
for build in all_builds:
- yield "<tr>"
- yield "<td>%s</td>" % util.dhm_time(build.age)
- yield "<td>%s</td>" % revision_link(myself, build.revision, build.tree)
- yield "<td>%s</td>" % build.tree
- 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_link(myself, build)
- yield "</tr>"
+ try:
+ build_platform_name = build_platform(build)
+ yield "<tr>"
+ yield "<td>%s</td>" % util.dhm_time(build.age)
+ yield "<td>%s</td>" % revision_link(myself, build.revision, build.tree)
+ yield "<td>%s</td>" % build.tree
+ yield "<td>%s</td>" % build_platform_name
+ yield "<td>%s</td>" % host_link(myself, build.host)
+ yield "<td>%s</td>" % build.compiler
+ yield "<td>%s</td>" % build_link(myself, build)
+ yield "</tr>"
+ except hostdb.NoSuchHost:
+ pass
yield "</tbody></table>"
yield "</div>"
def _render_build_html(self, myself, build):
warnings = build.err_count()
yield "<tr>"
- yield "<td><span class='tree'>" + tree_link(myself, self.buildfarm.trees[build.tree]) +"</span>/" + build.compiler + "</td>"
+ 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_link(myself, build)
try:
host = self.buildfarm.hostdb[hostname]
except hostdb.NoSuchHost:
- deadhosts.append(hostname)
continue
builds = list(self.buildfarm.get_host_builds(hostname))
if len(builds) > 0:
try:
platform = self.buildfarm.hostdb[host].platform.encode("utf-8")
except hostdb.NoSuchHost:
- platform = "UNKNOWN"
+ continue
yield "<tr><td>%s</td><td>%s</td><td>%s</td></tr>" %\
(host, platform, util.dhm_time(age))
for tree in sorted(self.buildfarm.trees.keys()):
yield "<tr>"
- yield "<td>%s</td>" % tree_link(myself, self.buildfarm.trees[tree])
+ yield "<td>%s</td>" % self.tree_link(myself, tree)
yield "<td>%s</td>" % host_count[tree]
yield "<td>%s</td>" % broken_count[tree]
if panic_count[tree]:
else:
yield "<td>"
yield "%d</td>" % panic_count[tree]
+
try:
lcov_status = self.buildfarm.lcov_status(tree)
except NoSuchBuildError:
self.buildfarm.LCOVHOST, tree, lcov_status)
else:
yield "<td></td>"
+
+ try:
+ unused_fns = self.buildfarm.unused_fns(tree)
+ except NoSuchBuildError:
+ yield "<td></td>"
+ else:
+ if unused_fns is not None:
+ yield "<td><a href=\"/lcov/data/%s/%s/%s\">Unused Functions</a></td>" % (
+ self.buildfarm.LCOVHOST, tree, unused_fns)
+ else:
+ yield "<td></td>"
yield "</tr>"
yield "</tbody></table>"
class DiffPage(HistoryPage):
def render(self, myself, tree, revision):
- t = self.buildfarm.trees[tree]
+ try:
+ t = self.buildfarm.trees[tree]
+ except KeyError:
+ yield "Unknown tree %s" % tree
+ return
branch = t.get_branch()
(entry, diff) = branch.diff(revision)
# get information about the current diff
yield " <meta name='description' contents='Home of the Samba Build Farm, the automated testing facility.'/>\n"
yield " <meta name='robots' contents='noindex'/>"
yield " <link rel='stylesheet' href='/build_farm.css' type='text/css' media='all'/>"
- yield " <link rel='stylesheet' href='http://master.samba.org/samba/style/common.css' type='text/css' media='all'/>"
+ yield " <link rel='stylesheet' href='http://www.samba.org/samba/style/common.css' type='text/css' media='all'/>"
yield " <link rel='shortcut icon' href='http://www.samba.org/samba/images/favicon.ico'/>"
yield " </head>"
yield "<body>"
revision = get_param(form, 'revision')
page = DiffPage(self.buildfarm)
yield "".join(self.html_page(form, page.render(myself, tree, revision)))
+ elif fn_name == "Summary":
+ page = ViewSummaryPage(self.buildfarm)
+ yield "".join(self.html_page(form, page.render_html(myself)))
else:
yield "Unknown function %s" % fn_name
else:
fn = wsgiref.util.shift_path_info(environ)
if fn == "tree":
- start_response('200 OK', [
- ('Content-type', 'text/html; charset=utf-8')])
tree = wsgiref.util.shift_path_info(environ)
subfn = wsgiref.util.shift_path_info(environ)
if subfn in ("", None, "+recent"):
+ start_response('200 OK', [
+ ('Content-type', 'text/html; charset=utf-8')])
page = ViewRecentBuildsPage(self.buildfarm)
yield "".join(self.html_page(form, page.render(myself, tree, get_param(form, 'sortby') or 'age')))
+ elif subfn == "+recent-ids":
+ start_response('200 OK', [
+ ('Content-type', 'text/plain; charset=utf-8')])
+ yield "".join([x.log_checksum()+"\n" for x in self.buildfarm.get_tree_builds(tree) if x.has_log()])
else:
+ start_response('200 OK', [
+ ('Content-type', 'text/html; charset=utf-8')])
yield "Unknown subfn %s" % subfn
elif fn == "host":
start_response('200 OK', [
yield "".join(self.html_page(form, page.render_html(myself, wsgiref.util.shift_path_info(environ))))
elif fn == "build":
build_checksum = wsgiref.util.shift_path_info(environ)
- build = self.buildfarm.builds.get_by_checksum(build_checksum)
+ try:
+ build = self.buildfarm.builds.get_by_checksum(build_checksum)
+ except NoSuchBuildError:
+ start_response('404 Page Not Found', [
+ ('Content-Type', 'text/html; charset=utf8')])
+ yield "No build with checksum %s found" % build_checksum
+ return
page = ViewBuildPage(self.buildfarm)
subfn = wsgiref.util.shift_path_info(environ)
if subfn == "+plain":
yield "".join(page.render(myself, build, True))
elif subfn == "+subunit":
start_response('200 OK', [
- ('Content-type', 'text/x-subunit; charset=utf-8')])
+ ('Content-type', 'text/x-subunit; charset=utf-8'),
+ ('Content-Disposition', 'attachment; filename="%s.%s.%s-%s.subunit"' % (build.tree, build.host, build.compiler, build.revision))])
try:
yield build.read_subunit().read()
except NoTestOutput:
yield "There was no test output"
+ elif subfn == "+stdout":
+ start_response('200 OK', [
+ ('Content-type', 'text/plain; charset=utf-8'),
+ ('Content-Disposition', 'attachment; filename="%s.%s.%s-%s.log"' % (build.tree, build.host, build.compiler, build.revision))])
+ yield build.read_log().read()
+ elif subfn == "+stderr":
+ start_response('200 OK', [
+ ('Content-type', 'text/plain; charset=utf-8'),
+ ('Content-Disposition', 'attachment; filename="%s.%s.%s-%s.err"' % (build.tree, build.host, build.compiler, build.revision))])
+ yield build.read_err().read()
+ elif subfn == "+subunit-diff":
+ start_response('200 OK', [
+ ('Content-type', 'text/plain; charset=utf-8')])
+ subunit_this = build.read_subunit().readlines()
+ other_build_checksum = wsgiref.util.shift_path_info(environ)
+ other_build = self.buildfarm.builds.get_by_checksum(other_build_checksum)
+ subunit_other = other_build.read_subunit().readlines()
+ import difflib
+ yield "".join(difflib.unified_diff(subunit_other, subunit_this))
+
elif subfn in ("", None):
start_response('200 OK', [
('Content-type', 'text/html; charset=utf-8')])