]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/core: Add qemu checks
authorArmin Kuster <akuster808@gmail.com>
Tue, 12 Nov 2019 04:33:21 +0000 (20:33 -0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 14 Nov 2019 12:56:05 +0000 (12:56 +0000)
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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/core/decorator/data.py

index ff92fba57ab420d14ca3600c22947d77a0ec14da..bc4939e87c5ec2083a88c41109c8ff47a375f48f 100644 (file)
@@ -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)
+