[Lldb-commits] [PATCH] D12039: Make @skipUnlessArch actually skip instead of XFAIL

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 14 14:03:45 PDT 2015

zturner created this revision.
zturner added a reviewer: chaoren.
zturner added a subscriber: lldb-commits.



Index: test/lldbtest.py
--- test/lldbtest.py
+++ test/lldbtest.py
@@ -664,11 +664,6 @@
         return arch in self.getArchitecture()
     return expectedFailure(fn, bugnumber)
-def skipUnlessArch(arch):
-    def fn(self):
-        return not self.getArchitecture() in arch 
-    return expectedFailure(fn, None)
 def expectedFailurei386(bugnumber=None):
     return expectedFailureArch('i386', bugnumber)
@@ -945,6 +940,23 @@
     return unittest2.skipUnless(getHostPlatform() in oslist,
                                 "requires on of %s" % (", ".join(oslist)))
+def skipUnlessArch(archlist):
+    def myImpl(func):
+        if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+            raise Exception("@skipUnlessArch can only be used to decorate a test method")
+        @wraps(func)
+        def wrapper(*args, **kwargs):
+            self = args[0]
+            if self.getArchitecture() not in archlist:
+                self.skipTest("skipping for architecture %s (requires one of %s)" % 
+                    (self.getArchitecture(), ", ".join(archlist)))
+            else:
+                func(*args, **kwargs)
+        return wrapper
+    return myImpl
 def skipIfPlatform(oslist):
     """Decorate the item to skip tests if running on one of the listed platforms."""
     return unittest2.skipIf(getPlatform() in oslist,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12039.32186.patch
Type: text/x-patch
Size: 1438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150814/813a8bd5/attachment.bin>

More information about the lldb-commits mailing list