Author: zturner
Date: Fri Aug 14 18:29:24 2015
New Revision: 245127

URL: http://llvm.org/viewvc/llvm-project?rev=245127&view=rev
Log:
Make skipUnlessArch decorator actually skip instead of XFAIL.

Modified:
    lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=245127&r1=245126&r2=245127&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Fri Aug 14 18:29:24 2015
@@ -664,11 +664,6 @@ def expectedFailureArch(arch, bugnumber=
         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,24 @@ def skipUnlessHostPlatform(oslist):
     return unittest2.skipUnless(getHostPlatform() in oslist,
                                 "requires on of %s" % (", ".join(oslist)))
 
+def skipUnlessArch(archlist):
+    """Decorate the item to skip tests unless running on one of the listed 
architectures."""
+    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,


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to