parametrized front end

This commit is contained in:
2010-04-15 17:13:29 -07:00
parent ed85c97d07
commit 1460ce948f
9 changed files with 75 additions and 91 deletions

View File

@@ -363,7 +363,7 @@ while curtime < endtime and chunk < totalchunks:
continue
# we only care about unit test boxes
unittest_indices = [tboxdata['build_name_index'][x] for x in tboxdata['build_name_index'] if re.search("test|xpc", x)]
unittest_indices = [tboxdata['build_name_index'][x] for x in tboxdata['build_name_index'] if re.search("test|xpc|check", x)]
# read build table
# 'TestFailed' expected log format is "result | test | optional text".
testfailedRe = re.compile(r"(TEST-UNEXPECTED-.*) \| (.*) \|(.*)")
@@ -406,7 +406,7 @@ while curtime < endtime and chunk < totalchunks:
pass
# Parse log to save 'TestFailed' results.
elif status == BuildStatus.TestFailed or status == BuildStatus.Burning or status == BuildStatus.Burning:
elif status == BuildStatus.TestFailed :
logging.info("Checking build log for '%s' at %d (%s)" % (name, starttime, ctime(starttime)))
try:
# Grab the build log.
@@ -433,14 +433,14 @@ while curtime < endtime and chunk < totalchunks:
logging.error("Unexpected error: %s" % sys.exc_info()[0])
#XXX: handle me?
## Ignore 'Burning' builds: tests may have run nontheless, but it's safer to discard them :-|
#elif status == BuildStatus.Burning:
# continue
#
## Ignore 'Exception' builds: should only be worse than 'Burning'.
## (Don't know much at time of writing, since this feature is not active yet: see bug 476656 and follow-ups.)
#elif status == BuildStatus.Exception:
# continue
# Ignore 'Burning' builds: tests may have run nontheless, but it's safer to discard them :-|
elif status == BuildStatus.Burning:
continue
# Ignore 'Exception' builds: should only be worse than 'Burning'.
# (Don't know much at time of writing, since this feature is not active yet: see bug 476656 and follow-ups.)
elif status == BuildStatus.Exception:
continue
# Save 'Unknown' status failure: this should not happen (unless new statuses are created), but we want to know if it does.
elif status == BuildStatus.Unknown:

View File

@@ -87,23 +87,23 @@ function MyTip(arg)
<body>
<div id="nav10d" style="position:absolute; left:3px; top:102px; z-index:0"><a onMouseOut="SwapImgRestore()" onMouseOver="SwapImage('nav10','','http://people.mozilla.com/~mnandigama/images/nav11363110a.gif',1)" href="latest" <img name="nav10" onLoad="PreloadImages('http://people.mozilla.com/~mnandigama/images/nav11363110a.gif')" alt="Latest Failures" border=0 src="http://people.mozilla.com/~mnandigama/images/nav11363110i.gif"></a></div>
<div id="nav11d" style="position:absolute; left:3px; top:135px; z-index:0"><a onMouseOut="SwapImgRestore()" onMouseOver="SwapImage('nav11','','http://people.mozilla.com/~mnandigama/images/nav11363111a.gif',1)" href="topfails"><img name="nav11" onLoad="PreloadImages('http://people.mozilla.com/~mnandigama/images/nav11363111a.gif')" alt="Top 25 Failures" border=0 src="http://people.mozilla.com/~mnandigama/images/nav11363111i.gif"></a></div>
<div id="nav12d" style="position:absolute; left:3px; top:168px; z-index:0"><a onMouseOut="SwapImgRestore()" onMouseOver="SwapImage('nav12','','http://people.mozilla.com/~mnandigama/images/nav11363112a.gif',1)" href="tests"><img name="nav12" onLoad="PreloadImages('http://people.mozilla.com/~mnandigama/images/nav11363112a.gif')" alt="All Failed Tests" border=0 src="http://people.mozilla.com/~mnandigama/images/nav11363112i.gif"></a></div>
<div id="nav13d" style="position:absolute; left:3px; top:201px; z-index:0"><a onMouseOut="SwapImgRestore()" onMouseOver="SwapImage('nav13','','http://people.mozilla.com/~mnandigama/images/nav11363113a.gif',1)" href="failswindow?window=7d"><img name="nav13" onLoad="PreloadImages('http://people.mozilla.com/~mnandigama/images/nav11363113a.gif')" alt="Failures from last X days" border=0 src="http://people.mozilla.com/~mnandigama/images/nav11363113i.gif"></a></div>
<div id="nav14d" style="position:absolute; left:3px; top:234px; z-index:0"><a onMouseOut="SwapImgRestore()" onMouseOver="SwapImage('nav14','','http://people.mozilla.com/~mnandigama/images/nav11363114a.gif',1)" href="Help"><img name="nav14" onLoad="PreloadImages('http://people.mozilla.com/~mnandigama/images/nav11363114a.gif')" alt="Help" border=0 src="http://people.mozilla.com/~mnandigama/images/nav11363114i.gif"></a></div>
<div id="nav10d" style="position:absolute; left:3px; top:102px; z-index:0"><a onMouseOut="SwapImgRestore()" onMouseOver="SwapImage('nav10','','http://people.mozilla.com/~mnandigama/images/nav11363110a.gif',1)" href="{% url latest tree=tree %}" <img name="nav10" onLoad="PreloadImages('http://people.mozilla.com/~mnandigama/images/nav11363110a.gif')" alt="Latest Failures" border=0 src="http://people.mozilla.com/~mnandigama/images/nav11363110i.gif"></a></div>
<div id="nav11d" style="position:absolute; left:3px; top:135px; z-index:0"><a onMouseOut="SwapImgRestore()" onMouseOver="SwapImage('nav11','','http://people.mozilla.com/~mnandigama/images/nav11363111a.gif',1)" href="{% url topfails tree=tree %}"><img name="nav11" onLoad="PreloadImages('http://people.mozilla.com/~mnandigama/images/nav11363111a.gif')" alt="Top 25 Failures" border=0 src="http://people.mozilla.com/~mnandigama/images/nav11363111i.gif"></a></div>
<div id="nav12d" style="position:absolute; left:3px; top:168px; z-index:0"><a onMouseOut="SwapImgRestore()" onMouseOver="SwapImage('nav12','','http://people.mozilla.com/~mnandigama/images/nav11363112a.gif',1)" href="{% url tests tree=tree %}"><img name="nav12" onLoad="PreloadImages('http://people.mozilla.com/~mnandigama/images/nav11363112a.gif')" alt="All Failed Tests" border=0 src="http://people.mozilla.com/~mnandigama/images/nav11363112i.gif"></a></div>
<div id="nav13d" style="position:absolute; left:3px; top:201px; z-index:0"><a onMouseOut="SwapImgRestore()" onMouseOver="SwapImage('nav13','','http://people.mozilla.com/~mnandigama/images/nav11363113a.gif',1)" href="{% url failswindow tree=tree %}?window=7d"<img name="nav13" onLoad="PreloadImages('http://people.mozilla.com/~mnandigama/images/nav11363113a.gif')" alt="Failures from last X days" border=0 src="http://people.mozilla.com/~mnandigama/images/nav11363113i.gif"></a></div>
<div id="nav14d" style="position:absolute; left:3px; top:234px; z-index:0"><a onMouseOut="SwapImgRestore()" onMouseOver="SwapImage('nav14','','http://people.mozilla.com/~mnandigama/images/nav11363114a.gif',1)" href="{% url Help tree=tree %}"><img name="nav14" onLoad="PreloadImages('http://people.mozilla.com/~mnandigama/images/nav11363114a.gif')" alt="Help" border=0 src="http://people.mozilla.com/~mnandigama/images/nav11363114i.gif"></a></div>
<div id="image1" style="position:absolute; overflow:hidden; left:3px; top:1px; width:179px; height:68px; z-index:1"><img src="http://people.mozilla.com/~mnandigama/images/logo-wordmark.png" alt="Firefox Logo" title="http://www.mozilla.com" border=0 width=179 height=68></div>
<div id="text1" style="position:absolute; overflow:hidden; left:351px; top:2px; width:491px; height:41px; z-index:3">
<div class="wpmd">
<div><font color="#CC4200" face="Tahoma" class="ws24"><B>Mozilla Tinderbox Topfails Dashboard</B></font></div>
</div></div>
<!--
<div id="nav20d" style="position:absolute; left:311px; top:45px; z-index:2"><a onMouseOut="SwapImgRestore()" onMouseOver="SwapImage('nav20','','http://people.mozilla.com/~mnandigama/images/nav14052410a.gif',1)" title="Click for Firefox Trunk Topfails Dashboard" href="#" ><img name="nav20" onLoad="PreloadImages('http://people.mozilla.com/~mnandigama/images/nav14052410a.gif')" alt="Firefox Trunk" border=0 src="http://people.mozilla.com/~mnandigama/images/nav14052410i.gif"></a></div>
<div id="nav21d" style="position:absolute; left:439px; top:45px; z-index:2"><a onMouseOut="SwapImgRestore()" onMouseOver="SwapImage('nav21','','http://people.mozilla.com/~mnandigama/images/nav14052411a.gif',1)" href="#"><img name="nav21" onLoad="PreloadImages('http://people.mozilla.com/~mnandigama/images/nav14052411a.gif')" title="Click for Firefox 3.6 Topfails Dashboard" alt="Firefox3.6" border=0 src="http://people.mozilla.com/~mnandigama/images/nav14052411i.gif"></a></div>
<div id="nav22d" style="position:absolute; left:567px; top:45px; z-index:2"><a onMouseOut="SwapImgRestore()" onMouseOver="SwapImage('nav22','','http://people.mozilla.com/~mnandigama/images/nav14052412a.gif',1)" title="Click for Thunderbird Trunk Topfails Dashboard" href="#"><img name="nav22" onLoad="PreloadImages('http://people.mozilla.com/~mnandigama/images/nav14052412a.gif')" alt="Thunderbird" border=0 src="http://people.mozilla.com/~mnandigama/images/nav14052412i.gif"></a></div>
<div id="nav23d" style="position:absolute; left:695px; top:45px; z-index:2"><a onMouseOut="SwapImgRestore()" onMouseOver="SwapImage('nav23','','http://people.mozilla.com/~mnandigama/images/nav14052413a.gif',1)" title="Click for SeaMonkey Topfails Dashboard" href="#"><img name="nav23" onLoad="PreloadImages('http://people.mozilla.com/~mnandigama/images/nav14052413a.gif')" alt="SeaMonkey" border=0 src="http://people.mozilla.com/~mnandigama/images/nav14052413i.gif"></a></div>
-->
<div id="nav20d" style="position:absolute; left:311px; top:45px; z-index:2"><a onMouseOut="SwapImgRestore()" onMouseOver="SwapImage('nav20','','http://people.mozilla.com/~mnandigama/images/nav14052410a.gif',1)" title="Click for Firefox Trunk Topfails Dashboard" href="{% url latest tree='Firefox' %}" ><img name="nav20" onLoad="PreloadImages('http://people.mozilla.com/~mnandigama/images/nav14052410a.gif')" alt="Firefox Trunk" border=0 src="http://people.mozilla.com/~mnandigama/images/nav14052410i.gif"></a></div>
<div id="nav21d" style="position:absolute; left:439px; top:45px; z-index:2"><a onMouseOut="SwapImgRestore()" onMouseOver="SwapImage('nav21','','http://people.mozilla.com/~mnandigama/images/nav14052411a.gif',1)" href="{% url latest tree='Firefox3.6' %}"><img name="nav21" onLoad="PreloadImages('http://people.mozilla.com/~mnandigama/images/nav14052411a.gif')" title="Click for Firefox 3.6 Topfails Dashboard" alt="Firefox3.6" border=0 src="http://people.mozilla.com/~mnandigama/images/nav14052411i.gif"></a></div>
<div id="nav22d" style="position:absolute; left:567px; top:45px; z-index:2"><a onMouseOut="SwapImgRestore()" onMouseOver="SwapImage('nav22','','http://people.mozilla.com/~mnandigama/images/nav14052412a.gif',1)" title="Click for Thunderbird Trunk Topfails Dashboard" href="{% url latest tree='Thunderbird' %}"><img name="nav22" onLoad="PreloadImages('http://people.mozilla.com/~mnandigama/images/nav14052412a.gif')" alt="Thunderbird" border=0 src="http://people.mozilla.com/~mnandigama/images/nav14052412i.gif"></a></div>
<div id="nav23d" style="position:absolute; left:695px; top:45px; z-index:2"><a onMouseOut="SwapImgRestore()" onMouseOver="SwapImage('nav23','','http://people.mozilla.com/~mnandigama/images/nav14052413a.gif',1)" title="Click for SeaMonkey Topfails Dashboard" href="{% url latest tree='SeaMonkey' %}"><img name="nav23" onLoad="PreloadImages('http://people.mozilla.com/~mnandigama/images/nav14052413a.gif')" alt="SeaMonkey" border=0 src="http://people.mozilla.com/~mnandigama/images/nav14052413i.gif"></a></div>
<div id="text2" style="position:absolute; overflow:hidden; left:190px; top:102px; width:800px; z-index:4">

View File

@@ -4,7 +4,7 @@
<table>
<tr><th>Count</th><th align="left">Test name</th></tr>
{% for f in failures %}
<tr><td>{{ f.0 }}</td><td><a href="{% url viewer.views.test %}?name={{ f.1 }}">{{ f.1 }}</a></td></tr>
<tr><td>{{ f.count }}</td><td><a href="{% url viewer.views.test tree=tree %}?name={{ f.name }}">{{ f.name }}</a></td></tr>
{% endfor %}
</table>
{% endblock %}

View File

@@ -7,8 +7,8 @@
<h3>Most recent test failures</h3>
<ul>
{% for f in failures %}
<li>{{ f.build.startdate|date:"Y-m-d H:i" }} {{ f.build.tree.name }} {{ f.build.get_os_display }}: <a href="{% url viewer.views.test %}?name={{ f.name }}">{{ f.name }}</a>,
<a href="{% url viewer.views.timeline %}?name={{ f.name }}">timeline</a>
<li>{{ f.build.startdate|date:"Y-m-d H:i" }} {{ f.build.tree.name }} {{ f.build.get_os_display }}: <a href="{% url viewer.views.test tree=tree %}?name={{ f.name }}">{{ f.name }}</a>,
<a href="{% url viewer.views.timeline tree=tree %}?name={{ f.name }}">timeline</a>
- {{ f.description }}</li>
{% endfor %}
</ul>

View File

@@ -8,7 +8,7 @@
<h3>All known failing tests</h3>
<ul>
{% for t in tests %}
<li><a href="{% url viewer.views.test %}?name={{ t }}">{{ t }}</a></li>
<li><a href="{% url viewer.views.test tree=tree %}?name={{ t }}">{{ t }}</a></li>
{% endfor %}
</ul>
{% endblock %}

View File

@@ -4,7 +4,7 @@
<table>
<tr><th>Count</th><th align="left">Test name</th></tr>
{% for f in failures %}
<tr><td>{{ f.0 }}</td><td><a href="{% url viewer.views.test %}?name={{ f.1 }}">{{ f.1 }}</a></td></tr>
<tr><td>{{ f.count }}</td><td><a href="{% url viewer.views.test tree=tree %}?name={{ f.name }}">{{ f.name}}</a></td></tr>
{% endfor %}
</table>
{% endblock %}

View File

@@ -5,18 +5,16 @@ from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('unittestweb.viewer.views',
(r'^$', 'index'),
(r'^/$', 'index'),
(r'^trees$', 'trees'),
(r'^trees/(?P<tree>.+)$', 'tree'),
(r'^changesets$', 'changesets'),
(r'^changesets/(?P<changeset>[a-f0-9]+)$', 'changeset'),
(r'^tests$', 'tests'),
(r'^test$', 'test'),
(r'^timeline$', 'timeline'),
(r'^topfails$', 'topfails'),
(r'^failswindow$','failswindow'),
(r'^latest$','latest'),
(r'^Help$','Help'),
(r'^base$','base'),
#url(r'^(?P<tree>.+)?$', 'latest', name='index'),
url(r'^trees/(?P<tree>.+)?$','trees', name='trees'),
url(r'^tree/(?P<tree>.+)?$','tree', name='tree'),
url(r'^changesets/(?P<tree>.+)?$','changesets', name='changesets'),
url(r'^changesets/(?P<tree>.+)/(?P<changeset>[a-f0-9]+)$', 'changeset', name='changeset'),
url(r'^tests/(?P<tree>.+)?$','tests', name='tests'),
url(r'^test/(?P<tree>.+)?$','test', name='test'),
url(r'^timeline/(?P<tree>.+)?$','timeline', name='timeline'),
url(r'^topfails/(?P<tree>.+)?$','topfails', name='topfails'),
url(r'^failswindow/(?P<tree>.+)?$','failswindow', name='failswindow'),
url(r'^latest/(?P<tree>.+)?$','latest', name='latest'),
url(r'^Help/(?P<tree>.+)?$','Help', name='Help'),
)

View File

@@ -75,13 +75,10 @@ class Tests(models.Model):
class Meta:
db_table = 'tests'
def get_most_failing_tests():
cursor = connection.cursor()
cursor.execute("select count(*), name from (select builds.id, name from builds inner join tests on builds.id = tests.buildid group by builds.id, name) aaa group by name order by count(*) desc limit 25")
for row in cursor:
yield row
def get_most_failing_tests(tree):
return Tests.objects.filter(build__tree__name=tree).values('name').annotate(count=models.Count('name')).order_by('-count')
def get_fails_in_timerange(self):
def get_fails_in_timerange(self,tree):
# Get current time, in seconds.
endtime = int(time())
@@ -100,10 +97,7 @@ def get_fails_in_timerange(self):
'h': 3600}[m.group(2)]
# Set current time to beginning of requested timespan ending now.
curtime = endtime - timespan
#print curtime, timespan, endtime-curtime
cursor = connection.cursor()
statement = "select count(*), name from (select builds.id, name from builds inner join tests on builds.id = tests.buildid where builds.starttime >"+str(curtime)+" group by builds.id, name) aaa group by name order by count(*) DESC"
cursor.execute(statement)
for row in cursor:
yield row
qs = get_most_failing_tests(tree)
return qs.filter(build__starttime__gt=curtime)

View File

@@ -4,69 +4,61 @@ import re
from django.http import HttpResponse
import json
def index(request):
return render_to_response('viewer/index.html')
def latest(request):
if request.GET.has_key('tree'):
tree =request.GET['tree']
failures = get_list_or_404(Tests.objects.all().order_by('-build__starttime')[:10])
def latest(request,tree='Firefox'):
failures = get_list_or_404(Tests.objects.filter(build__tree__name=tree).order_by('-build__starttime'))[:10]
if request.GET.has_key('json'):
jtext = [{"Test_name":f.name, "Build_status":f.build.status, "Logfile": f.build.tinderbox_link(),"Changeset":f.build.json_changeset_link() , "Failure_description":f.description} for f in failures]
return HttpResponse(json.dumps(jtext))
else:
return render_to_response('viewer/latest.html', {'failures': failures})
return render_to_response('viewer/latest.html', {'failures': failures, 'tree' : tree})
def index(request):
failures = get_list_or_404(Tests.objects.all().order_by('-build__starttime')[:10])
return render_to_response('viewer/index.html', {'failures': failures})
def base(request):
return render_to_response('viewer/base.html')
def index(request,tree='Firefox'):
failures = get_list_or_404(Tests.objects.filter(build__tree__name=tree).order_by('-build__starttime')[:10])
return render_to_response('viewer/index.html', {'failures': failures, 'tree' : tree})
def trees(request):
def trees(request,tree='Firefox'):
alltrees = Trees.objects.all().order_by('name')
return render_to_response('viewer/trees.html', {'trees': alltrees})
return render_to_response('viewer/trees.html', {'trees': alltrees , 'tree' : tree})
def tree(request, tree):
def tree(request, tree='Firefox'):
newestbuilds = get_list_or_404(Builds.objects.filter(tree__name__exact=tree).order_by('-starttime')[:5])
return render_to_response('viewer/tree.html', {'tree': tree, 'newestbuilds': newestbuilds})
def changesets(request):
build_csets = Builds.objects.values('changeset').distinct()
return render_to_response('viewer/changesets.html', {'changesets': [b['changeset'] for b in build_csets]})
def changesets(request,tree='Firefox'):
build_csets = Builds.objects.filter(tree__name__exact=tree).values('changeset').distinct()
return render_to_response('viewer/changesets.html', { 'tree' : tree,'changesets': [b['changeset'] for b in build_csets]})
def changeset(request, changeset):
def changeset(request, changeset,tree='Firefox'):
builds = get_list_or_404(Builds, changeset__exact=changeset)
return render_to_response('viewer/changeset.html', {'changeset': changeset, 'builds': builds})
return render_to_response('viewer/changeset.html', {'changeset': changeset, 'builds': builds, 'tree' : tree})
def tests(request):
test_names = Tests.objects.values('name').distinct()
def tests(request,tree='Firefox'):
test_names = Tests.objects.filter(build__tree__name__exact=tree).values('name').distinct()
if request.GET.has_key('json'):
jtext = list(test_names)
return HttpResponse(json.dumps(jtext))
else:
return render_to_response('viewer/tests.html', {'tests': [t['name'] for t in test_names]})
return render_to_response('viewer/tests.html', { 'tree' : tree, 'tests': [t['name'] for t in test_names]})
def test(request):
failures = get_list_or_404(Tests.objects.filter(name__exact=request.GET['name']).order_by('-build__starttime'))
return render_to_response('viewer/test.html', {'test': request.GET['name'], 'failures': failures})
def test(request,tree='Firefox'):
failures = get_list_or_404(Tests.objects.filter(build__tree__name__exact=tree).filter(name__exact=request.GET['name']).order_by('-build__starttime'))
return render_to_response('viewer/test.html', {'test': request.GET['name'], 'failures': failures, 'tree' : tree})
def topfails(request):
failures = get_most_failing_tests()
def topfails(request,tree='Firefox'):
failures = get_most_failing_tests(tree)[:25]
if request.GET.has_key('json'):
jtext = list(failures)
return HttpResponse(json.dumps(jtext))
else:
return render_to_response('viewer/topfails.html', {'failures': failures})
return render_to_response('viewer/topfails.html', {'failures': failures, 'tree' : tree})
def Help(request):
return render_to_response('viewer/Help.html')
def Help(request,tree):
return render_to_response('viewer/Help.html',{'tree':tree})
def timeline(request):
def timeline(request,tree='Firefox'):
name = request.GET['name']
builds = get_list_or_404(Builds, tests__name__exact=name)
builds = get_list_or_404(Builds.objects.filter(tree__name__exact=tree), tests__name__exact=name)
buildlist = []
desc_list = []
for b in builds:
@@ -83,12 +75,12 @@ def timeline(request):
})
return render_to_response('viewer/timeline.html', {'test': name,
'descriptions': desc_list,
'builds': buildlist})
'builds': buildlist, 'tree' : tree})
def failswindow(request):
def failswindow(request,tree='Firefox'):
period=request.GET['window']
m = re.match("(\d+)([ymwdh])", period)
failures = get_fails_in_timerange(period)
failures = get_fails_in_timerange(period,tree)
if request.GET.has_key('json'):
jtext = list(failures)
return HttpResponse(json.dumps(jtext))
@@ -107,5 +99,5 @@ def failswindow(request):
prd = 'days'
return render_to_response('viewer/failswindow.html', {'failures': failures,'n':m.group(1),'d':prd})
return render_to_response('viewer/failswindow.html', {'failures': failures,'n':m.group(1),'d':prd, 'tree' : tree})