summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--isotests/admin.py4
-rw-r--r--isotests/fixtures/architecture.json30
-rw-r--r--isotests/fixtures/boottype.json23
-rw-r--r--isotests/fixtures/clockchoices.json23
-rw-r--r--isotests/fixtures/isotypes.json16
-rw-r--r--isotests/models.py110
-rw-r--r--isotests/urls.py6
-rw-r--r--isotests/views.py42
-rw-r--r--templates/isotests/results.html190
9 files changed, 402 insertions, 42 deletions
diff --git a/isotests/admin.py b/isotests/admin.py
index 03b5fbab..b03ddea3 100644
--- a/isotests/admin.py
+++ b/isotests/admin.py
@@ -2,9 +2,13 @@ from isotests.models import *
from django.contrib import admin
admin.site.register(Iso)
+admin.site.register(Architecture)
+admin.site.register(Isotype)
+admin.site.register(Boottype)
admin.site.register(Hardware)
admin.site.register(InstallType)
admin.site.register(Source)
+admin.site.register(Clockchoice)
admin.site.register(Filesystem)
admin.site.register(Module)
admin.site.register(Bootloader)
diff --git a/isotests/fixtures/architecture.json b/isotests/fixtures/architecture.json
new file mode 100644
index 00000000..a21100ba
--- /dev/null
+++ b/isotests/fixtures/architecture.json
@@ -0,0 +1,30 @@
+[
+ {
+ "pk": 1,
+ "model": "isotests.architecture",
+ "fields": {
+ "name": "dual, option i686"
+ }
+ },
+ {
+ "pk": 2,
+ "model": "isotests.architecture",
+ "fields": {
+ "name": "dual, option x86_64"
+ }
+ },
+ {
+ "pk": 3,
+ "model": "isotests.architecture",
+ "fields": {
+ "name": "i686"
+ }
+ },
+ {
+ "pk": 4,
+ "model": "isotests.architecture",
+ "fields": {
+ "name": "x86_64"
+ }
+ }
+]
diff --git a/isotests/fixtures/boottype.json b/isotests/fixtures/boottype.json
new file mode 100644
index 00000000..5d87ef15
--- /dev/null
+++ b/isotests/fixtures/boottype.json
@@ -0,0 +1,23 @@
+[
+ {
+ "pk": 1,
+ "model": "isotests.boottype",
+ "fields": {
+ "name": "optical"
+ }
+ },
+ {
+ "pk": 2,
+ "model": "isotests.boottype",
+ "fields": {
+ "name": "usb"
+ }
+ },
+ {
+ "pk": 3,
+ "model": "isotests.boottype",
+ "fields": {
+ "name": "pxe"
+ }
+ }
+]
diff --git a/isotests/fixtures/clockchoices.json b/isotests/fixtures/clockchoices.json
new file mode 100644
index 00000000..2c078128
--- /dev/null
+++ b/isotests/fixtures/clockchoices.json
@@ -0,0 +1,23 @@
+[
+ {
+ "pk": 1,
+ "model": "isotests.clockchoice",
+ "fields": {
+ "name": "default"
+ }
+ },
+ {
+ "pk": 2,
+ "model": "isotests.clockchoice",
+ "fields": {
+ "name": "configured manually"
+ }
+ },
+ {
+ "pk": 3,
+ "model": "isotests.clockchoice",
+ "fields": {
+ "name": "NTP"
+ }
+ }
+]
diff --git a/isotests/fixtures/isotypes.json b/isotests/fixtures/isotypes.json
new file mode 100644
index 00000000..760e3738
--- /dev/null
+++ b/isotests/fixtures/isotypes.json
@@ -0,0 +1,16 @@
+[
+ {
+ "pk": 1,
+ "model": "isotests.isotype",
+ "fields": {
+ "name": "core"
+ }
+ },
+ {
+ "pk": 2,
+ "model": "isotests.isotype",
+ "fields": {
+ "name": "net"
+ }
+ }
+]
diff --git a/isotests/models.py b/isotests/models.py
index 1eaca163..d9cfc78c 100644
--- a/isotests/models.py
+++ b/isotests/models.py
@@ -1,4 +1,6 @@
from django.db import models
+from django.db.models import Max
+from datetime import datetime
# Create your models here.
class Iso(models.Model):
@@ -7,81 +9,125 @@ class Iso(models.Model):
def __unicode__(self):
return str(self.date)
+class Architecture(models.Model):
+ name = models.CharField(max_length=200)
+
+ def __unicode__(self):
+ return self.name
+
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
+
+class Isotype(models.Model):
+ name = models.CharField(max_length=200)
+
+ def __unicode__(self):
+ return self.name
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
+
+class Boottype(models.Model):
+ name = models.CharField(max_length=200)
+
+ def __unicode__(self):
+ return self.name
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
+
class Hardware(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
class InstallType(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
class Source(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
+
+class Clockchoice(models.Model):
+ name = models.CharField(max_length=200)
+
+ def __unicode__(self):
+ return self.name
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
class Filesystem(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
class Module(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
class Bootloader(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
class Test(models.Model):
- ARCH_CHOICES = (
- ('d86', 'dual, option i686'),
- ('d64', 'dual, option x86_64'),
- ('x86', 'i686'),
- ('x64', 'x86_64')
- )
-
- ISOTYPE_CHOICES = (
- ('c', 'core'),
- ('n', 'net')
- )
-
- BOOTTYPE_CHOICES = (
- ('o', 'optical'),
- ('u', 'usb'),
- ('p', 'pxe')
- )
-
- CLOCK_CHOICES = (
- ('d', 'default'),
- ('m', 'configured manually'),
- ('n', 'NTP')
- )
-
user_name = models.CharField(max_length=500)
user_email = models.EmailField()
iso = models.ForeignKey(Iso)
- arch = models.CharField(max_length=3, choices=ARCH_CHOICES)
- isotype = models.CharField(max_length=1, choices=ISOTYPE_CHOICES)
- boottype = models.CharField(max_length=1, choices=BOOTTYPE_CHOICES)
+ arch = models.ForeignKey(Architecture)
+ isotype = models.ForeignKey(Isotype)
+ boottype = models.ForeignKey(Boottype)
hardwaretype = models.ForeignKey(Hardware)
installtype = models.ForeignKey(InstallType)
source = models.ForeignKey(Source)
- clock = models.CharField(max_length=1, choices=CLOCK_CHOICES)
+ clock = models.ForeignKey(Clockchoice)
filesystem = models.ForeignKey(Filesystem)
- ms = models.ManyToManyField(Module)
+ ms = models.ManyToManyField(Module, null=True, blank=True)
rollback = models.BooleanField()
- rollback_filesystem = models.ForeignKey(Filesystem, related_name="rollback_test")
- rollback_modules = models.ManyToManyField(Module, related_name="rollback_test")
+ rollback_filesystem = models.ForeignKey(Filesystem,
+ related_name="rollback_test", null=True, blank=True)
+ rollback_modules = models.ManyToManyField(Module,
+ related_name="rollback_test", null=True, blank=True)
+ bootloader = models.ForeignKey(Bootloader)
success = models.BooleanField()
- comments = models.TextField()
+ comments = models.TextField(null=True, blank=True)
diff --git a/isotests/urls.py b/isotests/urls.py
index fdde9e3b..e28497aa 100644
--- a/isotests/urls.py
+++ b/isotests/urls.py
@@ -6,11 +6,11 @@ info_dict = {
}
urlpatterns = patterns('isotests.views',
- (r'^add/$', 'add_result')
-)
+ (r'^$', 'view_results'),
+ (r'^add/$', 'add_result')
+ )
urlpatterns += patterns('',
- (r'^$', 'django.views.generic.list_detail.object_list', info_dict)
)
# vim: set ts=4 sw=4 et:
diff --git a/isotests/views.py b/isotests/views.py
index 742be8ff..738fa90d 100644
--- a/isotests/views.py
+++ b/isotests/views.py
@@ -1,9 +1,9 @@
# Create your views here.
from django.http import HttpResponse, HttpResponseRedirect
-from django.forms import ModelForm
-from isotests.models import Test
+from django.forms import ModelForm, DateField
+from isotests.models import *
from django.shortcuts import render_to_response
-from django.template import RequestContext
+from django.template import RequestContext, Context, loader
class TestForm(ModelForm):
class Meta:
@@ -18,7 +18,35 @@ def add_result(request):
else:
form = TestForm() # An unbound form
- return render_to_response('isotests/add.html', {
- 'form': form,
- },
- context_instance=RequestContext(request))
+ return render_to_response('isotests/add.html', { 'form': form, },
+ context_instance=RequestContext(request))
+
+def view_results(request):
+ result_success_list = Test.objects.filter(success=True)
+ result_failed_list = Test.objects.filter(success=False)
+
+ architecture_list = Architecture.objects.all()
+ isotype_list = Isotype.objects.all()
+ boottype_list = Boottype.objects.all()
+ hardware_list = Hardware.objects.all()
+ installtype_list = InstallType.objects.all()
+ source_list = Source.objects.all()
+ clockchoice_list = Clockchoice.objects.all()
+ module_list = Module.objects.all()
+ filesystem_list = Filesystem.objects.all()
+ bootloader_list = Bootloader.objects.all()
+
+ t = loader.get_template("isotests/results.html")
+ c = Context({
+ 'arch_choices': architecture_list,
+ 'isotype_choices': isotype_list,
+ 'boottype_choices': boottype_list,
+ 'hardware_list': hardware_list,
+ 'installtype_list': installtype_list,
+ 'source_list': source_list,
+ 'clock_choices': clockchoice_list,
+ 'filesystem_list': filesystem_list,
+ 'module_list': module_list,
+ 'bootloader_list': bootloader_list,
+ })
+ return HttpResponse(t.render(c))
diff --git a/templates/isotests/results.html b/templates/isotests/results.html
new file mode 100644
index 00000000..3e43ae47
--- /dev/null
+++ b/templates/isotests/results.html
@@ -0,0 +1,190 @@
+{% extends "base.html" %}
+
+{% block title %}Arch Linux - Testresults{% endblock %}
+
+{% block content %}
+<div class="box">
+ <h2>Arch releng iso build test results</h2>
+ <table>
+ <tr>
+ <td>
+ <h3>image arch</h3>
+ </td>
+ </tr>
+ {% if arch_choices %}
+ {% for arch in arch_choices %}
+ <tr>
+ <td>{{ arch.name }}</td>
+ <td>{{ arch.get_success_test|default_if_none:"Never succeeded" }}</td>
+ <td>{{ arch.get_failed_test|default_if_none:"Never failed" }}</td>
+ </tr>
+ {% endfor %}
+ {% endif %}
+ <tr>
+ <td>
+ <h3>image type</h3>
+ </td>
+ </tr>
+ {% if isotype_choices %}
+ {% for isotype in isotype_choices %}
+ <tr>
+ <td>{{ isotype.name }}</td>
+ <td>{{ isotype.get_success_test|default_if_none:"Never succeeded" }}</td>
+ <td>{{ isotype.get_failed_test|default_if_none:"Never failed" }}</td>
+ </tr>
+ {% endfor %}
+ {% endif %}
+ <tr>
+ <td>
+ <h3>image boot</h3>
+ </td>
+ </tr>
+ {% if boottype_choices %}
+ {% for boottype in boottype_choices %}
+ <tr>
+ <td>{{ boottype.name }}</td>
+ <td>{{ boottype.get_success_test|default_if_none:"Never succeeded" }}</td>
+ <td>{{ boottype.get_failed_test|default_if_none:"Never failed" }}</td>
+ </tr>
+ {% endfor %}
+ {% endif %}
+ <tr>
+ <td>
+ <h3>hardware type</h3>
+ </td>
+ </tr>
+ {% if hardware_list %}
+ {% for hardware in hardware_list %}
+ <tr>
+ <td>{{ hardware.name }}</td>
+ <td>{{ hardware.get_success_test|default_if_none:"Never succeeded" }}</td>
+ <td>{{ hardware.get_failed_test|default_if_none:"Never failed" }}</td>
+ </tr>
+ {% endfor %}
+ {% endif %}
+ <tr>
+ <td>
+ <h3>install type</h3>
+ </td>
+ </tr>
+ {% if installtype_list %}
+ {% for installtype in installtype_list %}
+ <tr>
+ <td>{{ installtype.name }}</td>
+ <td>{{ installtype.get_success_test|default_if_none:"Never succeeded" }}</td>
+ <td>{{ installtype.get_failed_test|default_if_none:"Never failed" }}</td>
+ </tr>
+ {% endfor %}
+ {% endif %}
+ <tr>
+ <td>
+ <h3>source selection</h3>
+ </td>
+ </tr>
+ {% if source_list %}
+ {% for source in source_list %}
+ <tr>
+ <td>{{ source.name }}</td>
+ <td>{{ source.get_success_test|default_if_none:"Never succeeded" }}</td>
+ <td>{{ source.get_failed_test|default_if_none:"Never failed" }}</td>
+ </tr>
+ {% endfor %}
+ {% endif %}
+ <tr>
+ <td>
+ <h3>clock</h3>
+ </td>
+ </tr>
+ {% if clock_choices %}
+ {% for clock in clock_choices %}
+ <tr>
+ <td>{{ clock.name }}</td>
+ <td>{{ clock.get_success_test|default_if_none:"Never succeeded" }}</td>
+ <td>{{ clock.get_failed_test|default_if_none:"Never failed" }}</td>
+ </tr>
+ {% endfor %}
+ {% endif %}
+ <tr>
+ <td>
+ <h3>partitioning/filesystems</h3>
+ </td>
+ </tr>
+ {% if filesystem_list %}
+ {% for filesystem in filesystem_list %}
+ <tr>
+ <td>{{ filesystem.name }}</td>
+ <td>{{ filesystem.get_success_test|default_if_none:"Never succeeded" }}</td>
+ <td>{{ filesystem.get_failed_test|default_if_none:"Never failed" }}</td>
+ </tr>
+ {% endfor %}
+ {% endif %}
+ <tr>
+ <td>
+ <h3>fancy stuff</h3>
+ </td>
+ </tr>
+ {% if module_list %}
+ {% for module in module_list %}
+ <tr>
+ <td>{{ module.name }}</td>
+ <td>{{ module.get_success_test|default_if_none:"Never succeeded" }}</td>
+ <td>{{ module.get_failed_test|default_if_none:"Never failed" }}</td>
+ </tr>
+ {% endfor %}
+ {% endif %}
+ <tr>
+ <td>
+ <h3>rollback</h3>
+ </td>
+ </tr>
+ <tr>
+ <td>yes</td>
+ </tr>
+ <tr>
+ <td>no</td>
+ </tr>
+ <tr>
+ <td>
+ <h4>rollback: partitioning/filesystems</h4>
+ </td>
+ </tr>
+ {% if filesystem_list %}
+ {% for filesystem in filesystem_list %}
+ <tr>
+ <td>{{ filesystem.name }}</td>
+ <td>{{ filesystem.get_success_test|default_if_none:"Never succeeded" }}</td>
+ <td>{{ filesystem.get_failed_test|default_if_none:"Never failed" }}</td>
+ </tr>
+ {% endfor %}
+ {% endif %}
+ <tr>
+ <td>
+ <h4>rollback: fancy stuff</h4>
+ </td>
+ </tr>
+ {% if module_list %}
+ {% for module in module_list %}
+ <tr>
+ <td>{{ module.name }}</td>
+ <td>{{ module.get_success_test|default_if_none:"Never succeeded" }}</td>
+ <td>{{ module.get_failed_test|default_if_none:"Never failed" }}</td>
+ </tr>
+ {% endfor %}
+ {% endif %}
+ <tr>
+ <td>
+ <h3>bootloader</h3>
+ </td>
+ </tr>
+ {% if bootloader_list %}
+ {% for bootloader in bootloader_list %}
+ <tr>
+ <td>{{ bootloader.name }}</td>
+ <td>{{ bootloader.get_success_test|default_if_none:"Never succeeded" }}</td>
+ <td>{{ bootloader.get_failed_test|default_if_none:"Never failed" }}</td>
+ </tr>
+ {% endfor %}
+ {% endif %}
+ </table>
+</div>
+{% endblock %}