diff options
Diffstat (limited to 'lldb/test')
| -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): | 

