diff options
Diffstat (limited to 'meta/lib/oeqa/core/decorator/data.py')
-rw-r--r-- | meta/lib/oeqa/core/decorator/data.py | 76 |
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): Checks for feature in DISTRO_FEATURES or IMAGE_FEATURES. """ - if (feature in td.get('DISTRO_FEATURES', '') or - feature in td.get('IMAGE_FEATURES', '')): + if (feature in td.get('DISTRO_FEATURES', '').split() or + feature in td.get('IMAGE_FEATURES', '').split()): return True return False @@ -23,18 +23,7 @@ def has_machine(td, machine): Checks for MACHINE. """ - if (machine in td.get('MACHINE', '')): - return True - return False - -def is_qemu(td, qemu): - """ - Checks if MACHINE is qemu. - """ - - machine = td.get('MACHINE', '') - if (qemu in td.get('MACHINE', '') or - machine.startswith('qemu')): + if (machine == td.get('MACHINE', '')): return True return False @@ -189,34 +178,53 @@ class skipIfMachine(OETestDecorator): @registerDecorator class skipIfNotQemu(OETestDecorator): """ - Skip test based on MACHINE. - - value must be a qemu MACHINE or it will skip the test - with msg as the reason. + Skip test if MACHINE is not qemu* """ + def setUpDecorator(self): + self.logger.debug("Checking if not qemu MACHINE") + if not self.case.td.get('MACHINE', '').startswith('qemu'): + self.case.skipTest('Test only runs on qemu machines') - attrs = ('value', 'msg') - +@registerDecorator +class skipIfNotQemuUsermode(OETestDecorator): + """ + Skip test if MACHINE_FEATURES does not contain qemu-usermode + """ def setUpDecorator(self): - msg = ('Checking if %s is not this MACHINE' % self.value) - self.logger.debug(msg) - if not is_qemu(self.case.td, self.value): - self.case.skipTest(self.msg) + self.logger.debug("Checking if MACHINE_FEATURES does not contain qemu-usermode") + if 'qemu-usermode' not in self.case.td.get('MACHINE_FEATURES', '').split(): + self.case.skipTest('Test requires qemu-usermode in MACHINE_FEATURES') @registerDecorator class skipIfQemu(OETestDecorator): """ - Skip test based on Qemu Machine. - - value must not be a qemu machine or it will skip the test - with msg as the reason. - """ + Skip test if MACHINE is qemu* + """ + def setUpDecorator(self): + self.logger.debug("Checking if qemu MACHINE") + if self.case.td.get('MACHINE', '').startswith('qemu'): + self.case.skipTest('Test only runs on real hardware') - attrs = ('value', 'msg') +@registerDecorator +class skipIfArch(OETestDecorator): + """ + Skip test if HOST_ARCH is present in the tuple specified. + """ + attrs = ('archs',) def setUpDecorator(self): - msg = ('Checking if %s is this MACHINE' % self.value) - self.logger.debug(msg) - if is_qemu(self.case.td, self.value): - self.case.skipTest(self.msg) + arch = self.case.td['HOST_ARCH'] + if arch in self.archs: + self.case.skipTest('Test skipped on %s' % arch) + +@registerDecorator +class skipIfNotArch(OETestDecorator): + """ + Skip test if HOST_ARCH is not present in the tuple specified. + """ + attrs = ('archs',) + def setUpDecorator(self): + arch = self.case.td['HOST_ARCH'] + if arch not in self.archs: + self.case.skipTest('Test skipped on %s' % arch) |