All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] OEQA: Add a check for MACHINE
@ 2019-11-05 16:52 Armin Kuster
  2019-11-05 16:52 ` [PATCH 2/2] OEQA: Add qemu checks Armin Kuster
  0 siblings, 1 reply; 2+ messages in thread
From: Armin Kuster @ 2019-11-05 16:52 UTC (permalink / raw
  To: openembedded-core

Signed-off-by: Armin Kuster <akuster808@gmail.com>
---
 meta/lib/oeqa/core/decorator/data.py | 44 ++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/meta/lib/oeqa/core/decorator/data.py b/meta/lib/oeqa/core/decorator/data.py
index 12d462f..ff92fba 100644
--- a/meta/lib/oeqa/core/decorator/data.py
+++ b/meta/lib/oeqa/core/decorator/data.py
@@ -18,6 +18,16 @@ def has_feature(td, feature):
         return True
     return False
 
+def has_machine(td, machine):
+    """
+        Checks for MACHINE.
+    """
+
+    if (machine in td.get('MACHINE', '')):
+        return True
+    return False
+
+
 @registerDecorator
 class skipIfDataVar(OETestDecorator):
     """
@@ -131,3 +141,37 @@ class skipIfFeature(OETestDecorator):
         self.logger.debug(msg)
         if has_feature(self.case.td, self.value):
             self.case.skipTest(self.msg)
+
+@registerDecorator
+class skipIfNotMachine(OETestDecorator):
+    """
+        Skip test based on MACHINE.
+
+        value must be match 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 has_machine(self.case.td, self.value):
+            self.case.skipTest(self.msg)
+
+@registerDecorator
+class skipIfMachine(OETestDecorator):
+    """
+        Skip test based on Machine.
+
+        value must not be this 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 has_machine(self.case.td, self.value):
+            self.case.skipTest(self.msg)
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] OEQA: Add qemu checks
  2019-11-05 16:52 [PATCH 1/2] OEQA: Add a check for MACHINE Armin Kuster
@ 2019-11-05 16:52 ` Armin Kuster
  0 siblings, 0 replies; 2+ messages in thread
From: Armin Kuster @ 2019-11-05 16:52 UTC (permalink / raw
  To: openembedded-core

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>
---
 meta/lib/oeqa/core/decorator/data.py | 45 ++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/meta/lib/oeqa/core/decorator/data.py b/meta/lib/oeqa/core/decorator/data.py
index ff92fba..bc4939e 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)
+
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-05 16:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-05 16:52 [PATCH 1/2] OEQA: Add a check for MACHINE Armin Kuster
2019-11-05 16:52 ` [PATCH 2/2] OEQA: Add qemu checks Armin Kuster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.