From fcc9c0ab37d1280538490a8069baf94984b38853 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Thu, 31 Mar 2022 19:29:09 +0100 Subject: oeqa: rationalise skipifqemu decorators (From OE-Core rev: 1a3a37cc2b16a8d5cd2258b0b35be43baa363f67) Signed-off-by: Ross Burton Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie --- meta/lib/oeqa/core/decorator/data.py | 44 ++++++++---------------------------- 1 file changed, 9 insertions(+), 35 deletions(-) (limited to 'meta/lib/oeqa/core') diff --git a/meta/lib/oeqa/core/decorator/data.py b/meta/lib/oeqa/core/decorator/data.py index 12197be246..3ce10e5499 100644 --- a/meta/lib/oeqa/core/decorator/data.py +++ b/meta/lib/oeqa/core/decorator/data.py @@ -27,17 +27,6 @@ def has_machine(td, 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')): - return True - return False - @registerDecorator class skipIfDataVar(OETestDecorator): """ @@ -189,34 +178,19 @@ 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* """ - - attrs = ('value', 'msg') - 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 not qemu MACHINE") + if not self.case.td.get('MACHINE', '').startswith('qemu'): + self.case.skipTest('Test only runs on qemu machines') @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. - """ - - attrs = ('value', 'msg') - + Skip test if MACHINE is qemu* + """ 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) - + self.logger.debug("Checking if qemu MACHINE") + if self.case.td.get('MACHINE', '').startswith('qemu'): + self.case.skipTest('Test only runs on real hardware') -- cgit v1.2.3-54-g00ecf