diff options
author | Elliot Smith <elliot.smith@intel.com> | 2016-07-12 15:54:58 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-19 08:56:52 +0100 |
commit | 8d08a73225ca665189fa922b87618638f86ca0f9 (patch) | |
tree | f125d392cdbfa15c39241649e1066a6ba8aa5482 /bitbake/lib | |
parent | 8ccf8392aa07c14b99f946585f27aff8f2e425de (diff) | |
download | poky-8d08a73225ca665189fa922b87618638f86ca0f9.tar.gz |
bitbake: toaster-tests: package count/size shouldn't show for non-image builds
If a build doesn't produce any image files, the package count
and size shouldn't be shown.
Also add some metadata to build dashboard elements so it is clear
what they're for, and so they can be queried by the tests.
(Bitbake rev: 3d5090af4475b1d0bb56911a8e30abf9097c1b3c)
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: bavery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py | 42 | ||||
-rw-r--r-- | bitbake/lib/toaster/toastergui/templates/builddashboard.html | 29 |
2 files changed, 63 insertions, 8 deletions
diff --git a/bitbake/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py b/bitbake/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py index 18e4475711..39b0e207fc 100644 --- a/bitbake/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py +++ b/bitbake/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py | |||
@@ -24,8 +24,9 @@ from django.utils import timezone | |||
24 | 24 | ||
25 | from tests.browser.selenium_helpers import SeleniumTestCase | 25 | from tests.browser.selenium_helpers import SeleniumTestCase |
26 | 26 | ||
27 | from orm.models import Project, Release, BitbakeVersion, Build, Target | 27 | from orm.models import Project, Release, BitbakeVersion, Build, Target, Package |
28 | from orm.models import Target_Image_File, TargetSDKFile, TargetKernelFile | 28 | from orm.models import Target_Image_File, TargetSDKFile, TargetKernelFile |
29 | from orm.models import Target_Installed_Package | ||
29 | 30 | ||
30 | class TestBuildDashboardPageArtifacts(SeleniumTestCase): | 31 | class TestBuildDashboardPageArtifacts(SeleniumTestCase): |
31 | """ Tests for artifacts on the build dashboard /build/X """ | 32 | """ Tests for artifacts on the build dashboard /build/X """ |
@@ -86,6 +87,8 @@ class TestBuildDashboardPageArtifacts(SeleniumTestCase): | |||
86 | """ | 87 | """ |
87 | If a build produced SDK artifacts, they should be shown, but the section | 88 | If a build produced SDK artifacts, they should be shown, but the section |
88 | for image files and the images menu option should be hidden. | 89 | for image files and the images menu option should be hidden. |
90 | |||
91 | The packages count and size should also be hidden. | ||
89 | """ | 92 | """ |
90 | now = timezone.now() | 93 | now = timezone.now() |
91 | build = Build.objects.create(project=self.project, | 94 | build = Build.objects.create(project=self.project, |
@@ -120,11 +123,28 @@ class TestBuildDashboardPageArtifacts(SeleniumTestCase): | |||
120 | self.assertEqual(len(sdk_artifact_links), 2, | 123 | self.assertEqual(len(sdk_artifact_links), 2, |
121 | 'should be links to 2 SDK artifacts') | 124 | 'should be links to 2 SDK artifacts') |
122 | 125 | ||
126 | # package count and size should not be visible, no link on | ||
127 | # target name | ||
128 | selector = '[data-value="target-package-count"]' | ||
129 | self.assertFalse(self.element_exists(selector), | ||
130 | 'package count should not be shown for non-image builds') | ||
131 | |||
132 | selector = '[data-value="target-package-size"]' | ||
133 | self.assertFalse(self.element_exists(selector), | ||
134 | 'package size should not be shown for non-image builds') | ||
135 | |||
136 | selector = '[data-link="target-packages"]' | ||
137 | self.assertFalse(self.element_exists(selector), | ||
138 | 'link to target packages should not be on target heading') | ||
139 | |||
123 | def test_image_artifacts(self): | 140 | def test_image_artifacts(self): |
124 | """ | 141 | """ |
125 | If a build produced image files, kernel artifacts, and manifests, | 142 | If a build produced image files, kernel artifacts, and manifests, |
126 | they should all be shown, as well as the image link in the left-hand | 143 | they should all be shown, as well as the image link in the left-hand |
127 | menu. | 144 | menu. |
145 | |||
146 | The packages count and size should be shown, with a link to the | ||
147 | package display page. | ||
128 | """ | 148 | """ |
129 | now = timezone.now() | 149 | now = timezone.now() |
130 | build = Build.objects.create(project=self.project, | 150 | build = Build.objects.create(project=self.project, |
@@ -145,6 +165,11 @@ class TestBuildDashboardPageArtifacts(SeleniumTestCase): | |||
145 | kernel_file2 = TargetKernelFile.objects.create(target=target, | 165 | kernel_file2 = TargetKernelFile.objects.create(target=target, |
146 | file_name='/home/foo/bzImage', file_size=2000) | 166 | file_name='/home/foo/bzImage', file_size=2000) |
147 | 167 | ||
168 | package = Package.objects.create(build=build, name='foo', size=1024, | ||
169 | installed_name='foo1') | ||
170 | installed_package = Target_Installed_Package.objects.create( | ||
171 | target=target, package=package) | ||
172 | |||
148 | self._get_build_dashboard(build) | 173 | self._get_build_dashboard(build) |
149 | 174 | ||
150 | # check build artifacts heading | 175 | # check build artifacts heading |
@@ -175,3 +200,18 @@ class TestBuildDashboardPageArtifacts(SeleniumTestCase): | |||
175 | selector = 'a[data-link="package-manifest"]' | 200 | selector = 'a[data-link="package-manifest"]' |
176 | self.assertTrue(self.element_exists(selector), | 201 | self.assertTrue(self.element_exists(selector), |
177 | 'should be a link to the package manifest (selector %s)' % selector) | 202 | 'should be a link to the package manifest (selector %s)' % selector) |
203 | |||
204 | # check package count and size, link on target name | ||
205 | selector = '[data-value="target-package-count"]' | ||
206 | element = self.find(selector) | ||
207 | self.assertEquals(element.text, '1', | ||
208 | 'package count should be shown for image builds') | ||
209 | |||
210 | selector = '[data-value="target-package-size"]' | ||
211 | element = self.find(selector) | ||
212 | self.assertEquals(element.text, '1.0 KB', | ||
213 | 'package size should be shown for image builds') | ||
214 | |||
215 | selector = '[data-link="target-packages"]' | ||
216 | self.assertTrue(self.element_exists(selector), | ||
217 | 'link to target packages should be on target heading') | ||
diff --git a/bitbake/lib/toaster/toastergui/templates/builddashboard.html b/bitbake/lib/toaster/toastergui/templates/builddashboard.html index bc41e23622..07fc26c6dd 100644 --- a/bitbake/lib/toaster/toastergui/templates/builddashboard.html +++ b/bitbake/lib/toaster/toastergui/templates/builddashboard.html | |||
@@ -74,13 +74,28 @@ | |||
74 | {% for target in targets %} | 74 | {% for target in targets %} |
75 | {% if target.target.is_image %} | 75 | {% if target.target.is_image %} |
76 | <div class="well well-transparent dashboard-section" data-artifacts-for-target="{{target.target.pk}}"> | 76 | <div class="well well-transparent dashboard-section" data-artifacts-for-target="{{target.target.pk}}"> |
77 | <h3><a href="{% url 'target' build.pk target.target.pk %}">{{target.target.target}}</a></h3> | 77 | {% if target.npkg > 0 %} |
78 | <dl class="dl-horizontal"> | 78 | <h3> |
79 | <dt>Packages included</dt> | 79 | <a href="{% url 'target' build.pk target.target.pk %}" data-link="target-packages"> |
80 | <dd><a href="{% url 'target' build.pk target.target.pk %}">{{target.npkg}}</a></dd> | 80 | {{target.target.target}} |
81 | <dt>Total package size</dt> | 81 | </a> |
82 | <dd>{{target.pkgsz|filtered_filesizeformat}}</dd> | 82 | </h3> |
83 | </dl> | 83 | <dl class="dl-horizontal"> |
84 | <dt>Packages included</dt> | ||
85 | <dd> | ||
86 | <a href="{% url 'target' build.pk target.target.pk %}"> | ||
87 | <span data-value="target-package-count">{{target.npkg}}</span> | ||
88 | </a> | ||
89 | </dd> | ||
90 | <dt>Total package size</dt> | ||
91 | <dd> | ||
92 | <span data-value="target-package-size">{{target.pkgsz|filtered_filesizeformat}}</span> | ||
93 | </dd> | ||
94 | </dl> | ||
95 | {% else %} | ||
96 | <h3>{{target.target.target}}</h3> | ||
97 | {% endif %} | ||
98 | |||
84 | {% if target.targetHasImages %} | 99 | {% if target.targetHasImages %} |
85 | <dl class="dl-horizontal"> | 100 | <dl class="dl-horizontal"> |
86 | <dt> | 101 | <dt> |