From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 5CEDBE00CB9; Tue, 23 Feb 2016 04:59:01 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high * trust * [134.134.136.65 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 129F1E00CDD for ; Tue, 23 Feb 2016 04:59:00 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP; 23 Feb 2016 04:59:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,489,1449561600"; d="scan'208";a="53161229" Received: from unknown (HELO lp.ger.corp.intel.com) ([10.252.4.192]) by fmsmga004.fm.intel.com with ESMTP; 23 Feb 2016 04:58:58 -0800 From: Elliot Smith To: toaster@yoctoproject.org Date: Tue, 23 Feb 2016 12:58:48 +0000 Message-Id: <1456232328-4319-4-git-send-email-elliot.smith@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1456232328-4319-1-git-send-email-elliot.smith@intel.com> References: <1456232328-4319-1-git-send-email-elliot.smith@intel.com> Subject: [PATCH 3/3] toaster-tests: add test for cputime subpage X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Feb 2016 12:59:01 -0000 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 --- 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 4e420ea..978ec44 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.