[Lldb-commits] [lldb] r138019 - in /lldb/trunk/test: lldbtest.py python_api/thread/TestThreadAPI.py
Johnny Chen
johnny.chen at apple.com
Thu Aug 18 17:54:28 PDT 2011
Author: johnny
Date: Thu Aug 18 19:54:27 2011
New Revision: 138019
URL: http://llvm.org/viewvc/llvm-project?rev=138019&view=rev
Log:
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)
Modified:
lldb/trunk/test/lldbtest.py
lldb/trunk/test/python_api/thread/TestThreadAPI.py
Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=138019&r1=138018&r2=138019&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Thu Aug 18 19:54:27 2011
@@ -351,7 +351,6 @@
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 @@
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
Modified: lldb/trunk/test/python_api/thread/TestThreadAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/thread/TestThreadAPI.py?rev=138019&r1=138018&r2=138019&view=diff
==============================================================================
--- lldb/trunk/test/python_api/thread/TestThreadAPI.py (original)
+++ lldb/trunk/test/python_api/thread/TestThreadAPI.py Thu Aug 18 19:54:27 2011
@@ -77,6 +77,7 @@
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 @@
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 @@
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):
More information about the lldb-commits
mailing list