diff options
author | Armin Kuster <akuster808@gmail.com> | 2019-11-01 09:41:30 -0700 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2019-11-11 11:03:55 -0800 |
commit | 94d3b6857632f405f3f86295546c373d2059631c (patch) | |
tree | eaf95556e619fe4a4e52c2bb708e44a43b93004c | |
parent | bcc2a20eab337ac7acc1564fa4aee3f3e5e5bb59 (diff) | |
download | openembedded-core-contrib-94d3b6857632f405f3f86295546c373d2059631c.tar.gz |
OEQA: Add qemu checks
Some test should not be run in QEMU systems so
add some checks to make that easier
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-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): 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): @@ -175,3 +185,38 @@ class skipIfMachine(OETestDecorator): self.logger.debug(msg) if has_machine(self.case.td, self.value): self.case.skipTest(self.msg) + +@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. + """ + + 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) + +@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') + + 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) + |