From: Elliot Smith <elliot.smith@intel.com>
To: toaster@yoctoproject.org
Subject: [PATCH 3/3] toaster-tests: add test for cputime subpage
Date: Mon, 7 Mar 2016 12:21:41 +0000 [thread overview]
Message-ID: <1457353301-698-4-git-send-email-elliot.smith@intel.com> (raw)
In-Reply-To: <1457353301-698-1-git-send-email-elliot.smith@intel.com>
Add a basic test which checks that the CPU time subpage for
the build dashboard shows both the User and System CPU time columns
by default.
[YOCTO #8842]
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
---
bitbake/lib/toaster/toastergui/tests.py | 45 ++++++++++++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index 6b05916..b5862b7 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -29,7 +29,7 @@ from django.utils import timezone
from orm.models import Project, Release, BitbakeVersion, Package, LogMessage
from orm.models import ReleaseLayerSourcePriority, LayerSource, Layer, Build
from orm.models import Layer_Version, Recipe, Machine, ProjectLayer, Target
-from orm.models import CustomImageRecipe, ProjectVariable
+from orm.models import CustomImageRecipe, ProjectVariable, Task
from orm.models import Branch, CustomImagePackage
import toastermain
@@ -1054,6 +1054,16 @@ class BuildDashboardTests(TestCase):
started_on=now,
completed_on=now)
+ # target for build, so breadcrumb can display
+ Target.objects.create(build=self.build1, target='bash', task='build')
+
+ # layer_version, recipe and task for build, so CPU time data can display
+ layer = Layer.objects.create()
+ layer_version = Layer_Version.objects.create(layer=layer)
+ recipe = Recipe.objects.create(name='zlib', layer_version=layer_version)
+ Task.objects.create(build=self.build1, recipe=recipe, order=1,
+ outcome=Task.OUTCOME_SUCCESS)
+
# exception
msg1 = 'an exception was thrown'
self.exception_message = LogMessage.objects.create(
@@ -1123,3 +1133,36 @@ class BuildDashboardTests(TestCase):
section of the page
"""
self._check_for_log_message(self.critical_message)
+
+ def test_cputime(self):
+ """
+ Check that the system and user CPU time columns are displayed
+ when the cputime subpage is shown
+ """
+ url = reverse('cputime', args=(self.build1.id,))
+ response = self.client.get(url, follow=True)
+ soup = BeautifulSoup(response.content)
+
+ # check nav item is highlighted
+ elements = soup.select('#nav li.active')
+ self.assertEquals(len(elements), 1,
+ 'should be one active nav element, ' +
+ 'but found %s' % len(elements))
+ link_text = elements[0].find('a').text.strip()
+ self.assertEquals(link_text, 'CPU time',
+ 'active nav element should have text "CPU time", ' +
+ 'but text was %s' % link_text)
+
+ # check page heading
+ heading = soup.select('.page-header h1')[0]
+ self.assertEquals(heading.text.strip(), 'CPU time')
+
+ # check CPU column headings are both present
+ cpu_time_headings = ['System CPU time', 'User CPU time']
+ table_heading_links = soup.select('#otable th a')
+ for link in table_heading_links:
+ if link.text.strip() in cpu_time_headings:
+ cpu_time_headings.remove(link.text)
+ self.assertEquals(len(cpu_time_headings), 0,
+ 'Both CPU time headings (user, system) ' +
+ 'must be present; missing %s' % cpu_time_headings)
--
Elliot Smith
Software Engineer
Intel OTC
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
next prev parent reply other threads:[~2016-03-07 12:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-07 12:21 [PATCH 0/3][v7] Fix task buildstats gathering Elliot Smith
2016-03-07 12:21 ` [PATCH 1/3] toaster.bbclass: improve how we gather buildstats for Toaster Elliot Smith
2016-03-07 18:39 ` Michael Wood
2016-03-07 19:26 ` Smith, Elliot
2016-03-07 12:21 ` [PATCH 2/3] toaster: rework task buildstats storage and display Elliot Smith
2016-03-07 19:06 ` Michael Wood
2016-03-07 19:25 ` Smith, Elliot
2016-03-07 20:00 ` Smith, Elliot
2016-03-07 12:21 ` Elliot Smith [this message]
2016-03-07 19:17 ` [PATCH 3/3] toaster-tests: add test for cputime subpage Michael Wood
2016-03-07 19:24 ` Smith, Elliot
2016-03-07 20:04 ` Smith, Elliot
-- strict thread matches above, loose matches on Subject: below --
2016-02-24 11:15 [PATCH 0/3][v6] Fix task buildstats gathering Elliot Smith
2016-02-24 11:15 ` [PATCH 3/3] toaster-tests: add test for cputime subpage Elliot Smith
2016-02-23 18:17 [PATCH 0/3][v5] Fix task buildstats gathering Elliot Smith
2016-02-23 18:17 ` [PATCH 3/3] toaster-tests: add test for cputime subpage Elliot Smith
2016-02-23 12:58 [PATCH 0/3][v4] Fix task buildstats gathering Elliot Smith
2016-02-23 12:58 ` [PATCH 3/3] toaster-tests: add test for cputime subpage Elliot Smith
2016-02-23 12:56 [PATCH 0/3][v3] Fix task buildstats gathering Elliot Smith
2016-02-23 12:56 ` [PATCH 3/3] toaster-tests: add test for cputime subpage Elliot Smith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1457353301-698-4-git-send-email-elliot.smith@intel.com \
--to=elliot.smith@intel.com \
--cc=toaster@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.