diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-11-07 13:31:53 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-11-07 13:31:53 +0000 |
| commit | 8c22ff0d8b70d9b12f0487ef696a7e915b9e3173 (patch) | |
| tree | efdc32587159d0050a69009bdf2330a531727d95 /bitbake/lib/layerindexlib/tests | |
| parent | d412d2747595c1cc4a5e3ca975e3adc31b2f7891 (diff) | |
| download | poky-8c22ff0d8b70d9b12f0487ef696a7e915b9e3173.tar.gz | |
The poky repository master branch is no longer being updated.
You can either:
a) switch to individual clones of bitbake, openembedded-core, meta-yocto and yocto-docs
b) use the new bitbake-setup
You can find information about either approach in our documentation:
https://docs.yoctoproject.org/
Note that "poky" the distro setting is still available in meta-yocto as
before and we continue to use and maintain that.
Long live Poky!
Some further information on the background of this change can be found
in: https://lists.openembedded.org/g/openembedded-architecture/message/2179
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/layerindexlib/tests')
11 files changed, 0 insertions, 628 deletions
diff --git a/bitbake/lib/layerindexlib/tests/__init__.py b/bitbake/lib/layerindexlib/tests/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/bitbake/lib/layerindexlib/tests/__init__.py +++ /dev/null | |||
diff --git a/bitbake/lib/layerindexlib/tests/common.py b/bitbake/lib/layerindexlib/tests/common.py deleted file mode 100644 index 077382f11d..0000000000 --- a/bitbake/lib/layerindexlib/tests/common.py +++ /dev/null | |||
| @@ -1,33 +0,0 @@ | |||
| 1 | # Copyright (C) 2017-2018 Wind River Systems, Inc. | ||
| 2 | # | ||
| 3 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 4 | # | ||
| 5 | |||
| 6 | import unittest | ||
| 7 | import tempfile | ||
| 8 | import os | ||
| 9 | import bb | ||
| 10 | |||
| 11 | import logging | ||
| 12 | |||
| 13 | class LayersTest(unittest.TestCase): | ||
| 14 | |||
| 15 | def setUp(self): | ||
| 16 | self.origdir = os.getcwd() | ||
| 17 | self.d = bb.data.init() | ||
| 18 | # At least one variable needs to be set | ||
| 19 | self.d.setVar('DL_DIR', os.getcwd()) | ||
| 20 | |||
| 21 | if os.environ.get("BB_SKIP_NETTESTS") == "yes": | ||
| 22 | self.d.setVar('BB_NO_NETWORK', '1') | ||
| 23 | |||
| 24 | self.tempdir = tempfile.mkdtemp() | ||
| 25 | self.logger = logging.getLogger("BitBake") | ||
| 26 | |||
| 27 | def tearDown(self): | ||
| 28 | os.chdir(self.origdir) | ||
| 29 | if os.environ.get("BB_TMPDIR_NOCLEAN") == "yes": | ||
| 30 | print("Not cleaning up %s. Please remove manually." % self.tempdir) | ||
| 31 | else: | ||
| 32 | bb.utils.prunedir(self.tempdir) | ||
| 33 | |||
diff --git a/bitbake/lib/layerindexlib/tests/cooker.py b/bitbake/lib/layerindexlib/tests/cooker.py deleted file mode 100644 index 5ddf89aa21..0000000000 --- a/bitbake/lib/layerindexlib/tests/cooker.py +++ /dev/null | |||
| @@ -1,110 +0,0 @@ | |||
| 1 | # Copyright (C) 2018 Wind River Systems, Inc. | ||
| 2 | # | ||
| 3 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 4 | # | ||
| 5 | |||
| 6 | import os | ||
| 7 | import bb | ||
| 8 | |||
| 9 | import layerindexlib | ||
| 10 | from layerindexlib.tests.common import LayersTest | ||
| 11 | |||
| 12 | |||
| 13 | class LayerIndexCookerTest(LayersTest): | ||
| 14 | |||
| 15 | def setUp(self): | ||
| 16 | LayersTest.setUp(self) | ||
| 17 | |||
| 18 | # Note this is NOT a comprehensive test of cooker, as we can't easily | ||
| 19 | # configure the test data. But we can emulate the basics of the layer.conf | ||
| 20 | # files, so that is what we will do. | ||
| 21 | |||
| 22 | new_topdir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "testdata") | ||
| 23 | new_bbpath = os.path.join(new_topdir, "build") | ||
| 24 | |||
| 25 | self.d.setVar('TOPDIR', new_topdir) | ||
| 26 | self.d.setVar('BBPATH', new_bbpath) | ||
| 27 | |||
| 28 | self.d = bb.parse.handle("%s/conf/bblayers.conf" % new_bbpath, self.d, True) | ||
| 29 | for layer in self.d.getVar('BBLAYERS').split(): | ||
| 30 | self.d = bb.parse.handle("%s/conf/layer.conf" % layer, self.d, True) | ||
| 31 | |||
| 32 | self.layerindex = layerindexlib.LayerIndex(self.d) | ||
| 33 | self.layerindex.load_layerindex('cooker://', load=['layerDependencies']) | ||
| 34 | |||
| 35 | def test_layerindex_is_empty(self): | ||
| 36 | self.assertFalse(self.layerindex.is_empty(), msg="Layerindex is not empty!") | ||
| 37 | |||
| 38 | def test_dependency_resolution(self): | ||
| 39 | # Verify depth first searching... | ||
| 40 | (dependencies, invalidnames) = self.layerindex.find_dependencies(names=['meta-python']) | ||
| 41 | |||
| 42 | first = True | ||
| 43 | for deplayerbranch in dependencies: | ||
| 44 | layerBranch = dependencies[deplayerbranch][0] | ||
| 45 | layerDeps = dependencies[deplayerbranch][1:] | ||
| 46 | |||
| 47 | if not first: | ||
| 48 | continue | ||
| 49 | |||
| 50 | first = False | ||
| 51 | |||
| 52 | # Top of the deps should be openembedded-core, since everything depends on it. | ||
| 53 | self.assertEqual(layerBranch.layer.name, "openembedded-core", msg='Top dependency not openembedded-core') | ||
| 54 | |||
| 55 | # meta-python should cause an openembedded-core dependency, if not assert! | ||
| 56 | for dep in layerDeps: | ||
| 57 | if dep.layer.name == 'meta-python': | ||
| 58 | break | ||
| 59 | else: | ||
| 60 | self.assertTrue(False, msg='meta-python was not found') | ||
| 61 | |||
| 62 | # Only check the first element... | ||
| 63 | break | ||
| 64 | else: | ||
| 65 | if first: | ||
| 66 | # Empty list, this is bad. | ||
| 67 | self.assertTrue(False, msg='Empty list of dependencies') | ||
| 68 | |||
| 69 | # Last dep should be the requested item | ||
| 70 | layerBranch = dependencies[deplayerbranch][0] | ||
| 71 | self.assertEqual(layerBranch.layer.name, "meta-python", msg='Last dependency not meta-python') | ||
| 72 | |||
| 73 | def test_find_collection(self): | ||
| 74 | def _check(collection, expected): | ||
| 75 | self.logger.debug("Looking for collection %s..." % collection) | ||
| 76 | result = self.layerindex.find_collection(collection) | ||
| 77 | if expected: | ||
| 78 | self.assertIsNotNone(result, msg="Did not find %s when it shouldn't be there" % collection) | ||
| 79 | else: | ||
| 80 | self.assertIsNone(result, msg="Found %s when it should be there" % collection) | ||
| 81 | |||
| 82 | tests = [ ('core', True), | ||
| 83 | ('openembedded-core', False), | ||
| 84 | ('networking-layer', True), | ||
| 85 | ('meta-python', True), | ||
| 86 | ('openembedded-layer', True), | ||
| 87 | ('notpresent', False) ] | ||
| 88 | |||
| 89 | for collection,result in tests: | ||
| 90 | _check(collection, result) | ||
| 91 | |||
| 92 | def test_find_layerbranch(self): | ||
| 93 | def _check(name, expected): | ||
| 94 | self.logger.debug("Looking for layerbranch %s..." % name) | ||
| 95 | result = self.layerindex.find_layerbranch(name) | ||
| 96 | if expected: | ||
| 97 | self.assertIsNotNone(result, msg="Did not find %s when it shouldn't be there" % collection) | ||
| 98 | else: | ||
| 99 | self.assertIsNone(result, msg="Found %s when it should be there" % collection) | ||
| 100 | |||
| 101 | tests = [ ('openembedded-core', True), | ||
| 102 | ('core', False), | ||
| 103 | ('networking-layer', True), | ||
| 104 | ('meta-python', True), | ||
| 105 | ('openembedded-layer', True), | ||
| 106 | ('notpresent', False) ] | ||
| 107 | |||
| 108 | for collection,result in tests: | ||
| 109 | _check(collection, result) | ||
| 110 | |||
diff --git a/bitbake/lib/layerindexlib/tests/layerindexobj.py b/bitbake/lib/layerindexlib/tests/layerindexobj.py deleted file mode 100644 index de1e474687..0000000000 --- a/bitbake/lib/layerindexlib/tests/layerindexobj.py +++ /dev/null | |||
| @@ -1,210 +0,0 @@ | |||
| 1 | # Copyright (C) 2017-2018 Wind River Systems, Inc. | ||
| 2 | # | ||
| 3 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 4 | # | ||
| 5 | |||
| 6 | from layerindexlib.tests.common import LayersTest | ||
| 7 | |||
| 8 | |||
| 9 | class LayerIndexObjectsTest(LayersTest): | ||
| 10 | def setUp(self): | ||
| 11 | from layerindexlib import LayerIndexObj, Branch, LayerItem, LayerBranch, LayerDependency, Recipe, Machine, Distro | ||
| 12 | |||
| 13 | LayersTest.setUp(self) | ||
| 14 | |||
| 15 | self.index = LayerIndexObj() | ||
| 16 | |||
| 17 | branchId = 0 | ||
| 18 | layerItemId = 0 | ||
| 19 | layerBranchId = 0 | ||
| 20 | layerDependencyId = 0 | ||
| 21 | recipeId = 0 | ||
| 22 | machineId = 0 | ||
| 23 | distroId = 0 | ||
| 24 | |||
| 25 | self.index.branches = {} | ||
| 26 | self.index.layerItems = {} | ||
| 27 | self.index.layerBranches = {} | ||
| 28 | self.index.layerDependencies = {} | ||
| 29 | self.index.recipes = {} | ||
| 30 | self.index.machines = {} | ||
| 31 | self.index.distros = {} | ||
| 32 | |||
| 33 | branchId += 1 | ||
| 34 | self.index.branches[branchId] = Branch(self.index) | ||
| 35 | self.index.branches[branchId].define_data(branchId, | ||
| 36 | 'test_branch', 'bb_test_branch') | ||
| 37 | self.index.branches[branchId].lockData() | ||
| 38 | |||
| 39 | layerItemId +=1 | ||
| 40 | self.index.layerItems[layerItemId] = LayerItem(self.index) | ||
| 41 | self.index.layerItems[layerItemId].define_data(layerItemId, | ||
| 42 | 'test_layerItem', vcs_url='git://git_test_url/test_layerItem') | ||
| 43 | self.index.layerItems[layerItemId].lockData() | ||
| 44 | |||
| 45 | layerBranchId +=1 | ||
| 46 | self.index.layerBranches[layerBranchId] = LayerBranch(self.index) | ||
| 47 | self.index.layerBranches[layerBranchId].define_data(layerBranchId, | ||
| 48 | 'test_collection', '99', layerItemId, | ||
| 49 | branchId) | ||
| 50 | |||
| 51 | recipeId += 1 | ||
| 52 | self.index.recipes[recipeId] = Recipe(self.index) | ||
| 53 | self.index.recipes[recipeId].define_data(recipeId, 'test_git.bb', | ||
| 54 | 'recipes-test', 'test', 'git', | ||
| 55 | layerBranchId) | ||
| 56 | |||
| 57 | machineId += 1 | ||
| 58 | self.index.machines[machineId] = Machine(self.index) | ||
| 59 | self.index.machines[machineId].define_data(machineId, | ||
| 60 | 'test_machine', 'test_machine', | ||
| 61 | layerBranchId) | ||
| 62 | |||
| 63 | distroId += 1 | ||
| 64 | self.index.distros[distroId] = Distro(self.index) | ||
| 65 | self.index.distros[distroId].define_data(distroId, | ||
| 66 | 'test_distro', 'test_distro', | ||
| 67 | layerBranchId) | ||
| 68 | |||
| 69 | layerItemId +=1 | ||
| 70 | self.index.layerItems[layerItemId] = LayerItem(self.index) | ||
| 71 | self.index.layerItems[layerItemId].define_data(layerItemId, 'test_layerItem 2', | ||
| 72 | vcs_url='git://git_test_url/test_layerItem') | ||
| 73 | |||
| 74 | layerBranchId +=1 | ||
| 75 | self.index.layerBranches[layerBranchId] = LayerBranch(self.index) | ||
| 76 | self.index.layerBranches[layerBranchId].define_data(layerBranchId, | ||
| 77 | 'test_collection_2', '72', layerItemId, | ||
| 78 | branchId, actual_branch='some_other_branch') | ||
| 79 | |||
| 80 | layerDependencyId += 1 | ||
| 81 | self.index.layerDependencies[layerDependencyId] = LayerDependency(self.index) | ||
| 82 | self.index.layerDependencies[layerDependencyId].define_data(layerDependencyId, | ||
| 83 | layerBranchId, 1) | ||
| 84 | |||
| 85 | layerDependencyId += 1 | ||
| 86 | self.index.layerDependencies[layerDependencyId] = LayerDependency(self.index) | ||
| 87 | self.index.layerDependencies[layerDependencyId].define_data(layerDependencyId, | ||
| 88 | layerBranchId, 1, required=False) | ||
| 89 | |||
| 90 | def test_branch(self): | ||
| 91 | branch = self.index.branches[1] | ||
| 92 | self.assertEqual(branch.id, 1) | ||
| 93 | self.assertEqual(branch.name, 'test_branch') | ||
| 94 | self.assertEqual(branch.short_description, 'test_branch') | ||
| 95 | self.assertEqual(branch.bitbake_branch, 'bb_test_branch') | ||
| 96 | |||
| 97 | def test_layerItem(self): | ||
| 98 | layerItem = self.index.layerItems[1] | ||
| 99 | self.assertEqual(layerItem.id, 1) | ||
| 100 | self.assertEqual(layerItem.name, 'test_layerItem') | ||
| 101 | self.assertEqual(layerItem.summary, 'test_layerItem') | ||
| 102 | self.assertEqual(layerItem.description, 'test_layerItem') | ||
| 103 | self.assertEqual(layerItem.vcs_url, 'git://git_test_url/test_layerItem') | ||
| 104 | self.assertEqual(layerItem.vcs_web_url, None) | ||
| 105 | self.assertIsNone(layerItem.vcs_web_tree_base_url) | ||
| 106 | self.assertIsNone(layerItem.vcs_web_file_base_url) | ||
| 107 | self.assertIsNotNone(layerItem.updated) | ||
| 108 | |||
| 109 | layerItem = self.index.layerItems[2] | ||
| 110 | self.assertEqual(layerItem.id, 2) | ||
| 111 | self.assertEqual(layerItem.name, 'test_layerItem 2') | ||
| 112 | self.assertEqual(layerItem.summary, 'test_layerItem 2') | ||
| 113 | self.assertEqual(layerItem.description, 'test_layerItem 2') | ||
| 114 | self.assertEqual(layerItem.vcs_url, 'git://git_test_url/test_layerItem') | ||
| 115 | self.assertIsNone(layerItem.vcs_web_url) | ||
| 116 | self.assertIsNone(layerItem.vcs_web_tree_base_url) | ||
| 117 | self.assertIsNone(layerItem.vcs_web_file_base_url) | ||
| 118 | self.assertIsNotNone(layerItem.updated) | ||
| 119 | |||
| 120 | def test_layerBranch(self): | ||
| 121 | layerBranch = self.index.layerBranches[1] | ||
| 122 | self.assertEqual(layerBranch.id, 1) | ||
| 123 | self.assertEqual(layerBranch.collection, 'test_collection') | ||
| 124 | self.assertEqual(layerBranch.version, '99') | ||
| 125 | self.assertEqual(layerBranch.vcs_subdir, '') | ||
| 126 | self.assertEqual(layerBranch.actual_branch, 'test_branch') | ||
| 127 | self.assertIsNotNone(layerBranch.updated) | ||
| 128 | self.assertEqual(layerBranch.layer_id, 1) | ||
| 129 | self.assertEqual(layerBranch.branch_id, 1) | ||
| 130 | self.assertEqual(layerBranch.layer, self.index.layerItems[1]) | ||
| 131 | self.assertEqual(layerBranch.branch, self.index.branches[1]) | ||
| 132 | |||
| 133 | layerBranch = self.index.layerBranches[2] | ||
| 134 | self.assertEqual(layerBranch.id, 2) | ||
| 135 | self.assertEqual(layerBranch.collection, 'test_collection_2') | ||
| 136 | self.assertEqual(layerBranch.version, '72') | ||
| 137 | self.assertEqual(layerBranch.vcs_subdir, '') | ||
| 138 | self.assertEqual(layerBranch.actual_branch, 'some_other_branch') | ||
| 139 | self.assertIsNotNone(layerBranch.updated) | ||
| 140 | self.assertEqual(layerBranch.layer_id, 2) | ||
| 141 | self.assertEqual(layerBranch.branch_id, 1) | ||
| 142 | self.assertEqual(layerBranch.layer, self.index.layerItems[2]) | ||
| 143 | self.assertEqual(layerBranch.branch, self.index.branches[1]) | ||
| 144 | |||
| 145 | def test_layerDependency(self): | ||
| 146 | layerDependency = self.index.layerDependencies[1] | ||
| 147 | self.assertEqual(layerDependency.id, 1) | ||
| 148 | self.assertEqual(layerDependency.layerbranch_id, 2) | ||
| 149 | self.assertEqual(layerDependency.layerbranch, self.index.layerBranches[2]) | ||
| 150 | self.assertEqual(layerDependency.layer_id, 2) | ||
| 151 | self.assertEqual(layerDependency.layer, self.index.layerItems[2]) | ||
| 152 | self.assertTrue(layerDependency.required) | ||
| 153 | self.assertEqual(layerDependency.dependency_id, 1) | ||
| 154 | self.assertEqual(layerDependency.dependency, self.index.layerItems[1]) | ||
| 155 | self.assertEqual(layerDependency.dependency_layerBranch, self.index.layerBranches[1]) | ||
| 156 | |||
| 157 | layerDependency = self.index.layerDependencies[2] | ||
| 158 | self.assertEqual(layerDependency.id, 2) | ||
| 159 | self.assertEqual(layerDependency.layerbranch_id, 2) | ||
| 160 | self.assertEqual(layerDependency.layerbranch, self.index.layerBranches[2]) | ||
| 161 | self.assertEqual(layerDependency.layer_id, 2) | ||
| 162 | self.assertEqual(layerDependency.layer, self.index.layerItems[2]) | ||
| 163 | self.assertFalse(layerDependency.required) | ||
| 164 | self.assertEqual(layerDependency.dependency_id, 1) | ||
| 165 | self.assertEqual(layerDependency.dependency, self.index.layerItems[1]) | ||
| 166 | self.assertEqual(layerDependency.dependency_layerBranch, self.index.layerBranches[1]) | ||
| 167 | |||
| 168 | def test_recipe(self): | ||
| 169 | recipe = self.index.recipes[1] | ||
| 170 | self.assertEqual(recipe.id, 1) | ||
| 171 | self.assertEqual(recipe.layerbranch_id, 1) | ||
| 172 | self.assertEqual(recipe.layerbranch, self.index.layerBranches[1]) | ||
| 173 | self.assertEqual(recipe.layer_id, 1) | ||
| 174 | self.assertEqual(recipe.layer, self.index.layerItems[1]) | ||
| 175 | self.assertEqual(recipe.filename, 'test_git.bb') | ||
| 176 | self.assertEqual(recipe.filepath, 'recipes-test') | ||
| 177 | self.assertEqual(recipe.fullpath, 'recipes-test/test_git.bb') | ||
| 178 | self.assertEqual(recipe.summary, "") | ||
| 179 | self.assertEqual(recipe.description, "") | ||
| 180 | self.assertEqual(recipe.section, "") | ||
| 181 | self.assertEqual(recipe.pn, 'test') | ||
| 182 | self.assertEqual(recipe.pv, 'git') | ||
| 183 | self.assertEqual(recipe.license, "") | ||
| 184 | self.assertEqual(recipe.homepage, "") | ||
| 185 | self.assertEqual(recipe.bugtracker, "") | ||
| 186 | self.assertEqual(recipe.provides, "") | ||
| 187 | self.assertIsNotNone(recipe.updated) | ||
| 188 | self.assertEqual(recipe.inherits, "") | ||
| 189 | |||
| 190 | def test_machine(self): | ||
| 191 | machine = self.index.machines[1] | ||
| 192 | self.assertEqual(machine.id, 1) | ||
| 193 | self.assertEqual(machine.layerbranch_id, 1) | ||
| 194 | self.assertEqual(machine.layerbranch, self.index.layerBranches[1]) | ||
| 195 | self.assertEqual(machine.layer_id, 1) | ||
| 196 | self.assertEqual(machine.layer, self.index.layerItems[1]) | ||
| 197 | self.assertEqual(machine.name, 'test_machine') | ||
| 198 | self.assertEqual(machine.description, 'test_machine') | ||
| 199 | self.assertIsNotNone(machine.updated) | ||
| 200 | |||
| 201 | def test_distro(self): | ||
| 202 | distro = self.index.distros[1] | ||
| 203 | self.assertEqual(distro.id, 1) | ||
| 204 | self.assertEqual(distro.layerbranch_id, 1) | ||
| 205 | self.assertEqual(distro.layerbranch, self.index.layerBranches[1]) | ||
| 206 | self.assertEqual(distro.layer_id, 1) | ||
| 207 | self.assertEqual(distro.layer, self.index.layerItems[1]) | ||
| 208 | self.assertEqual(distro.name, 'test_distro') | ||
| 209 | self.assertEqual(distro.description, 'test_distro') | ||
| 210 | self.assertIsNotNone(distro.updated) | ||
diff --git a/bitbake/lib/layerindexlib/tests/restapi.py b/bitbake/lib/layerindexlib/tests/restapi.py deleted file mode 100644 index 71f0ae8a9d..0000000000 --- a/bitbake/lib/layerindexlib/tests/restapi.py +++ /dev/null | |||
| @@ -1,171 +0,0 @@ | |||
| 1 | # Copyright (C) 2017-2018 Wind River Systems, Inc. | ||
| 2 | # | ||
| 3 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 4 | # | ||
| 5 | |||
| 6 | import unittest | ||
| 7 | import os | ||
| 8 | |||
| 9 | import layerindexlib | ||
| 10 | from layerindexlib.tests.common import LayersTest | ||
| 11 | |||
| 12 | |||
| 13 | def skipIfNoNetwork(): | ||
| 14 | if os.environ.get("BB_SKIP_NETTESTS") == "yes": | ||
| 15 | return unittest.skip("Network tests being skipped") | ||
| 16 | return lambda f: f | ||
| 17 | |||
| 18 | class LayerIndexWebRestApiTest(LayersTest): | ||
| 19 | |||
| 20 | @skipIfNoNetwork() | ||
| 21 | def setUp(self): | ||
| 22 | self.assertFalse(os.environ.get("BB_SKIP_NETTESTS") == "yes", msg="BB_SKIP_NETTESTS set, but we tried to test anyway") | ||
| 23 | LayersTest.setUp(self) | ||
| 24 | self.layerindex = layerindexlib.LayerIndex(self.d) | ||
| 25 | self.layerindex.load_layerindex('https://layers.openembedded.org/layerindex/api/;branch=sumo', load=['layerDependencies']) | ||
| 26 | |||
| 27 | @skipIfNoNetwork() | ||
| 28 | def test_layerindex_is_empty(self): | ||
| 29 | self.assertFalse(self.layerindex.is_empty(), msg="Layerindex is empty") | ||
| 30 | |||
| 31 | @skipIfNoNetwork() | ||
| 32 | def test_layerindex_store_file(self): | ||
| 33 | self.layerindex.store_layerindex('file://%s/file.json' % self.tempdir, self.layerindex.indexes[0]) | ||
| 34 | |||
| 35 | self.assertTrue(os.path.isfile('%s/file.json' % self.tempdir), msg="Temporary file was not created by store_layerindex") | ||
| 36 | |||
| 37 | reload = layerindexlib.LayerIndex(self.d) | ||
| 38 | reload.load_layerindex('file://%s/file.json' % self.tempdir) | ||
| 39 | |||
| 40 | self.assertFalse(reload.is_empty(), msg="Layerindex is empty") | ||
| 41 | |||
| 42 | # Calculate layerItems in original index that should NOT be in reload | ||
| 43 | layerItemNames = [] | ||
| 44 | for itemId in self.layerindex.indexes[0].layerItems: | ||
| 45 | layerItemNames.append(self.layerindex.indexes[0].layerItems[itemId].name) | ||
| 46 | |||
| 47 | for layerBranchId in self.layerindex.indexes[0].layerBranches: | ||
| 48 | layerItemNames.remove(self.layerindex.indexes[0].layerBranches[layerBranchId].layer.name) | ||
| 49 | |||
| 50 | for itemId in reload.indexes[0].layerItems: | ||
| 51 | self.assertFalse(reload.indexes[0].layerItems[itemId].name in layerItemNames, msg="Item reloaded when it shouldn't have been") | ||
| 52 | |||
| 53 | # Compare the original to what we wrote... | ||
| 54 | for type in self.layerindex.indexes[0]._index: | ||
| 55 | if type == 'apilinks' or \ | ||
| 56 | type == 'layerItems' or \ | ||
| 57 | type in self.layerindex.indexes[0].config['local']: | ||
| 58 | continue | ||
| 59 | for id in getattr(self.layerindex.indexes[0], type): | ||
| 60 | self.logger.debug("type %s" % (type)) | ||
| 61 | |||
| 62 | self.assertTrue(id in getattr(reload.indexes[0], type), msg="Id number not in reloaded index") | ||
| 63 | |||
| 64 | self.logger.debug("%s ? %s" % (getattr(self.layerindex.indexes[0], type)[id], getattr(reload.indexes[0], type)[id])) | ||
| 65 | |||
| 66 | self.assertEqual(getattr(self.layerindex.indexes[0], type)[id], getattr(reload.indexes[0], type)[id], msg="Reloaded contents different") | ||
| 67 | |||
| 68 | @skipIfNoNetwork() | ||
| 69 | def test_layerindex_store_split(self): | ||
| 70 | self.layerindex.store_layerindex('file://%s' % self.tempdir, self.layerindex.indexes[0]) | ||
| 71 | |||
| 72 | reload = layerindexlib.LayerIndex(self.d) | ||
| 73 | reload.load_layerindex('file://%s' % self.tempdir) | ||
| 74 | |||
| 75 | self.assertFalse(reload.is_empty(), msg="Layer index is empty") | ||
| 76 | |||
| 77 | for type in self.layerindex.indexes[0]._index: | ||
| 78 | if type == 'apilinks' or \ | ||
| 79 | type == 'layerItems' or \ | ||
| 80 | type in self.layerindex.indexes[0].config['local']: | ||
| 81 | continue | ||
| 82 | for id in getattr(self.layerindex.indexes[0] ,type): | ||
| 83 | self.logger.debug("type %s" % (type)) | ||
| 84 | |||
| 85 | self.assertTrue(id in getattr(reload.indexes[0], type), msg="Id number missing from reloaded data") | ||
| 86 | |||
| 87 | self.logger.debug("%s ? %s" % (getattr(self.layerindex.indexes[0] ,type)[id], getattr(reload.indexes[0], type)[id])) | ||
| 88 | |||
| 89 | self.assertEqual(getattr(self.layerindex.indexes[0] ,type)[id], getattr(reload.indexes[0], type)[id], msg="reloaded data does not match original") | ||
| 90 | |||
| 91 | @skipIfNoNetwork() | ||
| 92 | def test_dependency_resolution(self): | ||
| 93 | # Verify depth first searching... | ||
| 94 | (dependencies, invalidnames) = self.layerindex.find_dependencies(names=['meta-python']) | ||
| 95 | |||
| 96 | first = True | ||
| 97 | for deplayerbranch in dependencies: | ||
| 98 | layerBranch = dependencies[deplayerbranch][0] | ||
| 99 | layerDeps = dependencies[deplayerbranch][1:] | ||
| 100 | |||
| 101 | if not first: | ||
| 102 | continue | ||
| 103 | |||
| 104 | first = False | ||
| 105 | |||
| 106 | # Top of the deps should be openembedded-core, since everything depends on it. | ||
| 107 | self.assertEqual(layerBranch.layer.name, "openembedded-core", msg='OpenEmbedded-Core is no the first dependency') | ||
| 108 | |||
| 109 | # meta-python should cause an openembedded-core dependency, if not assert! | ||
| 110 | for dep in layerDeps: | ||
| 111 | if dep.layer.name == 'meta-python': | ||
| 112 | break | ||
| 113 | else: | ||
| 114 | self.logger.debug("meta-python was not found") | ||
| 115 | raise self.failureException | ||
| 116 | |||
| 117 | # Only check the first element... | ||
| 118 | break | ||
| 119 | else: | ||
| 120 | # Empty list, this is bad. | ||
| 121 | self.logger.debug("Empty list of dependencies") | ||
| 122 | self.assertIsNotNone(first, msg="Empty list of dependencies") | ||
| 123 | |||
| 124 | # Last dep should be the requested item | ||
| 125 | layerBranch = dependencies[deplayerbranch][0] | ||
| 126 | self.assertEqual(layerBranch.layer.name, "meta-python", msg="Last dependency not meta-python") | ||
| 127 | |||
| 128 | @skipIfNoNetwork() | ||
| 129 | def test_find_collection(self): | ||
| 130 | def _check(collection, expected): | ||
| 131 | self.logger.debug("Looking for collection %s..." % collection) | ||
| 132 | result = self.layerindex.find_collection(collection) | ||
| 133 | if expected: | ||
| 134 | self.assertIsNotNone(result, msg="Did not find %s when it should be there" % collection) | ||
| 135 | else: | ||
| 136 | self.assertIsNone(result, msg="Found %s when it shouldn't be there" % collection) | ||
| 137 | |||
| 138 | tests = [ ('core', True), | ||
| 139 | ('openembedded-core', False), | ||
| 140 | ('networking-layer', True), | ||
| 141 | ('meta-python', True), | ||
| 142 | ('openembedded-layer', True), | ||
| 143 | ('notpresent', False) ] | ||
| 144 | |||
| 145 | for collection,result in tests: | ||
| 146 | _check(collection, result) | ||
| 147 | |||
| 148 | @skipIfNoNetwork() | ||
| 149 | def test_find_layerbranch(self): | ||
| 150 | def _check(name, expected): | ||
| 151 | self.logger.debug("Looking for layerbranch %s..." % name) | ||
| 152 | |||
| 153 | for index in self.layerindex.indexes: | ||
| 154 | for layerbranchid in index.layerBranches: | ||
| 155 | self.logger.debug("Present: %s" % index.layerBranches[layerbranchid].layer.name) | ||
| 156 | result = self.layerindex.find_layerbranch(name) | ||
| 157 | if expected: | ||
| 158 | self.assertIsNotNone(result, msg="Did not find %s when it should be there" % collection) | ||
| 159 | else: | ||
| 160 | self.assertIsNone(result, msg="Found %s when it shouldn't be there" % collection) | ||
| 161 | |||
| 162 | tests = [ ('openembedded-core', True), | ||
| 163 | ('core', False), | ||
| 164 | ('meta-networking', True), | ||
| 165 | ('meta-python', True), | ||
| 166 | ('meta-oe', True), | ||
| 167 | ('notpresent', False) ] | ||
| 168 | |||
| 169 | for collection,result in tests: | ||
| 170 | _check(collection, result) | ||
| 171 | |||
diff --git a/bitbake/lib/layerindexlib/tests/testdata/README b/bitbake/lib/layerindexlib/tests/testdata/README deleted file mode 100644 index 36ab40bebe..0000000000 --- a/bitbake/lib/layerindexlib/tests/testdata/README +++ /dev/null | |||
| @@ -1,11 +0,0 @@ | |||
| 1 | This test data is used to verify the 'cooker' module of the layerindex. | ||
| 2 | |||
| 3 | The module consists of a faux project bblayers.conf with four layers defined. | ||
| 4 | |||
| 5 | layer1 - openembedded-core | ||
| 6 | layer2 - networking-layer | ||
| 7 | layer3 - meta-python | ||
| 8 | layer4 - openembedded-layer (meta-oe) | ||
| 9 | |||
| 10 | Since we do not have a fully populated cooker, we use this to test the | ||
| 11 | basic index generation, and not any deep recipe based contents. | ||
diff --git a/bitbake/lib/layerindexlib/tests/testdata/build/conf/bblayers.conf b/bitbake/lib/layerindexlib/tests/testdata/build/conf/bblayers.conf deleted file mode 100644 index 40429b2f66..0000000000 --- a/bitbake/lib/layerindexlib/tests/testdata/build/conf/bblayers.conf +++ /dev/null | |||
| @@ -1,15 +0,0 @@ | |||
| 1 | LAYERSERIES_CORENAMES = "sumo" | ||
| 2 | |||
| 3 | # LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf | ||
| 4 | # changes incompatibly | ||
| 5 | LCONF_VERSION = "7" | ||
| 6 | |||
| 7 | BBPATH = "${TOPDIR}" | ||
| 8 | BBFILES ?= "" | ||
| 9 | |||
| 10 | BBLAYERS ?= " \ | ||
| 11 | ${TOPDIR}/layer1 \ | ||
| 12 | ${TOPDIR}/layer2 \ | ||
| 13 | ${TOPDIR}/layer3 \ | ||
| 14 | ${TOPDIR}/layer4 \ | ||
| 15 | " | ||
diff --git a/bitbake/lib/layerindexlib/tests/testdata/layer1/conf/layer.conf b/bitbake/lib/layerindexlib/tests/testdata/layer1/conf/layer.conf deleted file mode 100644 index 966d531959..0000000000 --- a/bitbake/lib/layerindexlib/tests/testdata/layer1/conf/layer.conf +++ /dev/null | |||
| @@ -1,17 +0,0 @@ | |||
| 1 | # We have a conf and classes directory, add to BBPATH | ||
| 2 | BBPATH .= ":${LAYERDIR}" | ||
| 3 | # We have recipes-* directories, add to BBFILES | ||
| 4 | BBFILES += "${LAYERDIR}/recipes-*/*/*.bb" | ||
| 5 | |||
| 6 | BBFILE_COLLECTIONS += "core" | ||
| 7 | BBFILE_PATTERN_core = "^${LAYERDIR}/" | ||
| 8 | BBFILE_PRIORITY_core = "5" | ||
| 9 | |||
| 10 | LAYERSERIES_CORENAMES = "sumo" | ||
| 11 | |||
| 12 | # This should only be incremented on significant changes that will | ||
| 13 | # cause compatibility issues with other layers | ||
| 14 | LAYERVERSION_core = "11" | ||
| 15 | LAYERSERIES_COMPAT_core = "sumo" | ||
| 16 | |||
| 17 | BBLAYERS_LAYERINDEX_NAME_core = "openembedded-core" | ||
diff --git a/bitbake/lib/layerindexlib/tests/testdata/layer2/conf/layer.conf b/bitbake/lib/layerindexlib/tests/testdata/layer2/conf/layer.conf deleted file mode 100644 index 7569d1c217..0000000000 --- a/bitbake/lib/layerindexlib/tests/testdata/layer2/conf/layer.conf +++ /dev/null | |||
| @@ -1,20 +0,0 @@ | |||
| 1 | # We have a conf and classes directory, add to BBPATH | ||
| 2 | BBPATH .= ":${LAYERDIR}" | ||
| 3 | |||
| 4 | # We have a packages directory, add to BBFILES | ||
| 5 | BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ | ||
| 6 | ${LAYERDIR}/recipes-*/*/*.bbappend" | ||
| 7 | |||
| 8 | BBFILE_COLLECTIONS += "networking-layer" | ||
| 9 | BBFILE_PATTERN_networking-layer := "^${LAYERDIR}/" | ||
| 10 | BBFILE_PRIORITY_networking-layer = "5" | ||
| 11 | |||
| 12 | # This should only be incremented on significant changes that will | ||
| 13 | # cause compatibility issues with other layers | ||
| 14 | LAYERVERSION_networking-layer = "1" | ||
| 15 | |||
| 16 | LAYERDEPENDS_networking-layer = "core" | ||
| 17 | LAYERDEPENDS_networking-layer += "openembedded-layer" | ||
| 18 | LAYERDEPENDS_networking-layer += "meta-python" | ||
| 19 | |||
| 20 | LAYERSERIES_COMPAT_networking-layer = "sumo" | ||
diff --git a/bitbake/lib/layerindexlib/tests/testdata/layer3/conf/layer.conf b/bitbake/lib/layerindexlib/tests/testdata/layer3/conf/layer.conf deleted file mode 100644 index 7089071faf..0000000000 --- a/bitbake/lib/layerindexlib/tests/testdata/layer3/conf/layer.conf +++ /dev/null | |||
| @@ -1,19 +0,0 @@ | |||
| 1 | # We might have a conf and classes directory, append to BBPATH | ||
| 2 | BBPATH .= ":${LAYERDIR}" | ||
| 3 | |||
| 4 | # We have recipes directories, add to BBFILES | ||
| 5 | BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend" | ||
| 6 | |||
| 7 | BBFILE_COLLECTIONS += "meta-python" | ||
| 8 | BBFILE_PATTERN_meta-python := "^${LAYERDIR}/" | ||
| 9 | BBFILE_PRIORITY_meta-python = "7" | ||
| 10 | |||
| 11 | # This should only be incremented on significant changes that will | ||
| 12 | # cause compatibility issues with other layers | ||
| 13 | LAYERVERSION_meta-python = "1" | ||
| 14 | |||
| 15 | LAYERDEPENDS_meta-python = "core openembedded-layer" | ||
| 16 | |||
| 17 | LAYERSERIES_COMPAT_meta-python = "sumo" | ||
| 18 | |||
| 19 | LICENSE_PATH += "${LAYERDIR}/licenses" | ||
diff --git a/bitbake/lib/layerindexlib/tests/testdata/layer4/conf/layer.conf b/bitbake/lib/layerindexlib/tests/testdata/layer4/conf/layer.conf deleted file mode 100644 index 6649ee0208..0000000000 --- a/bitbake/lib/layerindexlib/tests/testdata/layer4/conf/layer.conf +++ /dev/null | |||
| @@ -1,22 +0,0 @@ | |||
| 1 | # We have a conf and classes directory, append to BBPATH | ||
| 2 | BBPATH .= ":${LAYERDIR}" | ||
| 3 | |||
| 4 | # We have a recipes directory, add to BBFILES | ||
| 5 | BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend" | ||
| 6 | |||
| 7 | BBFILE_COLLECTIONS += "openembedded-layer" | ||
| 8 | BBFILE_PATTERN_openembedded-layer := "^${LAYERDIR}/" | ||
| 9 | |||
| 10 | # Define the priority for recipes (.bb files) from this layer, | ||
| 11 | # choosing carefully how this layer interacts with all of the | ||
| 12 | # other layers. | ||
| 13 | |||
| 14 | BBFILE_PRIORITY_openembedded-layer = "6" | ||
| 15 | |||
| 16 | # This should only be incremented on significant changes that will | ||
| 17 | # cause compatibility issues with other layers | ||
| 18 | LAYERVERSION_openembedded-layer = "1" | ||
| 19 | |||
| 20 | LAYERDEPENDS_openembedded-layer = "core" | ||
| 21 | |||
| 22 | LAYERSERIES_COMPAT_openembedded-layer = "sumo" | ||
