summaryrefslogtreecommitdiffstats
path: root/lldb/test/lldbtest.py
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-08-19 00:54:27 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-08-19 00:54:27 +0000
commit31963cea0ac25b2449f6e3ee88f9020b203cab7c (patch)
tree49fecb058cef15106ab925ef5e173add334b84ff /lldb/test/lldbtest.py
parent9eb77bf6151ea278c7afbb3e370781f34a8ba5cc (diff)
downloadbcm5719-llvm-31963cea0ac25b2449f6e3ee88f9020b203cab7c.tar.gz
bcm5719-llvm-31963cea0ac25b2449f6e3ee88f9020b203cab7c.zip
Add a decorator for marking clang only expectedFailure. Use it for the test_step_over_3_times_with_dsym/dwarf()
test cases in TestThreadAPI.py by decorating it with @expectedFailureClang. Example: @expectedFailureClang @python_api_test def test_step_over_3_times_with_dwarf(self): """Test Python SBThread.StepOver() API.""" # We build a different executable than the default buildDwarf() does. d = {'CXX_SOURCES': 'main2.cpp', 'EXE': self.exe_name} self.buildDwarf(dictionary=d) self.setTearDownCleanup(dictionary=d) self.step_over_3_times(self.exe_name) llvm-svn: 138019
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