All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: yang.xu@mediatek.com
Cc: openembedded-core@lists.openembedded.org, ross.burton@arm.com
Subject: Re: [OE-core] [PATCH v3] sstatesig: Fix pn and taskname derivation in find_siginfo
Date: Fri, 7 Jul 2023 14:36:35 +0200	[thread overview]
Message-ID: <202307071236355ddab32a@mail.local> (raw)
In-Reply-To: <20230707065239.28468-1-yang.xu@mediatek.com>

Hello,

On 07/07/2023 06:52:39+0000, Yang Xu via lists.openembedded.org wrote:
> From: Yang Xu <yang.xu@mediatek.com>
> 
> The `bb.siggen.compare_sigfiles` method transforms the key format from
> `[mc:<mc_name>:][virtual:][native:]<recipe path>:<taskname>` to
> `<recipe dir>/<recipe name>:<taskname>[:virtual][:native][:mc:<mc_name>]`
> by `clean_basepaths`. However, `find_siginfo` uses the original format
> to get the package name (pn) and task name.
> 
> This commit corrects the method for deriving the pn and task name in
> `find_siginfo` and adds handling for multilib name.
> And add test for compare_sigfiles and find_siginfo working together.
> 
> Signed-off-by: Yang Xu <yang.xu@mediatek.com>
> ---

Please always include a changelog in this location, else we can't know
easily what changed since v2.

>  .../recipes-test/binutils/binutils_%.bbappend |  2 +
>  meta/lib/oe/sstatesig.py                      | 17 ++++--
>  meta/lib/oeqa/selftest/cases/sstatetests.py   | 53 +++++++++++++++++++
>  3 files changed, 67 insertions(+), 5 deletions(-)
>  create mode 100644 meta-selftest/recipes-test/binutils/binutils_%.bbappend
> 
> diff --git a/meta-selftest/recipes-test/binutils/binutils_%.bbappend b/meta-selftest/recipes-test/binutils/binutils_%.bbappend
> new file mode 100644
> index 0000000000..205720982c
> --- /dev/null
> +++ b/meta-selftest/recipes-test/binutils/binutils_%.bbappend
> @@ -0,0 +1,2 @@
> +# This bbappend is used to alter the recipe using the test_recipe.inc file created by tests.
> +include test_recipe.inc
> diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
> index f943df181e..f041a0c430 100644
> --- a/meta/lib/oe/sstatesig.py
> +++ b/meta/lib/oe/sstatesig.py
> @@ -321,11 +321,18 @@ def find_siginfo(pn, taskname, taskhashlist, d):
>      if not taskname:
>          # We have to derive pn and taskname
>          key = pn
> -        splitit = key.split('.bb:')
> -        taskname = splitit[1]
> -        pn = os.path.basename(splitit[0]).split('_')[0]
> -        if key.startswith('virtual:native:'):
> -            pn = pn + '-native'
> +        if key.count(':') >= 2:
> +            splitit, taskname, affix = key.split(':', 2)
> +        else:
> +            splitit, taskname = key.split(':', 1)
> +            affix = ''
> +        pn = os.path.splitext(os.path.basename(splitit))[0].split('_')[0]
> +        affixitems = affix.split(':')
> +        if affixitems[0] == 'virtual':
> +            if affixitems[1] == 'native':
> +                pn = pn + '-native'
> +            if affixitems[1] == 'multilib':
> +                pn = affixitems[2] + '-' + pn
>  
>      hashfiles = {}
>      filedates = {}
> diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py b/meta/lib/oeqa/selftest/cases/sstatetests.py
> index febafdb2f7..818d8b623d 100644
> --- a/meta/lib/oeqa/selftest/cases/sstatetests.py
> +++ b/meta/lib/oeqa/selftest/cases/sstatetests.py
> @@ -691,3 +691,56 @@ TMPDIR = "${TOPDIR}/tmp-sstatesamehash2"
>          self.maxDiff = None
>          self.assertCountEqual(files1, files2)
>  
> +class SStateFindSiginfo(SStateBase):
> +    def test_sstate_compare_sigfiles_and_find_siginfo(self):
> +        """
> +        Test the functionality of the find_siginfo: basic function and callback in compare_sigfiles
> +        """
> +        self.write_config("""
> +TMPDIR = \"${TOPDIR}/tmp-sstates-findsiginfo\"
> +TCLIBCAPPEND = \"\"
> +MACHINE = \"qemux86\"
> +require conf/multilib.conf
> +MULTILIBS = "multilib:lib32"
> +DEFAULTTUNE:virtclass-multilib-lib32 = "x86"
> +BB_SIGNATURE_HANDLER = "OEBasicHash"
> +""")
> +        self.track_for_cleanup(self.topdir + "/tmp-sstates-findsiginfo")
> +
> +        pns = ["binutils", "binutils-native", "lib32-binutils"]
> +
> +        #forcing generate different stamps for binutils every time
> +        self.write_recipeinc("binutils", 'do_fetch[nostamp] = "1"')
> +        for pn in pns*2:
> +            bitbake("%s -S none" % pn)
> +        self.delete_recipeinc("binutils")
> +
> +        with bb.tinfoil.Tinfoil() as tinfoil:
> +            tinfoil.prepare(config_only=True)
> +
> +            def find_siginfo(pn, taskname, sigs=None):
> +                result = None
> +                tinfoil.set_event_mask(["bb.event.FindSigInfoResult",
> +                                "bb.command.CommandCompleted"])
> +                ret = tinfoil.run_command("findSigInfo", pn, taskname, sigs)
> +                if ret:
> +                    while True:
> +                        event = tinfoil.wait_event(1)
> +                        if event:
> +                            if isinstance(event, bb.command.CommandCompleted):
> +                                break
> +                            elif isinstance(event, bb.event.FindSigInfoResult):
> +                                result = event.result
> +                return result
> +
> +            def recursecb(key, hash1, hash2):
> +                hashes = [hash1, hash2]
> +                hashfiles = find_siginfo(key, None, hashes)
> +                self.assertCountEqual(hashes, hashfiles)
> +                bb.siggen.compare_sigfiles(hashfiles[hash1], hashfiles[hash2], recursecb)
> +
> +            for pn in pns:
> +                filedates = find_siginfo(pn, "do_compile")
> +                self.assertGreaterEqual(len(filedates), 2)
> +                latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-2:]
> +                bb.siggen.compare_sigfiles(latestfiles[-2], latestfiles[-1], recursecb)
> -- 
> 2.25.1
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#184001): https://lists.openembedded.org/g/openembedded-core/message/184001
> Mute This Topic: https://lists.openembedded.org/mt/100001305/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 


-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


  reply	other threads:[~2023-07-07 12:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-07  6:52 [PATCH v3] sstatesig: Fix pn and taskname derivation in find_siginfo yang.xu
2023-07-07 12:36 ` Alexandre Belloni [this message]
2023-07-09 14:34   ` Yang Xu
2023-07-10 11:43     ` [OE-core] " Ross Burton
2023-07-09 14:48   ` Yang Xu (徐扬)
2023-07-10 21:04 ` Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202307071236355ddab32a@mail.local \
    --to=alexandre.belloni@bootlin.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=ross.burton@arm.com \
    --cc=yang.xu@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.