Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id A1881E00E35; Fri, 21 Oct 2016 10:08:02 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1 X-Spam-HAM-Report: * -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no * trust * [209.85.192.177 listed in list.dnswl.org] * 0.5 RCVD_IN_SORBS_SPAM RBL: SORBS: sender is a spam source * [209.85.192.177 listed in dnsbl.sorbs.net] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-pf0-f177.google.com (mail-pf0-f177.google.com [209.85.192.177]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 70D60E00E1F for ; Fri, 21 Oct 2016 10:08:01 -0700 (PDT) Received: by mail-pf0-f177.google.com with SMTP id r16so59829079pfg.1 for ; Fri, 21 Oct 2016 10:08:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gx/GGkyKvslni6PCP119PGYR6622f6zSSBTMpKp15pI=; b=kHFwQGETFb62TUnGLfC4oRa69NSbh3XbrWeO/xuLZ0tp9ukkr2pasobhTeS7rkns5t vJteqdSVh4WmpcgJV/gC8oijkfmWiIdp6hSNBxrb+HvK6gPYvlrTl8eK1EUQTfwuj1jZ REgONEsGm0O9RVg2i+Swh+Tkj4d7D/2SxkRk86EmJ172LoN85LBo/m/sKI1Kcj3Ld5tC auNCciFfK9erSoXQ0zulShKgBsnZ7ZOODfw7y1Tmjm7L8Udssf15x3t7nr1ryHfPR0Ic DX2DhVWWVWFFUBOwFdvn3s5kJX3J9x1dW6VRk/oG//YBuLMo4fdB70K0C5a+gtyfKABn 2xcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gx/GGkyKvslni6PCP119PGYR6622f6zSSBTMpKp15pI=; b=W9gMZ/9AYa5QT+noD2NaFwROAUBJyyvxMol/mwGvOHFeZTyetHRSDJ4sE4RFv9rx5D 41iXSv/j2LLLhnBx0WASzQu9a+MAN9Xcq/fA8LZ6BJrDTt3WvkskwgF4sP9TLE+ThjmG mAU0VlTe3E6YCLD4R4qP9ai1Ebx/1q00RluZYS0eJcrKgO3LGZIxDShEqoO6Y/TObkcJ kOts4RYuJIu8WEK3VkvX9ubL8rMR6Jcsq8emd3yy8A4JFeCk1ihtCD510HteQdf7+4qR j+9NCwZSRC4FOUEGexVs7tBuqn7Anb6Ixzk/+rWNpHGqV5a5IdNnXwaProvaaLcXgu+W ci3g== X-Gm-Message-State: ABUngvdsa+xzJ8DvxF884XoNbU2igYOwKuNncP7FXfWAGqZKvdoFB4mwNoK+VjeTiBO4igLg X-Received: by 10.98.30.129 with SMTP id e123mr1836673pfe.175.1477069680563; Fri, 21 Oct 2016 10:08:00 -0700 (PDT) Received: from orion.ger.corp.intel.com (fmdmzpr01-ext.fm.intel.com. [192.55.54.36]) by smtp.gmail.com with ESMTPSA id v10sm6514350pag.44.2016.10.21.10.07.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 21 Oct 2016 10:08:00 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Fri, 21 Oct 2016 18:07:41 +0100 Message-Id: <1477069666-25701-4-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477069666-25701-1-git-send-email-michael.g.wood@intel.com> References: <1477069666-25701-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 3/8] toaster: Delete useless bldcontrol/test 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: Fri, 21 Oct 2016 17:08:02 -0000 It doesn't work nor does it test anything useful Signed-off-by: Michael Wood --- bitbake/lib/toaster/bldcontrol/tests.py | 141 -------------------------------- 1 file changed, 141 deletions(-) delete mode 100644 bitbake/lib/toaster/bldcontrol/tests.py diff --git a/bitbake/lib/toaster/bldcontrol/tests.py b/bitbake/lib/toaster/bldcontrol/tests.py deleted file mode 100644 index 475ac0a..0000000 --- a/bitbake/lib/toaster/bldcontrol/tests.py +++ /dev/null @@ -1,141 +0,0 @@ -""" -This file demonstrates writing tests using the unittest module. These will pass -when you run "manage.py test". - -Replace this with more appropriate tests for your application. -""" - -from django.test import TestCase - -from bldcontrol.bbcontroller import BitbakeController, BuildSetupException -from bldcontrol.localhostbecontroller import LocalhostBEController -from bldcontrol.models import BuildEnvironment, BuildRequest -from bldcontrol.management.commands.runbuilds import Command - -import socket -import subprocess -import os - -# standard poky data hardcoded for testing -BITBAKE_LAYER = type('bitbake_info', (object,), { "giturl": "git://git.yoctoproject.org/poky.git", "dirpath": "", "commit": "HEAD"}) -POKY_LAYERS = [ - type('poky_info', (object,), { "name": "meta", "giturl": "git://git.yoctoproject.org/poky.git", "dirpath": "meta", "commit": "HEAD"}), - type('poky_info', (object,), { "name": "meta-yocto", "giturl": "git://git.yoctoproject.org/poky.git", "dirpath": "meta-yocto", "commit": "HEAD"}), - type('poky_info', (object,), { "name": "meta-yocto-bsp", "giturl": "git://git.yoctoproject.org/poky.git", "dirpath": "meta-yocto-bsp", "commit": "HEAD"}), - ] - - - -# we have an abstract test class designed to ensure that the controllers use a single interface -# specific controller tests only need to override the _getBuildEnvironment() method - -test_sourcedir = os.getenv("TTS_SOURCE_DIR") -test_builddir = os.getenv("TTS_BUILD_DIR") -test_address = os.getenv("TTS_TEST_ADDRESS", "localhost") - -if test_sourcedir == None or test_builddir == None or test_address == None: - raise Exception("Please set TTTS_SOURCE_DIR, TTS_BUILD_DIR and TTS_TEST_ADDRESS") - -# The bb server will expect a toaster-pre.conf file to exist. If it doesn't exit then we make -# an empty one here. -open(test_builddir + 'conf/toaster-pre.conf', 'a').close() - -class BEControllerTests(object): - - def _serverForceStop(self, bc): - err = bc._shellcmd("netstat -tapn 2>/dev/null | grep 8200 | awk '{print $7}' | sort -fu | cut -d \"/\" -f 1 | grep -v -- - | tee /dev/fd/2 | xargs -r kill") - self.assertTrue(err == '', "bitbake server pid %s not stopped" % err) - - def test_serverStartAndStop(self): - obe = self._getBuildEnvironment() - bc = self._getBEController(obe) - try: - # setting layers, skip any layer info - bc.setLayers(BITBAKE_LAYER, POKY_LAYERS) - except NotImplementedError: - print("Test skipped due to command not implemented yet") - return True - # We are ok with the exception as we're handling the git already exists - except BuildSetupException: - pass - - bc.pokydirname = test_sourcedir - bc.islayerset = True - - hostname = test_address.split("@")[-1] - - # test start server and stop - bc.startBBServer() - - self.assertFalse(socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex((hostname, int(bc.be.bbport))), "Server not answering") - - self._serverForceStop(bc) - - def test_getBBController(self): - obe = self._getBuildEnvironment() - bc = self._getBEController(obe) - layerSet = False - try: - # setting layers, skip any layer info - layerSet = bc.setLayers(BITBAKE_LAYER, POKY_LAYERS) - except NotImplementedError: - print("Test skipped due to command not implemented yet") - return True - # We are ok with the exception as we're handling the git already exists - except BuildSetupException: - pass - - bc.pokydirname = test_sourcedir - bc.islayerset = True - - bbc = bc.getBBController() - self.assertTrue(isinstance(bbc, BitbakeController)) - - self._serverForceStop(bc) - -class LocalhostBEControllerTests(TestCase, BEControllerTests): - def __init__(self, *args): - super(LocalhostBEControllerTests, self).__init__(*args) - - - def _getBuildEnvironment(self): - return BuildEnvironment.objects.create( - lock = BuildEnvironment.LOCK_FREE, - betype = BuildEnvironment.TYPE_LOCAL, - address = test_address, - sourcedir = test_sourcedir, - builddir = test_builddir ) - - def _getBEController(self, obe): - return LocalhostBEController(obe) - -class RunBuildsCommandTests(TestCase): - def test_bec_select(self): - """ - Tests that we can find and lock a build environment - """ - - obe = BuildEnvironment.objects.create(lock = BuildEnvironment.LOCK_FREE, betype = BuildEnvironment.TYPE_LOCAL) - command = Command() - bec = command._selectBuildEnvironment() - - # make sure we select the object we've just built - self.assertTrue(bec.be.id == obe.id, "Environment is not properly selected") - # we have a locked environment - self.assertTrue(bec.be.lock == BuildEnvironment.LOCK_LOCK, "Environment is not locked") - # no more selections possible here - self.assertRaises(IndexError, command._selectBuildEnvironment) - - def test_br_select(self): - from orm.models import Project, Release, BitbakeVersion, Branch - p = Project.objects.create_project("test", Release.objects.get_or_create(name = "HEAD", bitbake_version = BitbakeVersion.objects.get_or_create(name="HEAD", branch=Branch.objects.get_or_create(name="HEAD"))[0])[0]) - obr = BuildRequest.objects.create(state = BuildRequest.REQ_QUEUED, project = p) - command = Command() - br = command._selectBuildRequest() - - # make sure we select the object we've just built - self.assertTrue(obr.id == br.id, "Request is not properly selected") - # we have a locked environment - self.assertTrue(br.state == BuildRequest.REQ_INPROGRESS, "Request is not updated") - # no more selections possible here - self.assertRaises(IndexError, command._selectBuildRequest) -- 2.7.4