oeqa devtool: Add tests to cover devtool handling of various git URL styles
PATCH 1/1 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]
Signed-off-by Thomas Roos <[email protected]>
--- meta/lib/oeqa/selftest/cases/devtool.py | 55 ++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/devtool.py +54 -1
@@ -379,6 +379,59 @@ class DevtoolAddTests(DevtoolBase): checkvars['SRCREV'] = srcrev checkvars['DEPENDS'] = set(['dbus']) self._test_recipe_contents(recipefile, checkvars, []) + + def test_devtool_add_git_style_1(self): + # this will trigger reformat_git_uri + url = "'git://[email protected]/ARMmbed/mbedtls.git;protocol=https'" + version = 'v3.1.0' + pn = 'mbedtls' + # Test devtool add + self.track_for_cleanup(self.workspacedir) + self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') + result = runCmd('devtool add --version %s %s %s' % (version, pn, url)) + self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created') + # Check the recipe name is correct + recipefile = get_bb_var('FILE', pn) + self.assertIn('%s_git.bb' % pn, recipefile, 'Recipe file incorrectly named') + self.assertIn(recipefile, result.output) + # Test devtool status + result = runCmd('devtool status') + self.assertIn(pn, result.output) + self.assertIn(recipefile, result.output) + checkvars = {} + checkvars['LICENSE'] = 'Apache-2.0' + checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57' + checkvars['S'] = '${WORKDIR}/git' + checkvars['PV'] = 'v3.1.0+git${SRCPV}' + checkvars['SRC_URI'] = 'git://[email protected]/ARMmbed/mbedtls.git;protocol=https;branch=master' + self._test_recipe_contents(recipefile, checkvars, []) + + def test_devtool_add_git_style_2(self): + # this will trigger reformat_git_uri with branch parameter in url + url = "'git://[email protected]/ARMmbed/mbedtls.git;branch=mbedtls-2.28;protocol=https'" + version = 'v3.1.0' + pn = 'mbedtls' + # Test devtool add + self.track_for_cleanup(self.workspacedir) + self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') + result = runCmd('devtool add --version %s %s %s' % (version, pn, url)) + self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created') + # Check the recipe name is correct + recipefile = get_bb_var('FILE', pn) + self.assertIn('%s_git.bb' % pn, recipefile, 'Recipe file incorrectly named') + self.assertIn(recipefile, result.output) + # Test devtool status + result = runCmd('devtool status') + self.assertIn(pn, result.output) + self.assertIn(recipefile, result.output) + checkvars = {} + checkvars['LICENSE'] = 'Apache-2.0' + checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57' + checkvars['S'] = '${WORKDIR}/git' + checkvars['PV'] = 'v3.1.0+git${SRCPV}' + checkvars['SRC_URI'] = 'git://[email protected]/ARMmbed/mbedtls.git;branch=mbedtls-2.28;protocol=https' + self._test_recipe_contents(recipefile, checkvars, []) + def test_devtool_add_library(self): # Fetch source
@@ -540,7 +593,7 @@ class DevtoolAddTests(DevtoolBase): result = runCmd('devtool status') self.assertIn(testrecipe, result.output) self.assertIn(srcdir, result.output) - # Check recipe + # Check recipedevtool add recipefile = get_bb_var('FILE', testrecipe) self.assertIn('%s_%s.bb' % (testrecipe, testver), recipefile, 'Recipe file incorrectly named') checkvars = {}
Signature · 14 lines
2.25.1 Amazon Web Services EMEA SARL 38 avenue John F. Kennedy, L-1855 Luxembourg Sitz der Gesellschaft: L-1855 Luxemburg eingetragen im Luxemburgischen Handelsregister unter R.C.S. B186284 Amazon Web Services EMEA SARL, Niederlassung Deutschland Marcel-Breuer-Str. 12, D-80807 Muenchen Sitz der Zweigniederlassung: Muenchen eingetragen im Handelsregister des Amtsgerichts Muenchen unter HRB 242240, USt-ID DE317013094
Quoted 60 lines · Thomas Roos via lists.openembedded.org
Add two test cases for git URL styles that trigger
reformat_git_url.[YOCTO #11394]
Signed-off-by Thomas Roos <[email protected]>--- meta/lib/oeqa/selftest/cases/devtool.py | 55 ++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-)meta/lib/oeqa/selftest/cases/devtool.py +43
-0@@ -379,6 +379,59 @@ class DevtoolAddTests(DevtoolBase): checkvars['SRCREV'] = srcrev checkvars['DEPENDS'] = set(['dbus']) self._test_recipe_contents(recipefile, checkvars, []) + + def test_devtool_add_git_style_1(self): + # this will trigger reformat_git_uri + url = "'git://[email protected]/ARMmbed/mbedtls.git;protocol=https'" + version = 'v3.1.0' + pn = 'mbedtls' + # Test devtool add + self.track_for_cleanup(self.workspacedir) + self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') + result = runCmd('devtool add --version %s %s %s' % (version, pn, url)) + self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created') + # Check the recipe name is correct + recipefile = get_bb_var('FILE', pn) + self.assertIn('%s_git.bb' % pn, recipefile, 'Recipe file incorrectly named') + self.assertIn(recipefile, result.output) + # Test devtool status + result = runCmd('devtool status') + self.assertIn(pn, result.output) + self.assertIn(recipefile, result.output) + checkvars = {} + checkvars['LICENSE'] = 'Apache-2.0' + checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57' + checkvars['S'] = '${WORKDIR}/git' + checkvars['PV'] = 'v3.1.0+git${SRCPV}' + checkvars['SRC_URI'] = 'git://[email protected]/ARMmbed/mbedtls.git;protocol=https;branch=master' + self._test_recipe_contents(recipefile, checkvars, []) + + def test_devtool_add_git_style_2(self): + # this will trigger reformat_git_uri with branch parameter in url + url = "'git://[email protected]/ARMmbed/mbedtls.git;branch=mbedtls-2.28;protocol=https'" + version = 'v3.1.0' + pn = 'mbedtls' + # Test devtool add + self.track_for_cleanup(self.workspacedir) + self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') + result = runCmd('devtool add --version %s %s %s' % (version, pn, url)) + self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created') + # Check the recipe name is correct + recipefile = get_bb_var('FILE', pn) + self.assertIn('%s_git.bb' % pn, recipefile, 'Recipe file incorrectly named') + self.assertIn(recipefile, result.output) + # Test devtool status + result = runCmd('devtool status')
meta/lib/oeqa/selftest/cases/devtool.py class DevtoolAddTests(DevtoolBase): · line 434
Quoted 10 lines
meta/lib/oeqa/selftest/cases/devtool.py +10
-0+ self.assertIn(pn, result.output) + self.assertIn(recipefile, result.output) + checkvars = {} + checkvars['LICENSE'] = 'Apache-2.0' + checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57' + checkvars['S'] = '${WORKDIR}/git' + checkvars['PV'] = 'v3.1.0+git${SRCPV}' + checkvars['SRC_URI'] = 'git://[email protected]/ARMmbed/mbedtls.git;branch=mbedtls-2.28;protocol=https' + self._test_recipe_contents(recipefile, checkvars, []) +
Rather than copy and paste the test, could you parameterise it please? That should make it clearer what is being tested and why too.
Cheers,
Richard