summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/core/decorator/data.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/core/decorator/data.py')
-rw-r--r--meta/lib/oeqa/core/decorator/data.py76
1 files changed, 42 insertions, 34 deletions
diff --git a/meta/lib/oeqa/core/decorator/data.py b/meta/lib/oeqa/core/decorator/data.py
index bc4939e87c..5444b2cb75 100644
--- a/meta/lib/oeqa/core/decorator/data.py
+++ b/meta/lib/oeqa/core/decorator/data.py
@@ -13,8 +13,8 @@ def has_feature(td, feature):
13 Checks for feature in DISTRO_FEATURES or IMAGE_FEATURES. 13 Checks for feature in DISTRO_FEATURES or IMAGE_FEATURES.
14 """ 14 """
15 15
16 if (feature in td.get('DISTRO_FEATURES', '') or 16 if (feature in td.get('DISTRO_FEATURES', '').split() or
17 feature in td.get('IMAGE_FEATURES', '')): 17 feature in td.get('IMAGE_FEATURES', '').split()):
18 return True 18 return True
19 return False 19 return False
20 20
@@ -23,18 +23,7 @@ def has_machine(td, machine):
23 Checks for MACHINE. 23 Checks for MACHINE.
24 """ 24 """
25 25
26 if (machine in td.get('MACHINE', '')): 26 if (machine == td.get('MACHINE', '')):
27 return True
28 return False
29
30def is_qemu(td, qemu):
31 """
32 Checks if MACHINE is qemu.
33 """
34
35 machine = td.get('MACHINE', '')
36 if (qemu in td.get('MACHINE', '') or
37 machine.startswith('qemu')):
38 return True 27 return True
39 return False 28 return False
40 29
@@ -189,34 +178,53 @@ class skipIfMachine(OETestDecorator):
189@registerDecorator 178@registerDecorator
190class skipIfNotQemu(OETestDecorator): 179class skipIfNotQemu(OETestDecorator):
191 """ 180 """
192 Skip test based on MACHINE. 181 Skip test if MACHINE is not qemu*
193
194 value must be a qemu MACHINE or it will skip the test
195 with msg as the reason.
196 """ 182 """
183 def setUpDecorator(self):
184 self.logger.debug("Checking if not qemu MACHINE")
185 if not self.case.td.get('MACHINE', '').startswith('qemu'):
186 self.case.skipTest('Test only runs on qemu machines')
197 187
198 attrs = ('value', 'msg') 188@registerDecorator
199 189class skipIfNotQemuUsermode(OETestDecorator):
190 """
191 Skip test if MACHINE_FEATURES does not contain qemu-usermode
192 """
200 def setUpDecorator(self): 193 def setUpDecorator(self):
201 msg = ('Checking if %s is not this MACHINE' % self.value) 194 self.logger.debug("Checking if MACHINE_FEATURES does not contain qemu-usermode")
202 self.logger.debug(msg) 195 if 'qemu-usermode' not in self.case.td.get('MACHINE_FEATURES', '').split():
203 if not is_qemu(self.case.td, self.value): 196 self.case.skipTest('Test requires qemu-usermode in MACHINE_FEATURES')
204 self.case.skipTest(self.msg)
205 197
206@registerDecorator 198@registerDecorator
207class skipIfQemu(OETestDecorator): 199class skipIfQemu(OETestDecorator):
208 """ 200 """
209 Skip test based on Qemu Machine. 201 Skip test if MACHINE is qemu*
210 202 """
211 value must not be a qemu machine or it will skip the test 203 def setUpDecorator(self):
212 with msg as the reason. 204 self.logger.debug("Checking if qemu MACHINE")
213 """ 205 if self.case.td.get('MACHINE', '').startswith('qemu'):
206 self.case.skipTest('Test only runs on real hardware')
214 207
215 attrs = ('value', 'msg') 208@registerDecorator
209class skipIfArch(OETestDecorator):
210 """
211 Skip test if HOST_ARCH is present in the tuple specified.
212 """
216 213
214 attrs = ('archs',)
217 def setUpDecorator(self): 215 def setUpDecorator(self):
218 msg = ('Checking if %s is this MACHINE' % self.value) 216 arch = self.case.td['HOST_ARCH']
219 self.logger.debug(msg) 217 if arch in self.archs:
220 if is_qemu(self.case.td, self.value): 218 self.case.skipTest('Test skipped on %s' % arch)
221 self.case.skipTest(self.msg) 219
220@registerDecorator
221class skipIfNotArch(OETestDecorator):
222 """
223 Skip test if HOST_ARCH is not present in the tuple specified.
224 """
222 225
226 attrs = ('archs',)
227 def setUpDecorator(self):
228 arch = self.case.td['HOST_ARCH']
229 if arch not in self.archs:
230 self.case.skipTest('Test skipped on %s' % arch)