zturner created this revision.
zturner added a reviewer: chaoren.
zturner added a subscriber: lldb-commits.
http://reviews.llvm.org/D12039
Files:
test/lldbtest.py
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,
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,
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits