summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2019-11-11 20:33:20 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-14 13:21:00 +0000
commit1351614b8db8ae510f49b2a1a2007408ce7840a5 (patch)
treea6c823583eca52fc91691fb523d91510315e770c
parent5c9e840daee19bc3371829fa915f6ced200b8c5f (diff)
downloadpoky-1351614b8db8ae510f49b2a1a2007408ce7840a5.tar.gz
oeqa/core: Add a check for MACHINE
(From OE-Core rev: e69f963e548e2f6f211a56406694c029111d7203) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/core/decorator/data.py44
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):
18 return True 18 return True
19 return False 19 return False
20 20
21def has_machine(td, machine):
22 """
23 Checks for MACHINE.
24 """
25
26 if (machine in td.get('MACHINE', '')):
27 return True
28 return False
29
30
21@registerDecorator 31@registerDecorator
22class skipIfDataVar(OETestDecorator): 32class skipIfDataVar(OETestDecorator):
23 """ 33 """
@@ -131,3 +141,37 @@ class skipIfFeature(OETestDecorator):
131 self.logger.debug(msg) 141 self.logger.debug(msg)
132 if has_feature(self.case.td, self.value): 142 if has_feature(self.case.td, self.value):
133 self.case.skipTest(self.msg) 143 self.case.skipTest(self.msg)
144
145@registerDecorator
146class skipIfNotMachine(OETestDecorator):
147 """
148 Skip test based on MACHINE.
149
150 value must be match MACHINE or it will skip the test
151 with msg as the reason.
152 """
153
154 attrs = ('value', 'msg')
155
156 def setUpDecorator(self):
157 msg = ('Checking if %s is not this MACHINE' % self.value)
158 self.logger.debug(msg)
159 if not has_machine(self.case.td, self.value):
160 self.case.skipTest(self.msg)
161
162@registerDecorator
163class skipIfMachine(OETestDecorator):
164 """
165 Skip test based on Machine.
166
167 value must not be this machine or it will skip the test
168 with msg as the reason.
169 """
170
171 attrs = ('value', 'msg')
172
173 def setUpDecorator(self):
174 msg = ('Checking if %s is this MACHINE' % self.value)
175 self.logger.debug(msg)
176 if has_machine(self.case.td, self.value):
177 self.case.skipTest(self.msg)