self.indice += 1
return "".join(make_collapsible_html('test', m.group(1), '', self.indice, 'skipped'))
+ def _format_pretestsuite(self, m):
+ self.indice += 1
+ return m.group(1)+"".join(make_collapsible_html('pretest', 'Pretest infos', m.group(2), self.indice, 'ok'))+"\n"+m.group(3)
+
def _format_testsuite(self, m):
testName = m.group(1)
content = m.group(2)
else:
errorReason = ""
self.indice += 1
+ if m.group(3) in ("error", "failure"):
+ self.test_links.append([testName, 'lnk-test-%d' %self.indice])
return "".join(make_collapsible_html('test', testName, content+errorReason, self.indice, status))
def _format_test(self, m):
# do some pretty printing for the actions
pattern = re.compile("(Running action\s+([\w\-]+)$(?:\s^.*$)*?\sACTION\ (PASSED|FAILED):\ ([\w\-]+)$)", re.M)
log = pattern.sub(self._pretty_print, log)
+ buf = ""
log = re.sub("""
--==--==--==--==--==--==--==--==--==--==--.*?
==========================================\s+
""", self._format_stage, log)
+ pattern = re.compile("(Running action test).*$\s((?:^.*$\s)*?)^((?:skip-)?testsuite: )", re.M)
+ log = pattern.sub(self._format_pretestsuite, log)
+
log = re.sub("skip-testsuite: ([\w\-=,_:\ /.&; \(\)]+).*?",
self._format_skip_testsuite, log)
+ self.test_links = []
pattern = re.compile("^testsuite: (.+)$\s((?:^.*$\s)*?)testsuite-(\w+): .*?(?:(\[$\s(?:^.*$\s)*?^\]$)|$)", re.M)
log = pattern.sub(self._format_testsuite, log)
log = re.sub("""
(success|xfail|failure|skip|uxsuccess): [\w\-=,_:\ /.&; \(\)]+( \[.*?\])?.*?
""", self._format_test, log)
+ for tst in self.test_links:
+ buf = "%s\n<A href='#%s'>%s</A>" % (buf, tst[1], tst[0])
+
+ if not buf == "":
+ buf = "%s\n" % buf
+ divhtml = "".join(make_collapsible_html('testlinks', 'Shortcut to failed tests', buf, self.indice, ""))
+ log = re.sub("Running action\s+test", divhtml, log)
return "<pre>%s</pre>" % log
# note that we may be inside a <pre>, so we don't put any extra whitespace
# in this html
yield "<div class='%s unit %s' id='%s-%s'>" % (type, status, type, id)
- yield "<a href=\"javascript:handle('%s');\">" % id
+ yield "<a name='lnk-%s-%s' href=\"javascript:handle('%s');\">" % (type, id, id)
yield "<img id='img-%s' name='img-%s' alt='%s' src='%s' />" % (id, id, status, icon)
yield "<div class='%s title'>%s</div></a>" % (type, title)
yield "<div class='%s status %s'>%s</div>" % (type, status, status)
class ViewBuildPage(BuildFarmPage):
- def show_oldrevs(self, myself, tree, host, compiler):
+ def show_oldrevs(self, myself, build, host, compiler, limit):
"""show the available old revisions, if any"""
+
+ tree = build.tree
old_builds = self.buildfarm.builds.get_old_builds(tree, host, compiler)
if not old_builds:
yield "<thead><tr><th>Revision</th><th>Status</th><th>Age</th></tr></thead>\n"
yield "<tbody>\n"
+ nb = 0
for old_build in old_builds:
+ if limit >= 0 and nb >= limit:
+ break
+ nb = nb + 1
yield "<tr><td>%s</td><td>%s</td><td>%s</td></tr>\n" % (
revision_link(myself, old_build.revision, tree),
build_link(myself, old_build),
yield "</tbody></table>\n"
- def render(self, myself, build, plain_logs=False):
+ yield "<p><a href='%s/limit/-1'>Show all previous build list</a>\n" % (build_uri(myself, build))
+
+ def render(self, myself, build, plain_logs=False, limit=10):
"""view one build in detail"""
uname = None
yield "<tr><td>configure options:</td><td>%s</td></tr>\n" % config
yield "</table>\n"
- yield "".join(self.show_oldrevs(myself, build.tree, build.host, build.compiler))
+ yield "".join(self.show_oldrevs(myself, build, build.host, build.compiler, limit))
# check the head of the output for our magic string
rev_var = ""
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>"
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))
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>"
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":
import difflib
yield "".join(difflib.unified_diff(subunit_other, subunit_this))
- elif subfn in ("", None):
+ elif subfn in ("", "limit", None):
+ if subfn == "limit":
+ try:
+ limit = int(wsgiref.util.shift_path_info(environ))
+ except:
+ limit = 10
+ else:
+ limit = 10
start_response('200 OK', [
('Content-type', 'text/html; charset=utf-8')])
- yield "".join(self.html_page(form, page.render(myself, build, False)))
+ yield "".join(self.html_page(form, page.render(myself, build, False, limit)))
elif fn in ("", None):
start_response('200 OK', [
('Content-type', 'text/html; charset=utf-8')])