diff options
| -rw-r--r-- | meta/lib/oeqa/core/decorator/data.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/meta/lib/oeqa/core/decorator/data.py b/meta/lib/oeqa/core/decorator/data.py index ff92fba57a..bc4939e87c 100644 --- a/meta/lib/oeqa/core/decorator/data.py +++ b/meta/lib/oeqa/core/decorator/data.py | |||
| @@ -27,6 +27,16 @@ def has_machine(td, machine): | |||
| 27 | return True | 27 | return True |
| 28 | return False | 28 | return False |
| 29 | 29 | ||
| 30 | def 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 | ||
| 39 | return False | ||
| 30 | 40 | ||
| 31 | @registerDecorator | 41 | @registerDecorator |
| 32 | class skipIfDataVar(OETestDecorator): | 42 | class skipIfDataVar(OETestDecorator): |
| @@ -175,3 +185,38 @@ class skipIfMachine(OETestDecorator): | |||
| 175 | self.logger.debug(msg) | 185 | self.logger.debug(msg) |
| 176 | if has_machine(self.case.td, self.value): | 186 | if has_machine(self.case.td, self.value): |
| 177 | self.case.skipTest(self.msg) | 187 | self.case.skipTest(self.msg) |
| 188 | |||
| 189 | @registerDecorator | ||
| 190 | class skipIfNotQemu(OETestDecorator): | ||
| 191 | """ | ||
| 192 | Skip test based on MACHINE. | ||
| 193 | |||
| 194 | value must be a qemu MACHINE or it will skip the test | ||
| 195 | with msg as the reason. | ||
| 196 | """ | ||
| 197 | |||
| 198 | attrs = ('value', 'msg') | ||
| 199 | |||
| 200 | def setUpDecorator(self): | ||
| 201 | msg = ('Checking if %s is not this MACHINE' % self.value) | ||
| 202 | self.logger.debug(msg) | ||
| 203 | if not is_qemu(self.case.td, self.value): | ||
| 204 | self.case.skipTest(self.msg) | ||
| 205 | |||
| 206 | @registerDecorator | ||
| 207 | class skipIfQemu(OETestDecorator): | ||
| 208 | """ | ||
| 209 | Skip test based on Qemu Machine. | ||
| 210 | |||
| 211 | value must not be a qemu machine or it will skip the test | ||
| 212 | with msg as the reason. | ||
| 213 | """ | ||
| 214 | |||
| 215 | attrs = ('value', 'msg') | ||
| 216 | |||
| 217 | def setUpDecorator(self): | ||
| 218 | msg = ('Checking if %s is this MACHINE' % self.value) | ||
| 219 | self.logger.debug(msg) | ||
| 220 | if is_qemu(self.case.td, self.value): | ||
| 221 | self.case.skipTest(self.msg) | ||
| 222 | |||
