summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
authorRoss Burton <ross@burtonini.com>2022-03-31 19:28:58 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-04-01 23:11:37 +0100
commite9c8d638f91471a45ff0e13692fc58e8e2edacdf (patch)
treed03025ad336b7c8403f5414ec96b169b3495ad78 /meta/lib/oeqa
parent8d01207fd764aa2d5c01926681b7967e8ee9a612 (diff)
downloadpoky-e9c8d638f91471a45ff0e13692fc58e8e2edacdf.tar.gz
oeqa/selftest/wic: clean up only_for_arch decorator
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. (From OE-Core rev: e8e6c679f6eb74cb25c124a18af88dd5c2e2c833) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r--meta/lib/oeqa/selftest/cases/wic.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index 5d7f7bf613..317b80ea27 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
22from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu 22from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu
23 23
24 24
25@lru_cache(maxsize=32) 25@lru_cache()
26def get_host_arch(recipe): 26def get_host_arch():
27 """A cached call to get_bb_var('HOST_ARCH', <recipe>)""" 27 return get_bb_var('HOST_ARCH')
28 return get_bb_var('HOST_ARCH', recipe)
29 28
30 29
31def only_for_arch(archs, image='core-image-minimal'): 30def only_for_arch(archs):
32 """Decorator for wrapping test cases that can be run only for specific target 31 """Decorator for wrapping test cases that can be run only for specific target
33 architectures. A list of compatible architectures is passed in `archs`. 32 architectures. A list of compatible architectures is passed in `archs`.
34 Current architecture will be determined by parsing bitbake output for
35 `image` recipe.
36 """ 33 """
37 def wrapper(func): 34 def wrapper(func):
38 @wraps(func) 35 @wraps(func)
39 def wrapped_f(*args, **kwargs): 36 def wrapped_f(*args, **kwargs):
40 arch = get_host_arch(image) 37 arch = get_host_arch()
41 if archs and arch not in archs: 38 if archs and arch not in archs:
42 raise unittest.SkipTest("Testcase arch dependency not met: %s" % arch) 39 raise unittest.SkipTest("Testcase arch dependency not met: %s" % arch)
43 return func(*args, **kwargs) 40 return func(*args, **kwargs)
44 wrapped_f.__name__ = func.__name__
45 return wrapped_f 41 return wrapped_f
46 return wrapper 42 return wrapper
47 43