[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openembedded-core
Subject:    [OE-core] [PATCH 06/23] oeqa/selftest/wic: clean up only_for_arch decorator
From:       "Ross Burton" <ross () burtonini ! com>
Date:       2022-03-31 18:28:58
Message-ID: 20220331182915.22128-6-ross.burton () arm ! com
[Download RAW message or body]

Content-Transfer-Encoding: quoted-printable

There's no need to pass a recipe name when determining the target
architecture, there's no need to cap the size of the lru_cache as it
will only have one entry, and __name__ is set by @wraps.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/lib/oeqa/selftest/cases/wic.py | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index 5d7f7bf6135..317b80ea27b 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -22,26 +22,22 @@ from oeqa.selftest.case import OESelftestTestCase
 from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu
 
 
-@lru_cache(maxsize=32)
-def get_host_arch(recipe):
-    """A cached call to get_bb_var('HOST_ARCH', <recipe>)"""
-    return get_bb_var('HOST_ARCH', recipe)
+@lru_cache()
+def get_host_arch():
+    return get_bb_var('HOST_ARCH')
 
 
-def only_for_arch(archs, image='core-image-minimal'):
+def only_for_arch(archs):
     """Decorator for wrapping test cases that can be run only for specific target
     architectures. A list of compatible architectures is passed in `archs`.
-    Current architecture will be determined by parsing bitbake output for
-    `image` recipe.
     """
     def wrapper(func):
         @wraps(func)
         def wrapped_f(*args, **kwargs):
-            arch = get_host_arch(image)
+            arch = get_host_arch()
             if archs and arch not in archs:
                 raise unittest.SkipTest("Testcase arch dependency not met: %s" % arch)
             return func(*args, **kwargs)
-        wrapped_f.__name__ = func.__name__
         return wrapped_f
     return wrapper
 
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#163847): https://lists.openembedded.org/g/openembedded-core/message/163847
Mute This Topic: https://lists.openembedded.org/mt/90161341/4454766
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [openembedded-core@marc.info]
-=-=-=-=-=-=-=-=-=-=-=-



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic