diff options
author | Armin Kuster <akuster808@gmail.com> | 2019-11-11 20:33:20 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-11-14 12:55:57 +0000 |
commit | e69f963e548e2f6f211a56406694c029111d7203 (patch) | |
tree | 6acbe9f557051416b356ec26c5853f8b179de363 /meta/lib/oeqa/core | |
parent | d6c975160197f67937dfbe91b08100b0f597c589 (diff) | |
download | openembedded-core-contrib-e69f963e548e2f6f211a56406694c029111d7203.tar.gz |
oeqa/core: Add a check for MACHINE
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/core')
-rw-r--r-- | meta/lib/oeqa/core/decorator/data.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/meta/lib/oeqa/core/decorator/data.py b/meta/lib/oeqa/core/decorator/data.py index 12d462f202..ff92fba57a 100644 --- a/meta/lib/oeqa/core/decorator/data.py +++ b/meta/lib/oeqa/core/decorator/data.py @@ -18,6 +18,16 @@ def has_feature(td, feature): return True return False +def has_machine(td, machine): + """ + Checks for MACHINE. + """ + + if (machine in td.get('MACHINE', '')): + return True + return False + + @registerDecorator class skipIfDataVar(OETestDecorator): """ @@ -131,3 +141,37 @@ class skipIfFeature(OETestDecorator): self.logger.debug(msg) if has_feature(self.case.td, self.value): self.case.skipTest(self.msg) + +@registerDecorator +class skipIfNotMachine(OETestDecorator): + """ + Skip test based on MACHINE. + + value must be match MACHINE or it will skip the test + with msg as the reason. + """ + + attrs = ('value', 'msg') + + def setUpDecorator(self): + msg = ('Checking if %s is not this MACHINE' % self.value) + self.logger.debug(msg) + if not has_machine(self.case.td, self.value): + self.case.skipTest(self.msg) + +@registerDecorator +class skipIfMachine(OETestDecorator): + """ + Skip test based on Machine. + + value must not be this machine or it will skip the test + with msg as the reason. + """ + + attrs = ('value', 'msg') + + def setUpDecorator(self): + msg = ('Checking if %s is this MACHINE' % self.value) + self.logger.debug(msg) + if has_machine(self.case.td, self.value): + self.case.skipTest(self.msg) |