Skip to contentSkip to conversation

oeqa devtool: Add tests to cover devtool handling of various git URL styles

PATCH In review Thomas Roos 3 participants 5 messages Aug 4, 2022 – Aug 9, 2022 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH v2 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]

---
 meta/lib/oeqa/selftest/cases/devtool.py | 34 ++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/devtool.py +33 -1
index 34fc791f3a..5a4b0d375c 100644
@@ -246,6 +246,22 @@ class DevtoolTestCase(OESelftestTestCase):
         if remaining_removelines:
             self.fail('Expected removed lines not found: %s' % remaining_removelines)
 
+    def _test_devtool_add_git_url(self, git_url, version, pn, resulting_src_uri):
+        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, git_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['SRC_URI'] = resulting_src_uri
+        self._test_recipe_contents(recipefile, checkvars, [])
 
 class DevtoolBase(DevtoolTestCase):
 
@@ -379,6 +395,22 @@ class DevtoolAddTests(DevtoolBase):
         checkvars['SRCREV'] = srcrev
         checkvars['DEPENDS'] = set(['dbus'])
         self._test_recipe_contents(recipefile, checkvars, [])
+    
+    def test_devtool_add_git_style1(self):
+        version = 'v3.1.0'
+        pn = 'mbedtls'
+        # this will trigger reformat_git_uri with branch parameter in url
+        git_url = "'git://[email protected]/ARMmbed/mbedtls.git;branch=mbedtls-2.28;protocol=https'"
+        resulting_src_uri = "git://[email protected]/ARMmbed/mbedtls.git;branch=mbedtls-2.28;protocol=https"
+        self._test_devtool_add_git_url(git_url, version, pn, resulting_src_uri)
+
+    def test_devtool_add_git_style2(self):
+        version = 'v3.1.0'
+        pn = 'mbedtls'
+        # this will trigger reformat_git_uri with branch parameter in url
+        git_url = "'git://[email protected]/ARMmbed/mbedtls.git;protocol=https'"
+        resulting_src_uri = "git://[email protected]/ARMmbed/mbedtls.git;protocol=https;branch=master"
+        self._test_devtool_add_git_url(git_url, version, pn, resulting_src_uri)
 
     def test_devtool_add_library(self):
         # Fetch source
@@ -540,7 +572,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
#1 lore raw

Hello Thomas,

On Thu, 4 Aug 2022 15:49:20 +0200
"Thomas Roos via lists.openembedded.org" <[email protected]> wrote:

                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

As you can see above, your sender address is getting mangled. This is not your fault, it is done by DMARC for anti-phishing, but it makes applying your patches annoying.

Can you please try to work around that by setting the sendemail.from parameter in your git config?

You can read the details in this discussion:
https://lists.openembedded.org/g/openembedded-core/message/166515?p=%2C%2C%2C20%2C0%2C0%2C0%3A%3Acreated%2C0%2Crootfs.py%3A+find+.ko.zst+kernel+modules%2C20%2C2%2C0%2C91453338

Thank you very much!

See below for some comments on your patch.

Quoted 14 lines

Add two test cases for git URL styles that trigger reformat_git_url.

[YOCTO #11394]

---
 meta/lib/oeqa/selftest/cases/devtool.py | 34 ++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/devtool.py +0 -0
index 34fc791f3a..5a4b0d375c 100644

meta/lib/oeqa/selftest/cases/devtool.py class DevtoolTestCase(OESelftestTestCase): · line 251

Quoted 6 lines
meta/lib/oeqa/selftest/cases/devtool.py +3 -0
@@ -246,6 +246,22 @@ class DevtoolTestCase(OESelftestTestCase):
         if remaining_removelines:
             self.fail('Expected removed lines not found: %s' % remaining_removelines)
 
+    def _test_devtool_add_git_url(self, git_url, version, pn, resulting_src_uri):
+        self.track_for_cleanup(self.workspacedir)
+        self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')        

Trailing whitespace here.

Quoted 17 lines
meta/lib/oeqa/selftest/cases/devtool.py +13 -0
+        result = runCmd('devtool add --version %s %s %s' % (version, pn, git_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['SRC_URI'] = resulting_src_uri
+        self._test_recipe_contents(recipefile, checkvars, [])
 
 class DevtoolBase(DevtoolTestCase):
 

meta/lib/oeqa/selftest/cases/devtool.py class DevtoolAddTests(DevtoolBase): · line 398

Quoted 4 lines
meta/lib/oeqa/selftest/cases/devtool.py +1 -0
@@ -379,6 +395,22 @@ class DevtoolAddTests(DevtoolBase):
         checkvars['SRCREV'] = srcrev
         checkvars['DEPENDS'] = set(['dbus'])
         self._test_recipe_contents(recipefile, checkvars, [])
+    

Trailing whitespace here too.

Quoted 19 lines
meta/lib/oeqa/selftest/cases/devtool.py +15 -0
+    def test_devtool_add_git_style1(self):
+        version = 'v3.1.0'
+        pn = 'mbedtls'
+        # this will trigger reformat_git_uri with branch parameter in url
+        git_url = "'git://[email protected]/ARMmbed/mbedtls.git;branch=mbedtls-2.28;protocol=https'"
+        resulting_src_uri = "git://[email protected]/ARMmbed/mbedtls.git;branch=mbedtls-2.28;protocol=https"
+        self._test_devtool_add_git_url(git_url, version, pn, resulting_src_uri)
+
+    def test_devtool_add_git_style2(self):
+        version = 'v3.1.0'
+        pn = 'mbedtls'
+        # this will trigger reformat_git_uri with branch parameter in url
+        git_url = "'git://[email protected]/ARMmbed/mbedtls.git;protocol=https'"
+        resulting_src_uri = "git://[email protected]/ARMmbed/mbedtls.git;protocol=https;branch=master"
+        self._test_devtool_add_git_url(git_url, version, pn, resulting_src_uri)
 
     def test_devtool_add_library(self):
         # Fetch source

meta/lib/oeqa/selftest/cases/devtool.py class DevtoolAddTests(DevtoolBase): · line 575

Quoted 5 lines
meta/lib/oeqa/selftest/cases/devtool.py +1 -1
@@ -540,7 +572,7 @@ class DevtoolAddTests(DevtoolBase):
         result = runCmd('devtool status')
         self.assertIn(testrecipe, result.output)
         self.assertIn(srcdir, result.output)
-        # Check recipe
+        # Check recipedevtool add

This change looks wrong...

Signature · 3 lines
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Hi Thomas,

Quoted 3 lines · Thomas

Hi Luca,
thank you for this - will update my patch and try with the sendemail.from parameter. The correct procedure will be creating a v3 patch and send as new again?

The correct thing would be to configure your git sendemail.from parameter, fix the issues I reported, and send a v3 with those fixed.

Thanks!
Luca

Signature · 3 lines
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw
Quoted 11 lines · Luca Ceresoli via lists.openembedded.org

Hi Thomas,

Quoted 3 lines · Thomas

Hi Luca,
thank you for this - will update my patch and try with the sendemail.from parameter. The correct procedure will be creating a v3 patch and send as new again?

The correct thing would be to configure your git sendemail.from parameter, fix the issues I reported, and send a v3 with those fixed.

I think I merged this into master-next in the meantime so there isn't a need for a v3 in this case.

Cheers,

Richard

#5 lore raw

Hi Richard, Hi Luca,
thank you!

Cheers,
Thomas
________________________________________
Von: Richard Purdie <[email protected]>
Gesendet: Montag, 8. August 2022 17:11
An: [email protected]; Roos, Thomas; [email protected]
Betreff: RE: [EXTERNAL][OE-core] [PATCH v2] oeqa devtool: Add tests to cover devtool handling of various git URL styles

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.

Quoted 11 lines · Luca Ceresoli via lists.openembedded.org

Hi Thomas,

Quoted 3 lines · Thomas

Hi Luca,
thank you for this - will update my patch and try with the sendemail.from parameter. The correct procedure will be creating a v3 patch and send as new again?

The correct thing would be to configure your git sendemail.from parameter, fix the issues I reported, and send a v3 with those fixed.

I think I merged this into master-next in the meantime so there isn't a need for a v3 in this case.

Cheers,

Richard

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