diff options
| author | Johnny Chen <johnny.chen@apple.com> | 2011-08-19 00:54:27 +0000 |
|---|---|---|
| committer | Johnny Chen <johnny.chen@apple.com> | 2011-08-19 00:54:27 +0000 |
| commit | 31963cea0ac25b2449f6e3ee88f9020b203cab7c (patch) | |
| tree | 49fecb058cef15106ab925ef5e173add334b84ff | |
| parent | 9eb77bf6151ea278c7afbb3e370781f34a8ba5cc (diff) | |
| download | bcm5719-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
| -rw-r--r-- | lldb/test/lldbtest.py | 22 | ||||
| -rw-r--r-- | lldb/test/python_api/thread/TestThreadAPI.py | 4 |
2 files changed, 25 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 diff --git a/lldb/test/python_api/thread/TestThreadAPI.py b/lldb/test/python_api/thread/TestThreadAPI.py index 3dbc61f0dfe..59244694951 100644 --- a/lldb/test/python_api/thread/TestThreadAPI.py +++ b/lldb/test/python_api/thread/TestThreadAPI.py @@ -77,6 +77,7 @@ class ThreadAPITestCase(TestBase): self.step_out_of_malloc_into_function_b(self.exe_name) @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") + @expectedFailureClang @python_api_test def test_step_over_3_times_with_dsym(self): """Test Python SBThread.StepOver() API.""" @@ -86,6 +87,7 @@ class ThreadAPITestCase(TestBase): self.setTearDownCleanup(dictionary=d) self.step_over_3_times(self.exe_name) + @expectedFailureClang @python_api_test def test_step_over_3_times_with_dwarf(self): """Test Python SBThread.StepOver() API.""" @@ -221,6 +223,8 @@ class ThreadAPITestCase(TestBase): frame0 = thread.GetFrameAtIndex(0) lineEntry = frame0.GetLineEntry() self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete) + # Expected failure with clang as the compiler. + # rdar://problem/9223880 self.assertTrue(lineEntry.GetLine() == self.after_3_step_overs) def run_to_address(self, exe_name): |

