diff mbox series

[v3,1/2] oeqa/selftest/archiver: Add multiconfig test for shared recipes

Message ID 20221014152245.243292-1-jose.quaresma@foundries.io
State Accepted, archived
Commit 0059a5c9c0116dcc24d03a946703c0cd2ee23d16
Headers show
Series [v3,1/2] oeqa/selftest/archiver: Add multiconfig test for shared recipes | expand

Commit Message

Jose Quaresma Oct. 14, 2022, 3:22 p.m. UTC
From: Jose Quaresma <quaresma.jose@gmail.com>

Test that the shared recipes in original mode with diff enabled works in multiconfig,
otherwise it will not build when using the same TMP dir.

The test can be run with:

oe-selftest -r archiver.Archiver.test_archiver_multiconfig_shared_unpack_and_patch

| oe-selftest - INFO - test_archiver_multiconfig_shared_unpack_and_patch (archiver.Archiver)
| oe-selftest - INFO -  ... ok
| oe-selftest - INFO - ----------------------------------------------------------------------
| oe-selftest - INFO - Ran 1 test in 52.948s
| oe-selftest - INFO - OK
| oe-selftest - INFO - RESULTS:
| oe-selftest - INFO - RESULTS - archiver.Archiver.test_archiver_multiconfig_shared_unpack_and_patch: PASSED (49.98s)
| oe-selftest - INFO - SUMMARY:
| oe-selftest - INFO - oe-selftest () - Ran 1 test in 52.948s
| oe-selftest - INFO - oe-selftest - OK - All required tests passed (successes=1, skipped=0, failures=0, errors=0)

Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
---

v2: replace --runonly with --cmd (-c)
    update the runtime test time on the commit
    show the locked_sigs file used on the assert

v3: messed up v2 patch

 meta/lib/oeqa/selftest/cases/archiver.py | 32 ++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

Comments

Jose Quaresma Nov. 2, 2022, 9:42 a.m. UTC | #1
Are there any issues with this patch or the oe-selftest in the previous one
that I need to address?

Jose

Jose Quaresma via lists.openembedded.org <quaresma.jose=
gmail.com@lists.openembedded.org> escreveu no dia sexta, 14/10/2022 à(s)
16:24:

> From: Jose Quaresma <quaresma.jose@gmail.com>
>
> STAGING_KERNEL_DIR uses the MACHINE name so it breaks the multiconfig
> and in this cases it will run the shared recipes twice, one for each
> machine.
>
> STAGING_KERNEL_DIR it's been introduced in commit 5487dee2e1
>
> Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
> ---
>  meta/classes/archiver.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
> index 0710c1ec5e..4049694d85 100644
> --- a/meta/classes/archiver.bbclass
> +++ b/meta/classes/archiver.bbclass
> @@ -465,7 +465,7 @@ def is_work_shared(d):
>      pn = d.getVar('PN')
>      return pn.startswith('gcc-source') or \
>          bb.data.inherits_class('kernel', d) or \
> -        (bb.data.inherits_class('kernelsrc', d) and d.getVar('S') ==
> d.getVar('STAGING_KERNEL_DIR'))
> +        (bb.data.inherits_class('kernelsrc', d) and
> d.expand("${TMPDIR}/work-shared") in d.getVar('S'))
>
>  # Run do_unpack and do_patch
>  python do_unpack_and_patch() {
> --
> 2.38.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#171736):
> https://lists.openembedded.org/g/openembedded-core/message/171736
> Mute This Topic: https://lists.openembedded.org/mt/94328945/5052612
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> quaresma.jose@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Richard Purdie Nov. 2, 2022, 10:55 a.m. UTC | #2
On Wed, 2022-11-02 at 09:42 +0000, Jose Quaresma wrote:
> Are there any issues with this patch or the oe-selftest in the
> previous one that I need to address?

When I was reviewing the patches that were queued while I was away,
this one wasn't one I could immediately look at and make a decision on.
It was therefore deferred for me to spend a bit more time on. I'm
trying to get there!

Cheers,

Richard
Jose Quaresma Nov. 2, 2022, 11:03 a.m. UTC | #3
Richard Purdie <richard.purdie@linuxfoundation.org> escreveu no dia quarta,
2/11/2022 à(s) 10:55:

> On Wed, 2022-11-02 at 09:42 +0000, Jose Quaresma wrote:
> > Are there any issues with this patch or the oe-selftest in the
> > previous one that I need to address?
>
> When I was reviewing the patches that were queued while I was away,
> this one wasn't one I could immediately look at and make a decision on.
> It was therefore deferred for me to spend a bit more time on. I'm
> trying to get there!
>

Thanks for the update.
I decided to ask now because I saw that the master branch has started the
integration again.
If anything is needed from me please let me know.

Jose


>
> Cheers,
>
> Richard
>
>
>
Jose Quaresma Nov. 14, 2022, 1:17 p.m. UTC | #4
Hi Steve,

Can this patch be backported to kirkstone?

Jose

Jose Quaresma via lists.openembedded.org <quaresma.jose=
gmail.com@lists.openembedded.org> escreveu no dia quarta, 2/11/2022 à(s)
11:04:

>
>
> Richard Purdie <richard.purdie@linuxfoundation.org> escreveu no dia
> quarta, 2/11/2022 à(s) 10:55:
>
>> On Wed, 2022-11-02 at 09:42 +0000, Jose Quaresma wrote:
>> > Are there any issues with this patch or the oe-selftest in the
>> > previous one that I need to address?
>>
>> When I was reviewing the patches that were queued while I was away,
>> this one wasn't one I could immediately look at and make a decision on.
>> It was therefore deferred for me to spend a bit more time on. I'm
>> trying to get there!
>>
>
> Thanks for the update.
> I decided to ask now because I saw that the master branch has started the
> integration again.
> If anything is needed from me please let me know.
>
> Jose
>
>
>>
>> Cheers,
>>
>> Richard
>>
>>
>>
>
> --
> Best regards,
>
> José Quaresma
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#172584):
> https://lists.openembedded.org/g/openembedded-core/message/172584
> Mute This Topic: https://lists.openembedded.org/mt/94730390/5052612
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> quaresma.jose@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Steve Sakoman Nov. 14, 2022, 2:42 p.m. UTC | #5
On Mon, Nov 14, 2022 at 3:17 AM Jose Quaresma <quaresma.jose@gmail.com> wrote:
>
> Hi Steve,
>
> Can this patch be backported to kirkstone?

Certainly!  I've added it to my test queue.

Steve

>> Richard Purdie <richard.purdie@linuxfoundation.org> escreveu no dia quarta, 2/11/2022 à(s) 10:55:
>>>
>>> On Wed, 2022-11-02 at 09:42 +0000, Jose Quaresma wrote:
>>> > Are there any issues with this patch or the oe-selftest in the
>>> > previous one that I need to address?
>>>
>>> When I was reviewing the patches that were queued while I was away,
>>> this one wasn't one I could immediately look at and make a decision on.
>>> It was therefore deferred for me to spend a bit more time on. I'm
>>> trying to get there!
>>
>>
>> Thanks for the update.
>> I decided to ask now because I saw that the master branch has started the integration again.
>> If anything is needed from me please let me know.
>>
>> Jose
>>
>>>
>>>
>>> Cheers,
>>>
>>> Richard
>>>
>>>
>>
>>
>> --
>> Best regards,
>>
>> José Quaresma
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#172584): https://lists.openembedded.org/g/openembedded-core/message/172584
>> Mute This Topic: https://lists.openembedded.org/mt/94730390/5052612
>> Group Owner: openembedded-core+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [quaresma.jose@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
>
>
> --
> Best regards,
>
> José Quaresma
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/archiver.py b/meta/lib/oeqa/selftest/cases/archiver.py
index ffdea832be..3fa59fff51 100644
--- a/meta/lib/oeqa/selftest/cases/archiver.py
+++ b/meta/lib/oeqa/selftest/cases/archiver.py
@@ -6,6 +6,7 @@ 
 
 import os
 import glob
+import re
 from oeqa.utils.commands import bitbake, get_bb_vars
 from oeqa.selftest.case import OESelftestTestCase
 
@@ -119,7 +120,38 @@  class Archiver(OESelftestTestCase):
         excluded_present = len(glob.glob(src_path_target + '/%s-*/*' % target_recipes[1]))
         self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % target_recipes[1])
 
+    def test_archiver_multiconfig_shared_unpack_and_patch(self):
+        """
+        Test that shared recipes in original mode with diff enabled works in multiconfig,
+        otherwise it will not build when using the same TMP dir.
+        """
+
+        features = 'BBMULTICONFIG = "mc1 mc2"\n'
+        features += 'INHERIT += "archiver"\n'
+        features += 'ARCHIVER_MODE[src] = "original"\n'
+        features += 'ARCHIVER_MODE[diff] = "1"\n'
+        self.write_config(features)
 
+        # We can use any machine in multiconfig as long as they are different
+        self.write_config('MACHINE = "qemuarm"\n', 'mc1')
+        self.write_config('MACHINE = "qemux86"\n', 'mc2')
+
+        task = 'do_unpack_and_patch'
+        # Use gcc-source as it is a shared recipe (appends the pv to the pn)
+        pn = 'gcc-source-%s' % get_bb_vars(['PV'], 'gcc')['PV']
+
+        # Generate the tasks signatures
+        bitbake('mc:mc1:%s mc:mc2:%s -c %s -S none' % (pn, pn, task))
+
+        # Check the tasks signatures
+        # To be machine agnostic the tasks needs to generate the same signature for each machine
+        locked_sigs_inc = "%s/locked-sigs.inc" % self.builddir
+        locked_sigs = open(locked_sigs_inc).read()
+        task_sigs = re.findall(r"%s:%s:.*" % (pn, task), locked_sigs)
+        uniq_sigs = set(task_sigs)
+        self.assertFalse(len(uniq_sigs) - 1, \
+            'The task "%s" of the recipe "%s" has different signatures in "%s" for each machine in multiconfig' \
+            % (task, pn, locked_sigs_inc))
 
     def test_archiver_srpm_mode(self):
         """