diff options
author | Thomas Roos <throos@amazon.de> | 2022-08-04 15:49:20 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-08 15:44:21 +0100 |
commit | c8e4c239f2e45352d228fc3bfcdeaf4a33242aa3 (patch) | |
tree | 72fff46e3680765d0e521c04e4b6e53d1fb4d569 /meta/lib/oeqa/selftest/cases | |
parent | ce18cc1d72374d7bec2b069b71e72e49aff5649a (diff) | |
download | poky-c8e4c239f2e45352d228fc3bfcdeaf4a33242aa3.tar.gz |
oeqa devtool: Add tests to cover devtool handling of various git URL styles
Add two test cases for git URL styles that trigger reformat_git_url.
[YOCTO #11394]
(From OE-Core rev: 5593439a5efbb53fc46099650ae86943751b0c4e)
Signed-off-by: Thomas Roos <throos@amazon.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/devtool.py | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index 34fc791f3a..bde345f6bd 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py | |||
@@ -246,6 +246,22 @@ class DevtoolTestCase(OESelftestTestCase): | |||
246 | if remaining_removelines: | 246 | if remaining_removelines: |
247 | self.fail('Expected removed lines not found: %s' % remaining_removelines) | 247 | self.fail('Expected removed lines not found: %s' % remaining_removelines) |
248 | 248 | ||
249 | def _test_devtool_add_git_url(self, git_url, version, pn, resulting_src_uri): | ||
250 | self.track_for_cleanup(self.workspacedir) | ||
251 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | ||
252 | result = runCmd('devtool add --version %s %s %s' % (version, pn, git_url)) | ||
253 | self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created') | ||
254 | # Check the recipe name is correct | ||
255 | recipefile = get_bb_var('FILE', pn) | ||
256 | self.assertIn('%s_git.bb' % pn, recipefile, 'Recipe file incorrectly named') | ||
257 | self.assertIn(recipefile, result.output) | ||
258 | # Test devtool status | ||
259 | result = runCmd('devtool status') | ||
260 | self.assertIn(pn, result.output) | ||
261 | self.assertIn(recipefile, result.output) | ||
262 | checkvars = {} | ||
263 | checkvars['SRC_URI'] = resulting_src_uri | ||
264 | self._test_recipe_contents(recipefile, checkvars, []) | ||
249 | 265 | ||
250 | class DevtoolBase(DevtoolTestCase): | 266 | class DevtoolBase(DevtoolTestCase): |
251 | 267 | ||
@@ -380,6 +396,22 @@ class DevtoolAddTests(DevtoolBase): | |||
380 | checkvars['DEPENDS'] = set(['dbus']) | 396 | checkvars['DEPENDS'] = set(['dbus']) |
381 | self._test_recipe_contents(recipefile, checkvars, []) | 397 | self._test_recipe_contents(recipefile, checkvars, []) |
382 | 398 | ||
399 | def test_devtool_add_git_style1(self): | ||
400 | version = 'v3.1.0' | ||
401 | pn = 'mbedtls' | ||
402 | # this will trigger reformat_git_uri with branch parameter in url | ||
403 | git_url = "'git://git@github.com/ARMmbed/mbedtls.git;branch=mbedtls-2.28;protocol=https'" | ||
404 | resulting_src_uri = "git://git@github.com/ARMmbed/mbedtls.git;branch=mbedtls-2.28;protocol=https" | ||
405 | self._test_devtool_add_git_url(git_url, version, pn, resulting_src_uri) | ||
406 | |||
407 | def test_devtool_add_git_style2(self): | ||
408 | version = 'v3.1.0' | ||
409 | pn = 'mbedtls' | ||
410 | # this will trigger reformat_git_uri with branch parameter in url | ||
411 | git_url = "'git://git@github.com/ARMmbed/mbedtls.git;protocol=https'" | ||
412 | resulting_src_uri = "git://git@github.com/ARMmbed/mbedtls.git;protocol=https;branch=master" | ||
413 | self._test_devtool_add_git_url(git_url, version, pn, resulting_src_uri) | ||
414 | |||
383 | def test_devtool_add_library(self): | 415 | def test_devtool_add_library(self): |
384 | # Fetch source | 416 | # Fetch source |
385 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 417 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
@@ -540,7 +572,7 @@ class DevtoolAddTests(DevtoolBase): | |||
540 | result = runCmd('devtool status') | 572 | result = runCmd('devtool status') |
541 | self.assertIn(testrecipe, result.output) | 573 | self.assertIn(testrecipe, result.output) |
542 | self.assertIn(srcdir, result.output) | 574 | self.assertIn(srcdir, result.output) |
543 | # Check recipe | 575 | # Check recipedevtool add |
544 | recipefile = get_bb_var('FILE', testrecipe) | 576 | recipefile = get_bb_var('FILE', testrecipe) |
545 | self.assertIn('%s_%s.bb' % (testrecipe, testver), recipefile, 'Recipe file incorrectly named') | 577 | self.assertIn('%s_%s.bb' % (testrecipe, testver), recipefile, 'Recipe file incorrectly named') |
546 | checkvars = {} | 578 | checkvars = {} |