diff options
author | Mariano Lopez <mariano.lopez@linux.intel.com> | 2016-12-02 16:05:44 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-23 12:03:55 +0000 |
commit | 8740803d0696a0e97b72210a56f4fbd3135826ed (patch) | |
tree | b2cc197430c7dfadbc3853430e5cd18ca7f4d343 /meta | |
parent | 021449938ff0b4d182d7f02930a80693f109c8ba (diff) | |
download | openembedded-core-8740803d0696a0e97b72210a56f4fbd3135826ed.tar.gz openembedded-core-8740803d0696a0e97b72210a56f4fbd3135826ed.tar.bz2 openembedded-core-8740803d0696a0e97b72210a56f4fbd3135826ed.zip |
oeqa/core/decorator/data.py: Add skipIfNotFeature decorator
This adds a new decorator to check if image under tests has
certain DISTRO_FEATURE or IMAGE_FEATURE.
[YOCTO #10234]
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/core/decorator/data.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/meta/lib/oeqa/core/decorator/data.py b/meta/lib/oeqa/core/decorator/data.py index 73cca88d7b..fdeba9fe1d 100644 --- a/meta/lib/oeqa/core/decorator/data.py +++ b/meta/lib/oeqa/core/decorator/data.py @@ -5,6 +5,16 @@ from oeqa.core.exception import OEQAMissingVariable from . import OETestDecorator, registerDecorator +def has_feature(td, feature): + """ + Checks for feature in DISTRO_FEATURES or IMAGE_FEATURES. + """ + + if (feature in td.get('DISTRO_FEATURES', '') or + feature in td.get('IMAGE_FEATURES', '')): + return True + return False + @registerDecorator class skipIfDataVar(OETestDecorator): """ @@ -34,3 +44,21 @@ class OETestDataDepends(OETestDecorator): except KeyError: raise OEQAMissingVariable("Test case need %s variable but"\ " isn't into td" % v) + +@registerDecorator +class skipIfNotFeature(OETestDecorator): + """ + Skip test based on DISTRO_FEATURES. + + value must be in distro features or it will skip the test + with msg as the reason. + """ + + attrs = ('value', 'msg') + + def setUpDecorator(self): + msg = ('Checking if %s is in DISTRO_FEATURES ' + 'or IMAGE_FEATURES' % (self.value)) + self.logger.debug(msg) + if not has_feature(self.case.td, self.value): + self.case.skipTest(self.msg) |