summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@android.linaro.org>2018-05-11 17:19:22 +0000
committerYongqin Liu <yongqin.liu@linaro.org>2018-05-12 01:21:18 +0800
commit7054e13f46acade6662eb1330a1b3623eae834c3 (patch)
treedf1f976cf320524550af73053e76e11aae532e83
parent489fc0cd8ffedf3d286012b1eceb33caf783d7cd (diff)
update to use postgresx
Signed-off-by: Yongqin Liu <yongqin.liu@android.linaro.org>
-rwxr-xr-xdeploy.sh5
-rw-r--r--lcr/settings.py12
-rw-r--r--report/migrations/0001_initial.py122
-rw-r--r--report/migrations/0002_auto_20180511_1609.py (renamed from report/migrations/0016_auto_20180116_0549.py)10
-rw-r--r--report/migrations/0002_baseresults.py31
-rw-r--r--report/migrations/0003_auto_20171113_1544.py33
-rw-r--r--report/migrations/0003_auto_20180511_1616.py20
-rw-r--r--report/migrations/0004_auto_20171116_1341.py36
-rw-r--r--report/migrations/0005_buildsummary_images_url.py21
-rw-r--r--report/migrations/0006_auto_20171117_1557.py35
-rw-r--r--report/migrations/0007_auto_20171117_1913.py20
-rw-r--r--report/migrations/0008_lavauser.py24
-rw-r--r--report/migrations/0009_auto_20171120_1941.py45
-rw-r--r--report/migrations/0010_buildbugzilla.py30
-rw-r--r--report/migrations/0011_auto_20171122_0255.py25
-rw-r--r--report/migrations/0012_auto_20171122_0346.py42
-rw-r--r--report/migrations/0013_auto_20171122_0415.py47
-rw-r--r--report/migrations/0014_auto_20171130_1628.py31
-rw-r--r--report/migrations/0015_bug_build_no_fixed.py20
-rw-r--r--report/migrations/0017_comment_build_no_fixed.py20
-rw-r--r--report/models.py4
-rw-r--r--report/views.py89
22 files changed, 215 insertions, 507 deletions
diff --git a/deploy.sh b/deploy.sh
index 80610d4..2d8eef1 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -33,17 +33,18 @@ source ${virenv_dir}/bin/activate
#$ rm -r /path/to/ENV
#https://docs.djangoproject.com/en/1.11/topics/install/#installing-official-release
-pip install Django=1.11.8
+pip install Django==1.11.8
pip install pyaml
pip install lava-tool
pip install django-crispy-forms
+pip install django psycopg2
# https://docs.djangoproject.com/en/1.11/intro/tutorial01/
python -m django --version
#python manage.py startapp ${instance_report_app}
# django-admin startproject ${instance_name}
cd ${work_root} && git clone https://git.linaro.org/people/yongqin.liu/public/lcr-report.git
-cd ${instance_dir} && python manage.py runserver 0.0.0.0:8000
+cd ${instance_dir} && python manage.py runserver 0.0.0.0:9000
echo "Please update the LAVA_USER_TOKEN and LAVA_USER in report/views.py"
# python manage.py createsuperuser
diff --git a/lcr/settings.py b/lcr/settings.py
index a51d9c3..2dcf4ac 100644
--- a/lcr/settings.py
+++ b/lcr/settings.py
@@ -79,9 +79,17 @@ WSGI_APPLICATION = 'lcr.wsgi.application'
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES = {
+ #'default': {
+ # 'ENGINE': 'django.db.backends.sqlite3',
+ # 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+ #}
'default': {
- 'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+ 'ENGINE': 'django.db.backends.postgresql_psycopg2',
+ 'NAME': 'lcrreport',
+ 'USER': 'lcrreport',
+ 'PASSWORD': '',
+ 'HOST': 'localhost',
+ 'PORT': '',
}
}
diff --git a/report/migrations/0001_initial.py b/report/migrations/0001_initial.py
index 0b537bf..acec965 100644
--- a/report/migrations/0001_initial.py
+++ b/report/migrations/0001_initial.py
@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.11.5 on 2017-11-02 11:09
+# Generated by Django 1.11.8 on 2018-05-11 15:41
from __future__ import unicode_literals
from django.db import migrations, models
+import django.db.models.deletion
class Migration(migrations.Migration):
@@ -14,25 +15,142 @@ class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
+ name='BaseResults',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('build_name', models.CharField(max_length=64)),
+ ('build_no', models.CharField(max_length=8)),
+ ('plan_suite', models.CharField(max_length=32)),
+ ('module_testcase', models.CharField(max_length=128)),
+ ('number_pass', models.IntegerField(default=0)),
+ ('number_fail', models.IntegerField(default=0)),
+ ('number_total', models.IntegerField(default=0)),
+ ('number_passrate', models.DecimalField(decimal_places=2, default=100, max_digits=11)),
+ ('unit', models.CharField(default='points', max_length=16)),
+ ('measurement', models.DecimalField(decimal_places=2, default=0, max_digits=20, null=True)),
+ ('lava_nick', models.CharField(default='', max_length=16)),
+ ('job_id', models.CharField(default='', max_length=16)),
+ ('job_name', models.CharField(default='', max_length=64)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='Bug',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('build_name', models.CharField(max_length=64)),
+ ('build_no', models.CharField(blank=True, default='', max_length=8)),
+ ('build_no_fixed', models.CharField(blank=True, default='', max_length=8)),
+ ('bug_id', models.CharField(max_length=16)),
+ ('link', models.CharField(max_length=128)),
+ ('subject', models.CharField(max_length=256)),
+ ('status', models.CharField(choices=[('unconfirmed', 'Unconfirmed'), ('confirmed', 'Confirmed'), ('inprogress', 'InProgress'), ('resolved', 'Resolved')], max_length=64)),
+ ('plan_suite', models.CharField(max_length=64)),
+ ('module_testcase', models.CharField(max_length=128)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='BuildBugzilla',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('build_name', models.CharField(max_length=64)),
+ ('new_bug_url', models.URLField()),
+ ('product', models.CharField(max_length=64)),
+ ('op_sys', models.CharField(max_length=32)),
+ ('bug_severity', models.CharField(max_length=32)),
+ ('component', models.CharField(max_length=64)),
+ ('keywords', models.CharField(blank=True, default='', max_length=16, null=True)),
+ ('rep_platform', models.CharField(max_length=16)),
+ ('short_desc_prefix', models.CharField(blank=True, default='', max_length=16)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='BuildConfig',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('build_name', models.CharField(max_length=64)),
+ ('img_ext', models.CharField(max_length=16)),
+ ('base_build_name', models.CharField(max_length=64)),
+ ('base_build_no', models.CharField(max_length=8)),
+ ('template_dir', models.CharField(blank=True, default='', max_length=8)),
+ ('bugzilla', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='report.BuildBugzilla')),
+ ],
+ ),
+ migrations.CreateModel(
+ name='BuildSummary',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('build_name', models.CharField(max_length=64)),
+ ('build_no', models.CharField(max_length=8)),
+ ('build_config', models.CharField(max_length=64)),
+ ('build_commit', models.CharField(max_length=64)),
+ ('android_version', models.CharField(max_length=32)),
+ ('kernel_version', models.CharField(max_length=16)),
+ ('kernel_url', models.CharField(max_length=256)),
+ ('firmware_url', models.CharField(max_length=256)),
+ ('firmware_version', models.CharField(max_length=64)),
+ ('toolchain_info', models.CharField(max_length=256)),
+ ('images_url', models.CharField(max_length=256)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='Comment',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('build_name', models.CharField(max_length=64)),
+ ('build_no', models.CharField(blank=True, default='', max_length=8)),
+ ('build_no_fixed', models.CharField(blank=True, default='', max_length=8)),
+ ('plan_suite', models.CharField(max_length=64)),
+ ('module_testcase', models.CharField(max_length=128)),
+ ('comment', models.TextField()),
+ ],
+ ),
+ migrations.CreateModel(
name='JobCache',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('build_name', models.CharField(max_length=64)),
+ ('build_no', models.CharField(max_length=8)),
('lava_nick', models.CharField(max_length=16)),
('job_id', models.CharField(max_length=16)),
+ ('job_name', models.CharField(max_length=64)),
+ ('status', models.IntegerField(choices=[(0, 'Submitted'), (1, 'Running'), (2, 'Complete'), (3, 'Incomplete'), (4, 'Canceled')])),
+ ('duration', models.DurationField()),
('cached', models.BooleanField(default=False)),
],
),
migrations.CreateModel(
+ name='LAVA',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('nick', models.CharField(max_length=64)),
+ ('domain', models.CharField(max_length=64)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='LAVAUser',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('user_name', models.CharField(max_length=32)),
+ ('token', models.CharField(max_length=128)),
+ ('lava', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='report.LAVA')),
+ ],
+ ),
+ migrations.CreateModel(
name='TestCase',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=128)),
('result', models.CharField(max_length=16)),
- ('measurement', models.DecimalField(decimal_places=2, max_digits=11, null=True)),
+ ('measurement', models.DecimalField(decimal_places=2, max_digits=20, null=True)),
('unit', models.CharField(max_length=128, null=True)),
('suite', models.CharField(max_length=16)),
('job_id', models.CharField(max_length=16)),
('lava_nick', models.CharField(max_length=64)),
],
),
+ migrations.AddField(
+ model_name='buildconfig',
+ name='lava',
+ field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='report.LAVA'),
+ ),
]
diff --git a/report/migrations/0016_auto_20180116_0549.py b/report/migrations/0002_auto_20180511_1609.py
index d461f54..5cd594a 100644
--- a/report/migrations/0016_auto_20180116_0549.py
+++ b/report/migrations/0002_auto_20180511_1609.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.11.5 on 2018-01-16 05:49
+# Generated by Django 1.11.8 on 2018-05-11 16:09
from __future__ import unicode_literals
from django.db import migrations, models
@@ -8,13 +8,13 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
- ('report', '0015_bug_build_no_fixed'),
+ ('report', '0001_initial'),
]
operations = [
migrations.AlterField(
- model_name='jobcache',
- name='duration',
- field=models.DurationField(),
+ model_name='testcase',
+ name='suite',
+ field=models.CharField(max_length=32),
),
]
diff --git a/report/migrations/0002_baseresults.py b/report/migrations/0002_baseresults.py
deleted file mode 100644
index 7853eca..0000000
--- a/report/migrations/0002_baseresults.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.5 on 2017-11-07 12:06
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('report', '0001_initial'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='BaseResults',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('build_name', models.CharField(max_length=64)),
- ('build_no', models.CharField(max_length=8)),
- ('plan_suite', models.CharField(max_length=32)),
- ('module_testcase', models.CharField(max_length=128)),
- ('number_pass', models.IntegerField(default=0)),
- ('number_fail', models.IntegerField(default=0)),
- ('number_total', models.IntegerField(default=0)),
- ('number_passrate', models.DecimalField(decimal_places=2, max_digits=11, null=True)),
- ('unit', models.CharField(default='points', max_length=16)),
- ('measurement', models.DecimalField(decimal_places=2, default=0, max_digits=11, null=True)),
- ],
- ),
- ]
diff --git a/report/migrations/0003_auto_20171113_1544.py b/report/migrations/0003_auto_20171113_1544.py
deleted file mode 100644
index 6807a35..0000000
--- a/report/migrations/0003_auto_20171113_1544.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.5 on 2017-11-13 15:44
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('report', '0002_baseresults'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='Bug',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('build_name', models.CharField(max_length=64)),
- ('bug_id', models.CharField(max_length=16)),
- ('link', models.CharField(max_length=128)),
- ('subject', models.CharField(max_length=256)),
- ('status', models.CharField(choices=[('Unconfirmed', 'Unconfirmed'), ('confirmed', 'Confirmed'), ('inprogress', 'InProgress'), ('resolved', 'Resolved')], max_length=64)),
- ('plan_suite', models.CharField(max_length=64)),
- ('module_testcase', models.CharField(max_length=128)),
- ],
- ),
- migrations.AlterField(
- model_name='testcase',
- name='measurement',
- field=models.DecimalField(decimal_places=2, max_digits=20, null=True),
- ),
- ]
diff --git a/report/migrations/0003_auto_20180511_1616.py b/report/migrations/0003_auto_20180511_1616.py
new file mode 100644
index 0000000..e779d7a
--- /dev/null
+++ b/report/migrations/0003_auto_20180511_1616.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.8 on 2018-05-11 16:16
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('report', '0002_auto_20180511_1609'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='testcase',
+ name='name',
+ field=models.CharField(max_length=256),
+ ),
+ ]
diff --git a/report/migrations/0004_auto_20171116_1341.py b/report/migrations/0004_auto_20171116_1341.py
deleted file mode 100644
index 1d266c3..0000000
--- a/report/migrations/0004_auto_20171116_1341.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.5 on 2017-11-16 13:41
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('report', '0003_auto_20171113_1544'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='BuildSummary',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('build_name', models.CharField(max_length=64)),
- ('build_no', models.CharField(max_length=8)),
- ('build_config', models.CharField(max_length=64)),
- ('build_commit', models.CharField(max_length=64)),
- ('android_version', models.CharField(max_length=32)),
- ('kernel_version', models.CharField(max_length=16)),
- ('kernel_url', models.CharField(max_length=256)),
- ('firmware_url', models.CharField(max_length=256)),
- ('firmware_version', models.CharField(max_length=64)),
- ('toolchain_info', models.CharField(max_length=256)),
- ],
- ),
- migrations.AlterField(
- model_name='bug',
- name='status',
- field=models.CharField(choices=[('unconfirmed', 'Unconfirmed'), ('confirmed', 'Confirmed'), ('inprogress', 'InProgress'), ('resolved', 'Resolved')], max_length=64),
- ),
- ]
diff --git a/report/migrations/0005_buildsummary_images_url.py b/report/migrations/0005_buildsummary_images_url.py
deleted file mode 100644
index 6d126db..0000000
--- a/report/migrations/0005_buildsummary_images_url.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.5 on 2017-11-16 14:47
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('report', '0004_auto_20171116_1341'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='buildsummary',
- name='images_url',
- field=models.CharField(default='', max_length=256),
- preserve_default=False,
- ),
- ]
diff --git a/report/migrations/0006_auto_20171117_1557.py b/report/migrations/0006_auto_20171117_1557.py
deleted file mode 100644
index b44e258..0000000
--- a/report/migrations/0006_auto_20171117_1557.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.5 on 2017-11-17 15:57
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('report', '0005_buildsummary_images_url'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='baseresults',
- name='job_id',
- field=models.CharField(default='', max_length=16),
- ),
- migrations.AddField(
- model_name='baseresults',
- name='job_name',
- field=models.CharField(default='', max_length=64),
- ),
- migrations.AddField(
- model_name='baseresults',
- name='lava_nick',
- field=models.CharField(default='', max_length=16),
- ),
- migrations.AlterField(
- model_name='baseresults',
- name='number_passrate',
- field=models.DecimalField(decimal_places=2, default=100, max_digits=11),
- ),
- ]
diff --git a/report/migrations/0007_auto_20171117_1913.py b/report/migrations/0007_auto_20171117_1913.py
deleted file mode 100644
index dc318f1..0000000
--- a/report/migrations/0007_auto_20171117_1913.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.5 on 2017-11-17 19:13
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('report', '0006_auto_20171117_1557'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='baseresults',
- name='measurement',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=20, null=True),
- ),
- ]
diff --git a/report/migrations/0008_lavauser.py b/report/migrations/0008_lavauser.py
deleted file mode 100644
index 27c8f50..0000000
--- a/report/migrations/0008_lavauser.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.5 on 2017-11-20 12:43
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('report', '0007_auto_20171117_1913'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='LAVAUser',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('lava_nick', models.CharField(max_length=64)),
- ('user_name', models.CharField(max_length=32)),
- ('token', models.CharField(max_length=128)),
- ],
- ),
- ]
diff --git a/report/migrations/0009_auto_20171120_1941.py b/report/migrations/0009_auto_20171120_1941.py
deleted file mode 100644
index 0d72366..0000000
--- a/report/migrations/0009_auto_20171120_1941.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.5 on 2017-11-20 19:41
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('report', '0008_lavauser'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='jobcache',
- name='build_name',
- field=models.CharField(default='', max_length=64),
- preserve_default=False,
- ),
- migrations.AddField(
- model_name='jobcache',
- name='build_no',
- field=models.CharField(default=0, max_length=8),
- preserve_default=False,
- ),
- migrations.AddField(
- model_name='jobcache',
- name='duration',
- field=models.FloatField(default=0),
- preserve_default=False,
- ),
- migrations.AddField(
- model_name='jobcache',
- name='job_name',
- field=models.CharField(default='', max_length=64),
- preserve_default=False,
- ),
- migrations.AddField(
- model_name='jobcache',
- name='status',
- field=models.IntegerField(choices=[(0, 'Submitted'), (1, 'Running'), (2, 'Complete'), (3, 'Incomplete'), (4, 'Canceled')], default=0),
- preserve_default=False,
- ),
- ]
diff --git a/report/migrations/0010_buildbugzilla.py b/report/migrations/0010_buildbugzilla.py
deleted file mode 100644
index cd9c805..0000000
--- a/report/migrations/0010_buildbugzilla.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.5 on 2017-11-22 02:51
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('report', '0009_auto_20171120_1941'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='BuildBugzilla',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('build_name', models.CharField(max_length=64)),
- ('new_bug_url', models.URLField()),
- ('product', models.CharField(max_length=64)),
- ('op_sys', models.CharField(max_length=32)),
- ('bug_severity', models.CharField(max_length=32)),
- ('component', models.CharField(max_length=64)),
- ('keywords', models.CharField(max_length=16)),
- ('rep_platform', models.CharField(max_length=16)),
- ('short_desc_prefix', models.CharField(max_length=16)),
- ],
- ),
- ]
diff --git a/report/migrations/0011_auto_20171122_0255.py b/report/migrations/0011_auto_20171122_0255.py
deleted file mode 100644
index d470785..0000000
--- a/report/migrations/0011_auto_20171122_0255.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.5 on 2017-11-22 02:55
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('report', '0010_buildbugzilla'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='buildbugzilla',
- name='keywords',
- field=models.CharField(default='', max_length=16, null=True),
- ),
- migrations.AlterField(
- model_name='buildbugzilla',
- name='short_desc_prefix',
- field=models.CharField(default='', max_length=16),
- ),
- ]
diff --git a/report/migrations/0012_auto_20171122_0346.py b/report/migrations/0012_auto_20171122_0346.py
deleted file mode 100644
index cdfe61a..0000000
--- a/report/migrations/0012_auto_20171122_0346.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.5 on 2017-11-22 03:46
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('report', '0011_auto_20171122_0255'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='BuildConfig',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('build_name', models.CharField(max_length=64)),
- ('lava_nick', models.CharField(max_length=64)),
- ('img_ext', models.CharField(max_length=16)),
- ('base_build_name', models.CharField(max_length=64)),
- ('base_build_no', models.CharField(max_length=8)),
- ],
- ),
- migrations.AlterField(
- model_name='buildbugzilla',
- name='keywords',
- field=models.CharField(blank=True, default='', max_length=16, null=True),
- ),
- migrations.AlterField(
- model_name='buildbugzilla',
- name='short_desc_prefix',
- field=models.CharField(blank=True, default='', max_length=16),
- ),
- migrations.AddField(
- model_name='buildconfig',
- name='bugzilla',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='report.BuildBugzilla'),
- ),
- ]
diff --git a/report/migrations/0013_auto_20171122_0415.py b/report/migrations/0013_auto_20171122_0415.py
deleted file mode 100644
index ebee918..0000000
--- a/report/migrations/0013_auto_20171122_0415.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.5 on 2017-11-22 04:15
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('report', '0012_auto_20171122_0346'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='LAVA',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('nick', models.CharField(max_length=64)),
- ('domain', models.CharField(max_length=64)),
- ],
- ),
- migrations.RemoveField(
- model_name='buildconfig',
- name='lava_nick',
- ),
- migrations.RemoveField(
- model_name='lavauser',
- name='lava_nick',
- ),
- migrations.AddField(
- model_name='buildconfig',
- name='template_dir',
- field=models.CharField(blank=True, default='', max_length=8),
- ),
- migrations.AddField(
- model_name='buildconfig',
- name='lava',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='report.LAVA'),
- ),
- migrations.AddField(
- model_name='lavauser',
- name='lava',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='report.LAVA'),
- ),
- ]
diff --git a/report/migrations/0014_auto_20171130_1628.py b/report/migrations/0014_auto_20171130_1628.py
deleted file mode 100644
index 5190d99..0000000
--- a/report/migrations/0014_auto_20171130_1628.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.5 on 2017-11-30 16:28
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('report', '0013_auto_20171122_0415'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='Comment',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('build_name', models.CharField(max_length=64)),
- ('build_no', models.CharField(blank=True, default='', max_length=8)),
- ('plan_suite', models.CharField(max_length=64)),
- ('module_testcase', models.CharField(max_length=128)),
- ('comment', models.TextField()),
- ],
- ),
- migrations.AddField(
- model_name='bug',
- name='build_no',
- field=models.CharField(blank=True, default='', max_length=8),
- ),
- ]
diff --git a/report/migrations/0015_bug_build_no_fixed.py b/report/migrations/0015_bug_build_no_fixed.py
deleted file mode 100644
index dc4f445..0000000
--- a/report/migrations/0015_bug_build_no_fixed.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.5 on 2018-01-07 13:57
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('report', '0014_auto_20171130_1628'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='bug',
- name='build_no_fixed',
- field=models.CharField(blank=True, default='', max_length=8),
- ),
- ]
diff --git a/report/migrations/0017_comment_build_no_fixed.py b/report/migrations/0017_comment_build_no_fixed.py
deleted file mode 100644
index a1b6966..0000000
--- a/report/migrations/0017_comment_build_no_fixed.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.5 on 2018-01-19 16:57
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('report', '0016_auto_20180116_0549'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='comment',
- name='build_no_fixed',
- field=models.CharField(blank=True, default='', max_length=8),
- ),
- ]
diff --git a/report/models.py b/report/models.py
index 61bdad4..5bef3b8 100644
--- a/report/models.py
+++ b/report/models.py
@@ -5,11 +5,11 @@ from django.db import models
# Create your models here.
class TestCase(models.Model):
- name = models.CharField(max_length=128)
+ name = models.CharField(max_length=256)
result = models.CharField(max_length=16)
measurement = models.DecimalField( max_digits=20, decimal_places=2, null=True)
unit = models.CharField(max_length=128, null=True)
- suite = models.CharField(max_length=16)
+ suite = models.CharField(max_length=32)
job_id = models.CharField(max_length=16)
lava_nick = models.CharField(max_length=64)
diff --git a/report/views.py b/report/views.py
index 2e1aae1..3ad70fe 100644
--- a/report/views.py
+++ b/report/views.py
@@ -167,26 +167,47 @@ class LavaInstance(object):
DEFAULT_USER = "yongqin.liu"
LAVAS = {}
-for lava in LAVA.objects.all():
- LAVAS[lava.nick] = LavaInstance(nick=lava.nick, user=DEFAULT_USER)
+def initialize_all_lavas():
+ global LAVAS
+ if len(LAVAS) > 0:
+ return LAVAS
+ for lava in LAVA.objects.all():
+ LAVAS[lava.nick] = LavaInstance(nick=lava.nick, user=DEFAULT_USER)
+
+
+BUILD_CONFIGS = {}
+BUILD_NAMES = []
+def get_all_build_configs():
+ global BUILD_NAMES
+ global BUILD_CONFIGS
+
+ if len(BUILD_CONFIGS) > 0:
+ return BUILD_CONFIGS
+
+ initialize_all_lavas()
+ for build in BuildConfig.objects.all():
+ build_config = {
+ 'lava_server': LAVAS[build.lava.nick],
+ 'img_ext': build.img_ext,
+ 'template_dir': build.template_dir,
+ 'base_build': {
+ 'build_name': build.base_build_name,
+ 'build_no': build.base_build_no,
+ },
+ }
+ BUILD_CONFIGS[build.build_name] = build_config
+ BUILD_NAMES.append(build.build_name)
+
+ BUILD_NAMES = sorted(BUILD_NAMES)
+ return BUILD_CONFIGS
-build_configs = {}
-for build in BuildConfig.objects.all():
- build_config = {
- 'lava_server': LAVAS[build.lava.nick],
- 'img_ext': build.img_ext,
- 'template_dir': build.template_dir,
- 'base_build': {
- 'build_name': build.base_build_name,
- 'build_no': build.base_build_no,
- },
- }
- build_configs[build.build_name] = build_config
+def get_all_build_names():
+ if len(BUILD_NAMES) == 0:
+ get_all_build_configs()
+ return BUILD_NAMES
-build_names = build_configs.keys()
-build_names = sorted(build_names)
DEFAULT_BUILD_NAME = "android-lcr-reference-hikey-o"
def get_possible_builds(build_name=DEFAULT_BUILD_NAME):
@@ -200,7 +221,7 @@ def get_possible_builds(build_name=DEFAULT_BUILD_NAME):
return all_builds
def get_possible_templates(build_name=DEFAULT_BUILD_NAME):
- url = 'https://git.linaro.org/qa/test-plans.git/tree/android/%s' % build_configs[build_name]['template_dir']
+ url = 'https://git.linaro.org/qa/test-plans.git/tree/android/%s' % get_all_build_configs()[build_name]['template_dir']
try:
response = urllib2.urlopen(url)
except urllib2.HTTPError:
@@ -220,7 +241,7 @@ def get_possible_job_names(build_name=DEFAULT_BUILD_NAME):
pat_json = re.compile('"job_name": "%%JOB_NAME%%-%%ANDROID_META_BUILD%%-(\S+)"')
job_name_template_name_hash = {}
for template in templates:
- url = '%s/%s/%s' % (template_url_prefix, build_configs[build_name]['template_dir'], template)
+ url = '%s/%s/%s' % (template_url_prefix, get_all_build_configs()[build_name]['template_dir'], template)
response = urllib2.urlopen(url)
html = response.read()
job_names = pat.findall(html)
@@ -418,7 +439,7 @@ def resubmit_job(request):
'errors': True,
})
- lava = build_configs[build_name]['lava_server']
+ lava = get_all_build_configs()[build_name]['lava_server']
new_job_ids = []
for job_id in job_ids:
@@ -454,7 +475,7 @@ def is_job_cached(job_id, lava):
def get_test_results_for_build(build_name, build_no, job_name_list=[]):
jobs_failed = []
total_tests_res = {}
- lava = build_configs[build_name]['lava_server']
+ lava = get_all_build_configs()[build_name]['lava_server']
jobs = get_jobs(build_name, build_no, lava, job_name_list=job_name_list)
for job_name, job_details in jobs.items():
@@ -539,7 +560,7 @@ def jobs(request):
{
'jobs_failed': jobs_failed,
'jobs_result': sorted(total_tests_res.items()),
- 'lava_server_job_prefix': build_configs[build_name]['lava_server'].job_url_prefix,
+ 'lava_server_job_prefix': get_all_build_configs()[build_name]['lava_server'].job_url_prefix,
'build_info': build_info,
}
)
@@ -682,7 +703,7 @@ def compare(request):
return render(request, 'result-comparison.html',
{
"build_info": build_info,
- 'lava_server_job_prefix': build_configs[build_name]['lava_server'].job_url_prefix,
+ 'lava_server_job_prefix': get_all_build_configs()[build_name]['lava_server'].job_url_prefix,
'form': form,
'compare_results': compare_results,
}
@@ -748,7 +769,7 @@ def checklist(request):
return render(request, 'checklist.html',
{
"build_info": build_info,
- 'lava_server_job_prefix': build_configs[build_name]['lava_server'].job_url_prefix,
+ 'lava_server_job_prefix': get_all_build_configs()[build_name]['lava_server'].job_url_prefix,
'form': form,
'checklist_results': checklist_results,
'all_build_numbers': all_build_numbers,
@@ -781,7 +802,7 @@ def submit_lava_jobs(request):
all_build_numbers.reverse()
form = JobSubmissionForm(request.POST)
- form.fields["build_name"].choices = zip(build_names, build_names)
+ form.fields["build_name"].choices = zip(get_all_build_names(), get_all_build_names())
form.fields["build_no"].choices = zip(all_build_numbers, all_build_numbers)
form.fields["jobs"].choices = zip(jobs, jobs)
if form.is_valid():
@@ -791,19 +812,19 @@ def submit_lava_jobs(request):
jobs = cd['jobs']
job_priority = cd['job_priority']
lava_nick = cd['lava_nick']
- ##lava = build_configs[build_name]['lava_server']
+ ##lava = get_all_build_configs()[build_name]['lava_server']
lava = LAVAS[lava_nick]
submit_result = []
for job_name in jobs:
template = job_template[job_name]
- url = '%s/%s/%s' % (template_url_prefix, build_configs[build_name]['template_dir'], template)
+ url = '%s/%s/%s' % (template_url_prefix, get_all_build_configs()[build_name]['template_dir'], template)
response = urllib2.urlopen(url)
html = response.read()
meta_url = "%s/%s/%s" % (ci_job_url_base, build_name, build_no)
download_url = "%s/%s/%s" % (android_snapshot_url_base, build_name, build_no)
- img_ext = build_configs[build_name]['img_ext']
+ img_ext = get_all_build_configs()[build_name]['img_ext']
job_definition = html.replace("%%JOB_NAME%%", build_name)\
.replace("%%ANDROID_META_BUILD%%", build_no)\
.replace("%%ANDROID_META_NAME%%", build_name)\
@@ -858,7 +879,7 @@ def submit_lava_jobs(request):
'lava_nick': 'lkft',
}
form = JobSubmissionForm(initial=form_initial)
- form.fields["build_name"].choices = zip(build_names, build_names)
+ form.fields["build_name"].choices = zip(get_all_build_names(), get_all_build_names())
form.fields["build_no"].choices = zip(all_build_numbers, all_build_numbers)
form.fields["jobs"].choices = zip(jobs, jobs)
@@ -870,7 +891,7 @@ def submit_lava_jobs(request):
@login_required
def index(request):
builds = {}
- for build_name in build_names:
+ for build_name in get_all_build_names():
build_config_url = "%s/%s" % (android_build_config_url_base, build_name.replace("android-", "").replace('-premerge-ci', ''))
build_android_tag = get_build_config_value(build_config_url, key="MANIFEST_BRANCH")
builds[build_name] = {
@@ -917,13 +938,13 @@ def test_report(request):
## no need to clean cache from base since there is no cache yet
cache_to_base = False
- base_build_name = build_configs[build_name]['base_build']['build_name']
- base_build_no = build_configs[build_name]['base_build']['build_no']
+ base_build_name = get_all_build_configs()[build_name]['base_build']['build_name']
+ base_build_no = get_all_build_configs()[build_name]['base_build']['build_no']
(jobs_failed, total_tests_res) = get_test_results_for_build(build_name, build_no)
- lava_nick = build_configs[build_name]['lava_server'].nick
+ lava_nick = get_all_build_configs()[build_name]['lava_server'].nick
successful_job_ids = []
#######################################################
## Get result for basic/optee/weekly tests
@@ -1308,7 +1329,7 @@ def test_report(request):
return render(request, 'test_report.html',
{
- 'lava_server_job_prefix': build_configs[build_name]['lava_server'].job_url_prefix,
+ 'lava_server_job_prefix': get_all_build_configs()[build_name]['lava_server'].job_url_prefix,
'build_info': build_info,
'basic_optee_weekly_res': basic_optee_weekly_res,
'benchmarks_res': benchmarks_res,
@@ -1418,7 +1439,7 @@ if __name__ == "__main__":
# for job_name, job_result in checklist_results.items(): for test_name, test_result in job_result.items():
# print str(checklist_results)
- lava_server = build_configs[build_name]['lava_server']
+ lava_server = get_all_build_configs()[build_name]['lava_server']
jobs = get_jobs(build_name, build_no, lava_server, job_name_list=[])
print str(jobs)