first batch of code
This commit is contained in:
0
unittest-logs/unittestweb/__init__.py
Executable file
0
unittest-logs/unittestweb/__init__.py
Executable file
BIN
unittest-logs/unittestweb/__init__.pyc
Normal file
BIN
unittest-logs/unittestweb/__init__.pyc
Normal file
Binary file not shown.
11
unittest-logs/unittestweb/manage.py
Executable file
11
unittest-logs/unittestweb/manage.py
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env python
|
||||
from django.core.management import execute_manager
|
||||
try:
|
||||
import settings # Assumed to be in the same directory.
|
||||
except ImportError:
|
||||
import sys
|
||||
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
execute_manager(settings)
|
||||
75
unittest-logs/unittestweb/settings.py
Executable file
75
unittest-logs/unittestweb/settings.py
Executable file
@@ -0,0 +1,75 @@
|
||||
# Django settings for unittestweb project.
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
ADMINS = (
|
||||
('Murali Nandigama', 'murali.nandigama@gmail.com'),
|
||||
)
|
||||
|
||||
MANAGERS = ADMINS
|
||||
|
||||
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
|
||||
DATABASE_NAME = 'topfailsdb' # Or path to database file if using sqlite3.
|
||||
DATABASE_USER = 'root' # Not used with sqlite3.
|
||||
DATABASE_PASSWORD = '' # Not used with sqlite3.
|
||||
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
|
||||
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
|
||||
|
||||
# Local time zone for this installation. Choices can be found here:
|
||||
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||
# although not all choices may be available on all operating systems.
|
||||
# If running in a Windows environment this must be set to the same as your
|
||||
# system time zone.
|
||||
TIME_ZONE = 'America/Los_Angeles'
|
||||
|
||||
# Language code for this installation. All choices can be found here:
|
||||
# http://www.i18nguy.com/unicode/language-identifiers.html
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
# If you set this to False, Django will make some optimizations so as not
|
||||
# to load the internationalization machinery.
|
||||
USE_I18N = True
|
||||
|
||||
# Absolute path to the directory that holds media.
|
||||
# Example: "/home/media/media.lawrence.com/"
|
||||
MEDIA_ROOT = ''
|
||||
|
||||
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
||||
# trailing slash if there is a path component (optional in other cases).
|
||||
# Examples: "http://media.lawrence.com", "http://example.com/media/"
|
||||
MEDIA_URL = ''
|
||||
|
||||
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
|
||||
# trailing slash.
|
||||
# Examples: "http://foo.com/media/", "/media/".
|
||||
ADMIN_MEDIA_PREFIX = '/media/'
|
||||
|
||||
# Make this unique, and don't share it with anybody.
|
||||
SECRET_KEY = '0_020s+&-*5!y7yn@h9ubk#+4pnzq5$egrx)%5wq!11@)54gtu'
|
||||
|
||||
# List of callables that know how to import templates from various sources.
|
||||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.filesystem.load_template_source',
|
||||
'django.template.loaders.app_directories.load_template_source',
|
||||
# 'django.template.loaders.eggs.load_template_source',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
)
|
||||
|
||||
ROOT_URLCONF = 'unittestweb.urls'
|
||||
|
||||
TEMPLATE_DIRS = (
|
||||
'./templates'
|
||||
)
|
||||
|
||||
INSTALLED_APPS = (
|
||||
'django.contrib.contenttypes',
|
||||
'unittestweb.viewer'
|
||||
)
|
||||
BIN
unittest-logs/unittestweb/settings.pyc
Normal file
BIN
unittest-logs/unittestweb/settings.pyc
Normal file
Binary file not shown.
75
unittest-logs/unittestweb/settings.py~
Executable file
75
unittest-logs/unittestweb/settings.py~
Executable file
@@ -0,0 +1,75 @@
|
||||
# Django settings for unittestweb project.
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
ADMINS = (
|
||||
('Murali Nandigama', 'murali.nandigama@gmail.com'),
|
||||
)
|
||||
|
||||
MANAGERS = ADMINS
|
||||
|
||||
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
|
||||
DATABASE_NAME = 'topfailsdb' # Or path to database file if using sqlite3.
|
||||
DATABASE_USER = 'root' # Not used with sqlite3.
|
||||
DATABASE_PASSWORD = 'mkngama' # Not used with sqlite3.
|
||||
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
|
||||
DATABASE_PORT = '3306' # Set to empty string for default. Not used with sqlite3.
|
||||
|
||||
# Local time zone for this installation. Choices can be found here:
|
||||
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||
# although not all choices may be available on all operating systems.
|
||||
# If running in a Windows environment this must be set to the same as your
|
||||
# system time zone.
|
||||
TIME_ZONE = 'America/Los_Angeles'
|
||||
|
||||
# Language code for this installation. All choices can be found here:
|
||||
# http://www.i18nguy.com/unicode/language-identifiers.html
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
# If you set this to False, Django will make some optimizations so as not
|
||||
# to load the internationalization machinery.
|
||||
USE_I18N = True
|
||||
|
||||
# Absolute path to the directory that holds media.
|
||||
# Example: "/home/media/media.lawrence.com/"
|
||||
MEDIA_ROOT = ''
|
||||
|
||||
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
||||
# trailing slash if there is a path component (optional in other cases).
|
||||
# Examples: "http://media.lawrence.com", "http://example.com/media/"
|
||||
MEDIA_URL = ''
|
||||
|
||||
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
|
||||
# trailing slash.
|
||||
# Examples: "http://foo.com/media/", "/media/".
|
||||
ADMIN_MEDIA_PREFIX = '/media/'
|
||||
|
||||
# Make this unique, and don't share it with anybody.
|
||||
SECRET_KEY = '0_020s+&-*5!y7yn@h9ubk#+4pnzq5$egrx)%5wq!11@)54gtu'
|
||||
|
||||
# List of callables that know how to import templates from various sources.
|
||||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.filesystem.load_template_source',
|
||||
'django.template.loaders.app_directories.load_template_source',
|
||||
# 'django.template.loaders.eggs.load_template_source',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
)
|
||||
|
||||
ROOT_URLCONF = 'unittestweb.urls'
|
||||
|
||||
TEMPLATE_DIRS = (
|
||||
'./templates'
|
||||
)
|
||||
|
||||
INSTALLED_APPS = (
|
||||
'django.contrib.contenttypes',
|
||||
'unittestweb.viewer'
|
||||
)
|
||||
6
unittest-logs/unittestweb/templates/viewer/changeset.html
Executable file
6
unittest-logs/unittestweb/templates/viewer/changeset.html
Executable file
@@ -0,0 +1,6 @@
|
||||
<h1>Changeset {{ changeset }}</h1>
|
||||
<ul>
|
||||
{% for build in builds %}
|
||||
<li>{{ build.tree }}: {{ build.get_os_display }}: {{ build.get_status_display }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
6
unittest-logs/unittestweb/templates/viewer/changesets.html
Executable file
6
unittest-logs/unittestweb/templates/viewer/changesets.html
Executable file
@@ -0,0 +1,6 @@
|
||||
<h1>Changesets</h1>
|
||||
<ul>
|
||||
{% for c in changesets %}
|
||||
<li><a href="{% url viewer.views.changeset c %}">{{ c }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
8
unittest-logs/unittestweb/templates/viewer/index.html
Executable file
8
unittest-logs/unittestweb/templates/viewer/index.html
Executable file
@@ -0,0 +1,8 @@
|
||||
<h1>Most recent test failures</h1>
|
||||
<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>
|
||||
- {{ f.description }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
8
unittest-logs/unittestweb/templates/viewer/test.html
Executable file
8
unittest-logs/unittestweb/templates/viewer/test.html
Executable file
@@ -0,0 +1,8 @@
|
||||
<h1>Test results for {{ test }}</h1>
|
||||
<ul>
|
||||
<li style="display:none"><ul>
|
||||
{% for f in failures %}{% ifchanged f.build.id %}</ul></li><li>
|
||||
<a href="{{ f.build.tinderbox_link|safe }}">{{ f.build.startdate|date:"Y-m-d H:i" }} {{ f.build.tree }} {{ f.build.get_os_display }}</a> [{{ f.build.changeset_link|safe }}]:
|
||||
<ul>{% endifchanged %}
|
||||
<li>{{ f.description }}</li>{% endfor %}
|
||||
</ul>
|
||||
6
unittest-logs/unittestweb/templates/viewer/tests.html
Executable file
6
unittest-logs/unittestweb/templates/viewer/tests.html
Executable file
@@ -0,0 +1,6 @@
|
||||
<h1>All known failing tests</h1>
|
||||
<ul>
|
||||
{% for t in tests %}
|
||||
<li><a href="{% url viewer.views.test %}?name={{ t }}">{{ t }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
72
unittest-logs/unittestweb/templates/viewer/timeline.html
Executable file
72
unittest-logs/unittestweb/templates/viewer/timeline.html
Executable file
@@ -0,0 +1,72 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Timeline for {{ test }}</title>
|
||||
<script src="http://static.simile.mit.edu/exhibit/api-2.0/exhibit-api.js?autoCreate=false"
|
||||
type="text/javascript"></script>
|
||||
<script src="http://static.simile.mit.edu/exhibit/extensions-2.0/time/time-extension.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
var json = {"items": [
|
||||
{% for bd in builds %}
|
||||
{
|
||||
"type": "Build",
|
||||
"id": "bld{{ bd.build.id }}",
|
||||
"label": "{{ bd.os }} {{ bd.build.changeset }}",
|
||||
"desc": "{{ bd.description|escapejs|escape }}",
|
||||
"desc_id": "{{ bd.desctype }}",
|
||||
"time": "{{ bd.time }}",
|
||||
"os": "{{ bd.os }}",
|
||||
"rev": "{{ bd.build.changeset }}",
|
||||
},
|
||||
{% endfor %}
|
||||
],
|
||||
"properties": {
|
||||
"time": {"valueType": "date"},
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
window.database = Exhibit.Database.create();
|
||||
window.database.loadData(json);
|
||||
window.exhibit = Exhibit.create();
|
||||
window.exhibit.configureFromDOM();
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2>Timeline for {{ test }}</h2>
|
||||
|
||||
<div ex:role="lens" ex:itemTypes="Build">
|
||||
<div><span ex:content=".os"></span> <a
|
||||
ex:href-subcontent="http://hg.mozilla.org/mozilla-central/rev/{{.rev}}"
|
||||
target="_blank" ex:content=".rev"></a></div> <pre ex:content=".desc"></pre>
|
||||
</div>
|
||||
<div id="blds" ex:role="exhibit-collection" ex:itemTypes="Build"></div>
|
||||
|
||||
<div ex:role="view"
|
||||
ex:viewClass="Timeline"
|
||||
ex:start=".time"
|
||||
ex:topBandPixelsPerUnit="50",
|
||||
ex:bottomBandPixelsPerUnit="50",
|
||||
></div>
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td>
|
||||
{% for desc in descriptions %}
|
||||
<pre>{{desc}}</pre>
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td valign="top" style="padding-left: 5em;">
|
||||
<div ex:role="facet" ex:expression=".desc_id"
|
||||
ex:facetLabel="Description"></div>
|
||||
</td>
|
||||
<td valign="top" style="padding-left: 5em;">
|
||||
<div ex:role="facet" ex:expression=".os"
|
||||
ex:facetLabel="OS"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body> </html>
|
||||
7
unittest-logs/unittestweb/templates/viewer/topfails.html
Executable file
7
unittest-logs/unittestweb/templates/viewer/topfails.html
Executable file
@@ -0,0 +1,7 @@
|
||||
<h1>Top 25 failing tests</h1>
|
||||
<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>
|
||||
{% endfor %}
|
||||
</table>
|
||||
6
unittest-logs/unittestweb/templates/viewer/tree.html
Executable file
6
unittest-logs/unittestweb/templates/viewer/tree.html
Executable file
@@ -0,0 +1,6 @@
|
||||
<h1>{{ tree }}</h1>
|
||||
<ul>
|
||||
{% for build in newestbuilds %}
|
||||
<li>{{ build.get_os_display }}: {{ build.get_status_display }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
7
unittest-logs/unittestweb/templates/viewer/trees.html
Executable file
7
unittest-logs/unittestweb/templates/viewer/trees.html
Executable file
@@ -0,0 +1,7 @@
|
||||
<h1>Trees</h1>
|
||||
<ul>
|
||||
{% for tree in trees %}
|
||||
<li><a href="{% url viewer.views.tree tree.name %}">{{ tree.name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
18
unittest-logs/unittestweb/urls.py
Executable file
18
unittest-logs/unittestweb/urls.py
Executable file
@@ -0,0 +1,18 @@
|
||||
from django.conf.urls.defaults import *
|
||||
|
||||
# Uncomment the next two lines to enable the admin:
|
||||
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'),
|
||||
)
|
||||
BIN
unittest-logs/unittestweb/urls.pyc
Normal file
BIN
unittest-logs/unittestweb/urls.pyc
Normal file
Binary file not shown.
18
unittest-logs/unittestweb/urls.py~
Executable file
18
unittest-logs/unittestweb/urls.py~
Executable file
@@ -0,0 +1,18 @@
|
||||
from django.conf.urls.defaults import *
|
||||
|
||||
# Uncomment the next two lines to enable the admin:
|
||||
# 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'),
|
||||
)
|
||||
0
unittest-logs/unittestweb/viewer/__init__.py
Executable file
0
unittest-logs/unittestweb/viewer/__init__.py
Executable file
BIN
unittest-logs/unittestweb/viewer/__init__.pyc
Normal file
BIN
unittest-logs/unittestweb/viewer/__init__.pyc
Normal file
Binary file not shown.
80
unittest-logs/unittestweb/viewer/models.py
Executable file
80
unittest-logs/unittestweb/viewer/models.py
Executable file
@@ -0,0 +1,80 @@
|
||||
# This is an auto-generated Django model module.
|
||||
# You'll have to do the following manually to clean this up:
|
||||
# * Rearrange models' order
|
||||
# * Make sure each model has one field with primary_key=True
|
||||
# Feel free to rename the models, but don't rename db_table values or field names.
|
||||
#
|
||||
# Also note: You'll have to insert the output of 'django-admin.py sqlcustom [appname]'
|
||||
# into your database.
|
||||
|
||||
from django.db import models, connection
|
||||
from datetime import datetime
|
||||
|
||||
class OS():
|
||||
Windows = 0
|
||||
Mac = 1
|
||||
Linux = 2
|
||||
Unknown = 3
|
||||
|
||||
OS_CHOICES = (
|
||||
(OS.Windows, 'Windows'),
|
||||
(OS.Mac, 'Mac'),
|
||||
(OS.Linux, 'Linux'),
|
||||
(OS.Unknown, 'Unknown')
|
||||
)
|
||||
|
||||
class BuildStatus():
|
||||
Success = 0
|
||||
TestFailed = 1
|
||||
Burning = 2
|
||||
Exception = 3
|
||||
Unknown = 4
|
||||
|
||||
BUILDSTATUS_CHOICES = (
|
||||
(BuildStatus.Success, 'Success'),
|
||||
(BuildStatus.TestFailed, 'Test Failed'),
|
||||
(BuildStatus.Burning, 'Burning'),
|
||||
(BuildStatus.Exception, 'Exception'),
|
||||
(BuildStatus.Unknown, 'Unknown')
|
||||
)
|
||||
|
||||
class Trees(models.Model):
|
||||
id = models.IntegerField(primary_key=True)
|
||||
name = models.TextField(blank=True)
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
class Meta:
|
||||
db_table = 'trees'
|
||||
|
||||
class Builds(models.Model):
|
||||
id = models.IntegerField(primary_key=True)
|
||||
tree = models.ForeignKey(Trees, db_column="treeid")
|
||||
os = models.IntegerField(choices=OS_CHOICES)
|
||||
starttime = models.IntegerField(null=True, blank=True)
|
||||
status = models.IntegerField(choices=BUILDSTATUS_CHOICES)
|
||||
logfile = models.TextField(blank=True)
|
||||
changeset = models.TextField(blank=True)
|
||||
def startdate(self):
|
||||
return datetime.fromtimestamp(self.starttime)
|
||||
def changeset_link(self):
|
||||
return '<a href="%s/rev/%s">%s</a>' % ("http://hg.mozilla.org/mozilla-central", self.changeset, self.changeset)
|
||||
def tinderbox_link(self):
|
||||
if self.logfile:
|
||||
return "http://tinderbox.mozilla.org/showlog.cgi?log=%s/%s" % (self.tree.name, self.logfile)
|
||||
return "http://tinderbox.mozilla.org/showbuilds.cgi?tree=%s&maxdate=%d&hours=3" % (self.tree.name, self.starttime)
|
||||
class Meta:
|
||||
db_table = 'builds'
|
||||
|
||||
class Tests(models.Model):
|
||||
id = models.IntegerField(primary_key=True)
|
||||
build = models.ForeignKey(Builds, db_column="buildid")
|
||||
name = models.TextField(blank=True)
|
||||
description = models.TextField(blank=True)
|
||||
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) group by name order by count(*) desc limit 250")
|
||||
for row in cursor:
|
||||
yield row
|
||||
BIN
unittest-logs/unittestweb/viewer/models.pyc
Normal file
BIN
unittest-logs/unittestweb/viewer/models.pyc
Normal file
Binary file not shown.
80
unittest-logs/unittestweb/viewer/models.py~
Executable file
80
unittest-logs/unittestweb/viewer/models.py~
Executable file
@@ -0,0 +1,80 @@
|
||||
# This is an auto-generated Django model module.
|
||||
# You'll have to do the following manually to clean this up:
|
||||
# * Rearrange models' order
|
||||
# * Make sure each model has one field with primary_key=True
|
||||
# Feel free to rename the models, but don't rename db_table values or field names.
|
||||
#
|
||||
# Also note: You'll have to insert the output of 'django-admin.py sqlcustom [appname]'
|
||||
# into your database.
|
||||
|
||||
from django.db import models, connection
|
||||
from datetime import datetime
|
||||
|
||||
class OS():
|
||||
Windows = 0
|
||||
Mac = 1
|
||||
Linux = 2
|
||||
Unknown = 3
|
||||
|
||||
OS_CHOICES = (
|
||||
(OS.Windows, 'Windows'),
|
||||
(OS.Mac, 'Mac'),
|
||||
(OS.Linux, 'Linux'),
|
||||
(OS.Unknown, 'Unknown')
|
||||
)
|
||||
|
||||
class BuildStatus():
|
||||
Success = 0
|
||||
TestFailed = 1
|
||||
Burning = 2
|
||||
Exception = 3
|
||||
Unknown = 4
|
||||
|
||||
BUILDSTATUS_CHOICES = (
|
||||
(BuildStatus.Success, 'Success'),
|
||||
(BuildStatus.TestFailed, 'Test Failed'),
|
||||
(BuildStatus.Burning, 'Burning'),
|
||||
(BuildStatus.Exception, 'Exception'),
|
||||
(BuildStatus.Unknown, 'Unknown')
|
||||
)
|
||||
|
||||
class Trees(models.Model):
|
||||
id = models.IntegerField(primary_key=True)
|
||||
name = models.TextField(blank=True)
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
class Meta:
|
||||
db_table = u'trees'
|
||||
|
||||
class Builds(models.Model):
|
||||
id = models.IntegerField(primary_key=True)
|
||||
tree = models.ForeignKey(Trees, db_column="treeid")
|
||||
os = models.IntegerField(choices=OS_CHOICES)
|
||||
starttime = models.IntegerField(null=True, blank=True)
|
||||
status = models.IntegerField(choices=BUILDSTATUS_CHOICES)
|
||||
logfile = models.TextField(blank=True)
|
||||
changeset = models.TextField(blank=True)
|
||||
def startdate(self):
|
||||
return datetime.fromtimestamp(self.starttime)
|
||||
def changeset_link(self):
|
||||
return '<a href="%s/rev/%s">%s</a>' % ("http://hg.mozilla.org/mozilla-central", self.changeset, self.changeset)
|
||||
def tinderbox_link(self):
|
||||
if self.logfile:
|
||||
return "http://tinderbox.mozilla.org/showlog.cgi?log=%s/%s" % (self.tree.name, self.logfile)
|
||||
return "http://tinderbox.mozilla.org/showbuilds.cgi?tree=%s&maxdate=%d&hours=3" % (self.tree.name, self.starttime)
|
||||
class Meta:
|
||||
db_table = u'builds'
|
||||
|
||||
class Tests(models.Model):
|
||||
ROWID = models.IntegerField(primary_key=True)
|
||||
build = models.ForeignKey(Builds, db_column="buildid")
|
||||
name = models.TextField(blank=True)
|
||||
description = models.TextField(blank=True)
|
||||
class Meta:
|
||||
db_table = u'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) group by name order by count(*) desc limit 250")
|
||||
for row in cursor:
|
||||
yield row
|
||||
55
unittest-logs/unittestweb/viewer/views.py
Executable file
55
unittest-logs/unittestweb/viewer/views.py
Executable file
@@ -0,0 +1,55 @@
|
||||
from django.shortcuts import render_to_response, get_list_or_404
|
||||
from unittestweb.viewer.models import Builds, Trees, Tests, OS_CHOICES, get_most_failing_tests
|
||||
|
||||
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 trees(request):
|
||||
alltrees = Trees.objects.all().order_by('name')
|
||||
return render_to_response('viewer/trees.html', {'trees': alltrees})
|
||||
|
||||
def tree(request, tree):
|
||||
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 changeset(request, changeset):
|
||||
builds = get_list_or_404(Builds, changeset__exact=changeset)
|
||||
return render_to_response('viewer/changeset.html', {'changeset': changeset, 'builds': builds})
|
||||
|
||||
def tests(request):
|
||||
test_names = Tests.objects.values('name').distinct()
|
||||
return render_to_response('viewer/tests.html', {'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 topfails(request):
|
||||
failures = get_most_failing_tests()
|
||||
return render_to_response('viewer/topfails.html', {'failures': failures})
|
||||
|
||||
def timeline(request):
|
||||
name = request.GET['name']
|
||||
builds = get_list_or_404(Builds, tests__name__exact=name)
|
||||
buildlist = []
|
||||
desc_list = []
|
||||
for b in builds:
|
||||
descs = b.tests_set.filter(name__exact=name).order_by('id')
|
||||
desc = '\n'.join(descs.values_list('description', flat=True))
|
||||
if desc not in desc_list:
|
||||
desc_list.append(desc)
|
||||
desc_i = desc_list.index(desc)
|
||||
buildlist.append({'build': b,
|
||||
'desctype': desc_i,
|
||||
'description': desc,
|
||||
'os': OS_CHOICES[b.os][1],
|
||||
'time': b.startdate().isoformat() + "Z",
|
||||
})
|
||||
return render_to_response('viewer/timeline.html', {'test': name,
|
||||
'descriptions': desc_list,
|
||||
'builds': buildlist})
|
||||
BIN
unittest-logs/unittestweb/viewer/views.pyc
Normal file
BIN
unittest-logs/unittestweb/viewer/views.pyc
Normal file
Binary file not shown.
55
unittest-logs/unittestweb/viewer/views.py~
Executable file
55
unittest-logs/unittestweb/viewer/views.py~
Executable file
@@ -0,0 +1,55 @@
|
||||
from django.shortcuts import render_to_response, get_list_or_404
|
||||
from unittestweb.viewer.models import Builds, Trees, Tests, OS_CHOICES, get_most_failing_tests
|
||||
|
||||
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 trees(request):
|
||||
alltrees = Trees.objects.all().order_by('name')
|
||||
return render_to_response('viewer/trees.html', {'trees': alltrees})
|
||||
|
||||
def tree(request, tree):
|
||||
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 changeset(request, changeset):
|
||||
builds = get_list_or_404(Builds, changeset__exact=changeset)
|
||||
return render_to_response('viewer/changeset.html', {'changeset': changeset, 'builds': builds})
|
||||
|
||||
def tests(request):
|
||||
test_names = Tests.objects.values('name').distinct()
|
||||
return render_to_response('viewer/tests.html', {'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 topfails(request):
|
||||
failures = get_most_failing_tests()
|
||||
return render_to_response('viewer/topfails.html', {'failures': failures})
|
||||
|
||||
def timeline(request):
|
||||
name = request.GET['name']
|
||||
builds = get_list_or_404(Builds, tests__name__exact=name)
|
||||
buildlist = []
|
||||
desc_list = []
|
||||
for b in builds:
|
||||
descs = b.tests_set.filter(name__exact=name).order_by('ROWID')
|
||||
desc = '\n'.join(descs.values_list('description', flat=True))
|
||||
if desc not in desc_list:
|
||||
desc_list.append(desc)
|
||||
desc_i = desc_list.index(desc)
|
||||
buildlist.append({'build': b,
|
||||
'desctype': desc_i,
|
||||
'description': desc,
|
||||
'os': OS_CHOICES[b.os][1],
|
||||
'time': b.startdate().isoformat() + "Z",
|
||||
})
|
||||
return render_to_response('viewer/timeline.html', {'test': name,
|
||||
'descriptions': desc_list,
|
||||
'builds': buildlist})
|
||||
Reference in New Issue
Block a user