From: Armin Kuster Date: Thu, 31 Oct 2019 14:32:01 +0000 (+0000) Subject: OEQA: Add a check for MACHINE X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=308c52f1938d42fffa4563a440c34edff109a416;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git OEQA: Add a check for MACHINE Signed-off-by: Armin Kuster --- diff --git a/meta/lib/oeqa/core/decorator/data.py b/meta/lib/oeqa/core/decorator/data.py index 12d462f2029..ff92fba57ab 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)