From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 2020DE00894; Mon, 7 Mar 2016 11:17:26 -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.24 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 63557E00833 for ; Mon, 7 Mar 2016 11:17:23 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 07 Mar 2016 11:17:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,553,1449561600"; d="scan'208";a="928739717" Received: from gmorga1x-mobl.ger.corp.intel.com (HELO [10.252.19.21]) ([10.252.19.21]) by orsmga002.jf.intel.com with ESMTP; 07 Mar 2016 11:17:21 -0800 To: toaster@yoctoproject.org References: <1457353301-698-1-git-send-email-elliot.smith@intel.com> <1457353301-698-4-git-send-email-elliot.smith@intel.com> From: Michael Wood Message-ID: <56DDD3C0.3090201@intel.com> Date: Mon, 7 Mar 2016 19:17:20 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1457353301-698-4-git-send-email-elliot.smith@intel.com> Subject: Re: [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: Mon, 07 Mar 2016 19:17:26 -0000 Content-Type: text/plain; charset="windows-1252"; format="flowed" Content-Transfer-Encoding: quoted-printable Not really that keen on mixing HTML/content tests with the django = functional unit tests. To me this would be better tested by the = selenium/front end tests. On 07/03/16 12:21, Elliot Smith wrote: > 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/toaste= r/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, LogMe= ssage > from orm.models import ReleaseLayerSourcePriority, LayerSource, Layer, = Build > from orm.models import Layer_Version, Recipe, Machine, ProjectLayer, Ta= rget > -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=3Dnow, > completed_on=3Dnow) > = > + # target for build, so breadcrumb can display > + Target.objects.create(build=3Dself.build1, target=3D'bash', task= =3D'build') > + > + # layer_version, recipe and task for build, so CPU time data can= display > + layer =3D Layer.objects.create() > + layer_version =3D Layer_Version.objects.create(layer=3Dlayer) > + recipe =3D Recipe.objects.create(name=3D'zlib', layer_version=3D= layer_version) > + Task.objects.create(build=3Dself.build1, recipe=3Drecipe, order= =3D1, > + outcome=3DTask.OUTCOME_SUCCESS) > + > # exception > msg1 =3D 'an exception was thrown' > self.exception_message =3D 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 =3D reverse('cputime', args=3D(self.build1.id,)) > + response =3D self.client.get(url, follow=3DTrue) > + soup =3D BeautifulSoup(response.content) > + > + # check nav item is highlighted > + elements =3D soup.select('#nav li.active') > + self.assertEquals(len(elements), 1, > + 'should be one active nav element, ' + > + 'but found %s' % len(elements)) > + link_text =3D 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 =3D soup.select('.page-header h1')[0] > + self.assertEquals(heading.text.strip(), 'CPU time') > + > + # check CPU column headings are both present > + cpu_time_headings =3D ['System CPU time', 'User CPU time'] > + table_heading_links =3D 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_headi= ngs) --------------------------------------------------------------------- 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.