summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/bldcontrol/tests.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-11-25 16:12:05 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-11-28 14:02:58 +0000
commit5790337cec89f9c848e706e5c305ee83ac76496c (patch)
tree945d3e81f053719c6ae6cc379d429c9f7658c709 /bitbake/lib/toaster/bldcontrol/tests.py
parentd9644d49fd72a7489982de551de0d0df73ac6d57 (diff)
downloadpoky-5790337cec89f9c848e706e5c305ee83ac76496c.tar.gz
bitbake: toaster: fix loadconf path calculation
Fixing the path calculation for local layer sources, as the path need to be absolute. Added tests for pieces of code. (Bitbake rev: e764834f3c7c7da9356fa11b62e1fa8f643986fc) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/bldcontrol/tests.py')
-rw-r--r--bitbake/lib/toaster/bldcontrol/tests.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/tests.py b/bitbake/lib/toaster/bldcontrol/tests.py
index 37d6524c36..5a9d1df37a 100644
--- a/bitbake/lib/toaster/bldcontrol/tests.py
+++ b/bitbake/lib/toaster/bldcontrol/tests.py
@@ -141,3 +141,22 @@ class RunBuildsCommandTests(TestCase):
141 self.assertTrue(br.state == BuildRequest.REQ_INPROGRESS, "Request is not updated") 141 self.assertTrue(br.state == BuildRequest.REQ_INPROGRESS, "Request is not updated")
142 # no more selections possible here 142 # no more selections possible here
143 self.assertRaises(IndexError, command._selectBuildRequest) 143 self.assertRaises(IndexError, command._selectBuildRequest)
144
145
146class UtilityTests(TestCase):
147 def test_reduce_path(self):
148 from bldcontrol.management.commands.loadconf import _reduce_canon_path, _get_id_for_sourcetype
149
150 self.assertTrue( _reduce_canon_path("/") == "/")
151 self.assertTrue( _reduce_canon_path("/home/..") == "/")
152 self.assertTrue( _reduce_canon_path("/home/../ana") == "/ana")
153 self.assertTrue( _reduce_canon_path("/home/../ana/..") == "/")
154 self.assertTrue( _reduce_canon_path("/home/ana/mihai/../maria") == "/home/ana/maria")
155
156 def test_get_id_for_sorucetype(self):
157 from bldcontrol.management.commands.loadconf import _reduce_canon_path, _get_id_for_sourcetype
158 self.assertTrue( _get_id_for_sourcetype("layerindex") == 1)
159 self.assertTrue( _get_id_for_sourcetype("local") == 0)
160 self.assertTrue( _get_id_for_sourcetype("imported") == 2)
161 with self.assertRaises(Exception):
162 _get_id_for_sourcetype("unknown")