summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r--bitbake/lib/bb/tests/setup.py60
1 files changed, 30 insertions, 30 deletions
diff --git a/bitbake/lib/bb/tests/setup.py b/bitbake/lib/bb/tests/setup.py
index e320cdf56f..a17b8ac46a 100644
--- a/bitbake/lib/bb/tests/setup.py
+++ b/bitbake/lib/bb/tests/setup.py
@@ -109,19 +109,19 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
109 "configurations": [ 109 "configurations": [
110 { 110 {
111 "name": "gadget", 111 "name": "gadget",
112 "description": "Gadget build configuration", 112 "description": "Gadget configuration",
113 "oe-template": "test-configuration-gadget", 113 "oe-template": "test-configuration-gadget",
114 "oe-fragments": ["test-fragment-1"] 114 "oe-fragments": ["test-fragment-1"]
115 }, 115 },
116 { 116 {
117 "name": "gizmo", 117 "name": "gizmo",
118 "description": "Gizmo build configuration", 118 "description": "Gizmo configuration",
119 "oe-template": "test-configuration-gizmo", 119 "oe-template": "test-configuration-gizmo",
120 "oe-fragments": ["test-fragment-2"] 120 "oe-fragments": ["test-fragment-2"]
121 }, 121 },
122 { 122 {
123 "name": "gizmo-env-passthrough", 123 "name": "gizmo-env-passthrough",
124 "description": "Gizmo build configuration with environment-passthrough", 124 "description": "Gizmo configuration with environment-passthrough",
125 "bb-layers": ["layerC","layerD/meta-layer"], 125 "bb-layers": ["layerC","layerD/meta-layer"],
126 "oe-fragments": ["test-fragment-1"], 126 "oe-fragments": ["test-fragment-1"],
127 "bb-env-passthrough-additions": [ 127 "bb-env-passthrough-additions": [
@@ -132,24 +132,24 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
132 }, 132 },
133 { 133 {
134 "name": "gizmo-no-fragment", 134 "name": "gizmo-no-fragment",
135 "description": "Gizmo no-fragment template-only build configuration", 135 "description": "Gizmo no-fragment template-only configuration",
136 "oe-template": "test-configuration-gizmo" 136 "oe-template": "test-configuration-gizmo"
137 }, 137 },
138 { 138 {
139 "name": "gadget-notemplate", 139 "name": "gadget-notemplate",
140 "description": "Gadget notemplate build configuration", 140 "description": "Gadget notemplate configuration",
141 "bb-layers": ["layerA","layerB/meta-layer"], 141 "bb-layers": ["layerA","layerB/meta-layer"],
142 "oe-fragments": ["test-fragment-1"] 142 "oe-fragments": ["test-fragment-1"]
143 }, 143 },
144 { 144 {
145 "name": "gizmo-notemplate", 145 "name": "gizmo-notemplate",
146 "description": "Gizmo notemplate build configuration", 146 "description": "Gizmo notemplate configuration",
147 "bb-layers": ["layerC","layerD/meta-layer"], 147 "bb-layers": ["layerC","layerD/meta-layer"],
148 "oe-fragments": ["test-fragment-2"] 148 "oe-fragments": ["test-fragment-2"]
149 }, 149 },
150 { 150 {
151 "name": "gizmo-notemplate-with-thisdir", 151 "name": "gizmo-notemplate-with-thisdir",
152 "description": "Gizmo notemplate build configuration using THISDIR", 152 "description": "Gizmo notemplate configuration using THISDIR",
153 "bb-layers": ["layerC","layerD/meta-layer","{THISDIR}/layerE/meta-layer"], 153 "bb-layers": ["layerC","layerD/meta-layer","{THISDIR}/layerE/meta-layer"],
154 "oe-fragments": ["test-fragment-2"] 154 "oe-fragments": ["test-fragment-2"]
155 } 155 }
@@ -177,11 +177,11 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
177 self.git('add {}'.format(name), cwd=self.testrepopath) 177 self.git('add {}'.format(name), cwd=self.testrepopath)
178 self.git('commit -m "Adding {}"'.format(name), cwd=self.testrepopath) 178 self.git('commit -m "Adding {}"'.format(name), cwd=self.testrepopath)
179 179
180 def check_builddir_files(self, buildpath, test_file_content, json_config): 180 def check_setupdir_files(self, setuppath, test_file_content, json_config):
181 with open(os.path.join(buildpath, 'layers', 'test-repo', 'test-file')) as f: 181 with open(os.path.join(setuppath, 'layers', 'test-repo', 'test-file')) as f:
182 self.assertEqual(f.read(), test_file_content) 182 self.assertEqual(f.read(), test_file_content)
183 bitbake_config = json_config["bitbake-config"] 183 bitbake_config = json_config["bitbake-config"]
184 bb_build_path = os.path.join(buildpath, 'build') 184 bb_build_path = os.path.join(setuppath, 'build')
185 bb_conf_path = os.path.join(bb_build_path, 'conf') 185 bb_conf_path = os.path.join(bb_build_path, 'conf')
186 self.assertTrue(os.path.exists(os.path.join(bb_build_path, 'init-build-env'))) 186 self.assertTrue(os.path.exists(os.path.join(bb_build_path, 'init-build-env')))
187 187
@@ -203,7 +203,7 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
203 ) 203 )
204 self.assertIn(thisdir_layer, bblayers) 204 self.assertIn(thisdir_layer, bblayers)
205 else: 205 else:
206 self.assertIn(os.path.join(buildpath, "layers", l), bblayers) 206 self.assertIn(os.path.join(setuppath, "layers", l), bblayers)
207 207
208 if 'oe-fragment' in bitbake_config.keys(): 208 if 'oe-fragment' in bitbake_config.keys():
209 for f in bitbake_config["oe-fragments"]: 209 for f in bitbake_config["oe-fragments"]:
@@ -295,20 +295,20 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
295 for cf, v in test_configurations.items(): 295 for cf, v in test_configurations.items():
296 for c in v['buildconfigs']: 296 for c in v['buildconfigs']:
297 out = self.runbbsetup("init --non-interactive {} {}".format(v['cmdline'], c)) 297 out = self.runbbsetup("init --non-interactive {} {}".format(v['cmdline'], c))
298 buildpath = os.path.join(self.tempdir, 'bitbake-builds', '{}-{}'.format(cf, c)) 298 setuppath = os.path.join(self.tempdir, 'bitbake-builds', '{}-{}'.format(cf, c))
299 with open(os.path.join(buildpath, 'config', "config-upstream.json")) as f: 299 with open(os.path.join(setuppath, 'config', "config-upstream.json")) as f:
300 config_upstream = json.load(f) 300 config_upstream = json.load(f)
301 self.check_builddir_files(buildpath, test_file_content, config_upstream) 301 self.check_setupdir_files(setuppath, test_file_content, config_upstream)
302 os.environ['BBPATH'] = os.path.join(buildpath, 'build') 302 os.environ['BBPATH'] = os.path.join(setuppath, 'build')
303 out = self.runbbsetup("status") 303 out = self.runbbsetup("status")
304 self.assertIn("Configuration in {} has not changed".format(buildpath), out[0]) 304 self.assertIn("Configuration in {} has not changed".format(setuppath), out[0])
305 out = self.runbbsetup("update") 305 out = self.runbbsetup("update")
306 self.assertIn("Configuration in {} has not changed".format(buildpath), out[0]) 306 self.assertIn("Configuration in {} has not changed".format(setuppath), out[0])
307 307
308 # install buildtools 308 # install buildtools
309 out = self.runbbsetup("install-buildtools") 309 out = self.runbbsetup("install-buildtools")
310 self.assertIn("Buildtools installed into", out[0]) 310 self.assertIn("Buildtools installed into", out[0])
311 self.assertTrue(os.path.exists(os.path.join(buildpath, 'buildtools'))) 311 self.assertTrue(os.path.exists(os.path.join(setuppath, 'buildtools')))
312 312
313 # change a file in the test layer repo, make a new commit and 313 # change a file in the test layer repo, make a new commit and
314 # test that status/update correctly report the change and update the config 314 # test that status/update correctly report the change and update the config
@@ -319,17 +319,17 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
319 'gizmo-env-passthrough', 319 'gizmo-env-passthrough',
320 'gizmo-no-fragment', 320 'gizmo-no-fragment',
321 'gadget-notemplate', 'gizmo-notemplate'): 321 'gadget-notemplate', 'gizmo-notemplate'):
322 buildpath = os.path.join(self.tempdir, 'bitbake-builds', 'test-config-1-{}'.format(c)) 322 setuppath = os.path.join(self.tempdir, 'bitbake-builds', 'test-config-1-{}'.format(c))
323 os.environ['BBPATH'] = os.path.join(buildpath, 'build') 323 os.environ['BBPATH'] = os.path.join(setuppath, 'build')
324 out = self.runbbsetup("status") 324 out = self.runbbsetup("status")
325 self.assertIn("Layer repository file://{} checked out into {}/layers/test-repo updated revision master from".format(self.testrepopath, buildpath), out[0]) 325 self.assertIn("Layer repository file://{} checked out into {}/layers/test-repo updated revision master from".format(self.testrepopath, setuppath), out[0])
326 out = self.runbbsetup("update") 326 out = self.runbbsetup("update")
327 if c in ('gadget', 'gizmo'): 327 if c in ('gadget', 'gizmo'):
328 self.assertIn("Existing bitbake configuration directory renamed to {}/build/conf-backup.".format(buildpath), out[0]) 328 self.assertIn("Existing bitbake configuration directory renamed to {}/build/conf-backup.".format(setuppath), out[0])
329 self.assertIn('-{}+{}'.format(prev_test_file_content, test_file_content), out[0]) 329 self.assertIn('-{}+{}'.format(prev_test_file_content, test_file_content), out[0])
330 with open(os.path.join(buildpath, 'config', "config-upstream.json")) as f: 330 with open(os.path.join(setuppath, 'config', "config-upstream.json")) as f:
331 config_upstream = json.load(f) 331 config_upstream = json.load(f)
332 self.check_builddir_files(buildpath, test_file_content, config_upstream) 332 self.check_setupdir_files(setuppath, test_file_content, config_upstream)
333 333
334 # make a new branch in the test layer repo, change a file on that branch, 334 # make a new branch in the test layer repo, change a file on that branch,
335 # make a new commit, update the top level json config to refer to that branch, 335 # make a new commit, update the top level json config to refer to that branch,
@@ -344,15 +344,15 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
344 'gizmo-env-passthrough', 344 'gizmo-env-passthrough',
345 'gizmo-no-fragment', 345 'gizmo-no-fragment',
346 'gadget-notemplate', 'gizmo-notemplate'): 346 'gadget-notemplate', 'gizmo-notemplate'):
347 buildpath = os.path.join(self.tempdir, 'bitbake-builds', 'test-config-1-{}'.format(c)) 347 setuppath = os.path.join(self.tempdir, 'bitbake-builds', 'test-config-1-{}'.format(c))
348 os.environ['BBPATH'] = os.path.join(buildpath, 'build') 348 os.environ['BBPATH'] = os.path.join(setuppath, 'build')
349 out = self.runbbsetup("status") 349 out = self.runbbsetup("status")
350 self.assertIn("Configuration in {} has changed:".format(buildpath), out[0]) 350 self.assertIn("Configuration in {} has changed:".format(setuppath), out[0])
351 self.assertIn('- "rev": "master"\n+ "rev": "another-branch"', out[0]) 351 self.assertIn('- "rev": "master"\n+ "rev": "another-branch"', out[0])
352 out = self.runbbsetup("update") 352 out = self.runbbsetup("update")
353 if c in ('gadget', 'gizmo'): 353 if c in ('gadget', 'gizmo'):
354 self.assertIn("Existing bitbake configuration directory renamed to {}/build/conf-backup.".format(buildpath), out[0]) 354 self.assertIn("Existing bitbake configuration directory renamed to {}/build/conf-backup.".format(setuppath), out[0])
355 self.assertIn('-{}+{}'.format(prev_test_file_content, test_file_content), out[0]) 355 self.assertIn('-{}+{}'.format(prev_test_file_content, test_file_content), out[0])
356 with open(os.path.join(buildpath, 'config', "config-upstream.json")) as f: 356 with open(os.path.join(setuppath, 'config', "config-upstream.json")) as f:
357 config_upstream = json.load(f) 357 config_upstream = json.load(f)
358 self.check_builddir_files(buildpath, test_file_content, config_upstream) 358 self.check_setupdir_files(setuppath, test_file_content, config_upstream)