summaryrefslogtreecommitdiffstats
path: root/lldb/test/lldbtest.py
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test/lldbtest.py')
-rw-r--r--lldb/test/lldbtest.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py
index 298e0e4fc8f..908a0c41866 100644
--- a/lldb/test/lldbtest.py
+++ b/lldb/test/lldbtest.py
@@ -351,7 +351,6 @@ def python_api_test(func):
wrapper.__python_api_test__ = True
return wrapper
-from functools import wraps
def benchmarks_test(func):
"""Decorate the item as a benchmarks test."""
if isinstance(func, type) and issubclass(func, unittest2.TestCase):
@@ -369,6 +368,27 @@ def benchmarks_test(func):
wrapper.__benchmarks_test__ = True
return wrapper
+def expectedFailureClang(func):
+ """Decorate the item as a Clang only expectedFailure."""
+ if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+ raise Exception("@expectedFailureClang can only be used to decorate a test method")
+ @wraps(func)
+ def wrapper(*args, **kwargs):
+ from unittest2 import case
+ self = args[0]
+ compiler = self.getCompiler()
+ try:
+ func(*args, **kwargs)
+ except Exception, e:
+ if "clang" in compiler:
+ raise case._ExpectedFailure(sys.exc_info())
+ else:
+ raise e
+
+ if "clang" in compiler:
+ raise case._UnexpectedSuccess
+ return wrapper
+
class Base(unittest2.TestCase):
"""
Abstract base for performing lldb (see TestBase) or other generic tests (see
OpenPOWER on IntegriCloud