return expected == actual
-def expectedFailure(expected_fn, bugnumber=None):
+def expectedFailure(func, bugnumber=None):
+ return unittest2.expectedFailure(func)
+
+def expectedFailureIfFn(expected_fn, bugnumber=None):
def expectedFailure_impl(func):
if isinstance(func, type) and issubclass(func, unittest2.TestCase):
raise Exception(
@wraps(func)
def wrapper(*args, **kwargs):
- self = args[0]
- if funcutils.requires_self(expected_fn):
- xfail_reason = expected_fn(self)
- else:
- xfail_reason = expected_fn()
+ xfail_reason = expected_fn(*args, **kwargs)
if xfail_reason is not None:
xfail_func = unittest2.expectedFailure(func)
xfail_func(*args, **kwargs)
if mode == DecorateMode.Skip:
return skipTestIfFn(fn, bugnumber)
elif mode == DecorateMode.Xfail:
- return expectedFailure(fn, bugnumber)
+ return expectedFailureIfFn(fn, bugnumber)
else:
return None
arch - A sequence of architecture names specifying the architectures
for which a test is expected to fail. None means all architectures.
"""
- return expectedFailure(
+ return expectedFailureIfFn(
_skip_for_android(
"xfailing on android",
api_levels,
self.runCmd("run", RUN_SUCCEEDED)
- @unittest2.expectedFailure(
+ @expectedFailure(
"llvm.org/pr17135 <rdar://problem/14874559> APFloat::toString does not identify the correct (i.e. least) precision.")
def test_floating_point_expr_commands(self):
self.build_and_run()
mydir = TestBase.compute_mydir(__file__)
- @expectedFailure(python_leaky_fd_version, "bugs.freebsd.org/197376")
+ @expectedFailureIfFn(python_leaky_fd_version, "bugs.freebsd.org/197376")
@expectedFailureAll(
oslist=['freebsd'],
bugnumber="llvm.org/pr25624 still failing with Python 2.7.10")
def test_fd_leak_basic(self):
self.do_test([])
- @expectedFailure(python_leaky_fd_version, "bugs.freebsd.org/197376")
+ @expectedFailureIfFn(python_leaky_fd_version, "bugs.freebsd.org/197376")
@expectedFailureAll(
oslist=['freebsd'],
bugnumber="llvm.org/pr25624 still failing with Python 2.7.10")
process.GetExitStatus() == 0,
"Process returned non-zero status. Were incorrect file descriptors passed?")
- @expectedFailure(python_leaky_fd_version, "bugs.freebsd.org/197376")
+ @expectedFailureIfFn(python_leaky_fd_version, "bugs.freebsd.org/197376")
@expectedFailureAll(
oslist=['freebsd'],
bugnumber="llvm.org/pr25624 still failing with Python 2.7.10")
breakpoint = target.BreakpointCreateByLocation("main.c", 1)
self.assertTrue(breakpoint.IsHardware())
- @expectedFailure(supports_hw_breakpoints)
+ @expectedFailureIfFn(supports_hw_breakpoints)
def test_step_range(self):
"""Test stepping when hardware breakpoints are required."""
self.build()
self.assertTrue("Could not create hardware breakpoint for thread plan"
in error.GetCString())
- @expectedFailure(supports_hw_breakpoints)
+ @expectedFailureIfFn(supports_hw_breakpoints)
def test_step_out(self):
"""Test stepping out when hardware breakpoints are required."""
self.build()
self.assertTrue("Could not create hardware breakpoint for thread plan"
in error.GetCString())
- @expectedFailure(supports_hw_breakpoints)
+ @expectedFailureIfFn(supports_hw_breakpoints)
def test_step_over(self):
"""Test stepping over when hardware breakpoints are required."""
self.build()
'error: Could not create hardware breakpoint for thread plan.'
])
- @expectedFailure(supports_hw_breakpoints)
+ @expectedFailureIfFn(supports_hw_breakpoints)
def test_step_until(self):
"""Test stepping until when hardware breakpoints are required."""
self.build()
@skipTestIfFn(
lambda: "Skipped because the test crashes the test runner",
bugnumber="llvm.org/pr24702")
- @unittest2.expectedFailure("llvm.org/pr24702")
+ @expectedFailure("llvm.org/pr24702")
def test_bogus_values(self):
"""Test that we handle inferior misusing the GDB JIT interface"""
self.build()
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24660")
@expectedFailureNetBSD
# thread states not properly maintained
- @unittest2.expectedFailure("llvm.org/pr16712")
+ @expectedFailure("llvm.org/pr16712")
def test_state_after_expression(self):
"""Test thread state after expression."""
self.build(dictionary=self.getBuildFlags(use_cpp11=False))
self.thread_state_after_expression_test()
# thread states not properly maintained
- @unittest2.expectedFailure("llvm.org/pr15824 and <rdar://problem/28557237>")
+ @expectedFailure("llvm.org/pr15824 and <rdar://problem/28557237>")
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly")
"""Test that types work when defined in a shared library and forward-declared in the main executable, but with preloading disabled"""
self.common_test_expr(False)
- @unittest2.expectedFailure("llvm.org/PR36712")
+ @expectedFailure("llvm.org/PR36712")
def test_frame_variable(self):
"""Test that types work when defined in a shared library and forward-declared in the main executable"""
self.build()
"other_element = 3"])
@expectedFailureAll(oslist=["windows"])
- @unittest2.expectedFailure("llvm.org/PR36712")
+ @expectedFailure("llvm.org/PR36712")
def test_frame_variable(self):
"""Test that types work when defined in a shared library and forward-declared in the main executable"""
self.build()
# Evaluate B::func() - should call B::func()
self.expect("expr -- B::func()", startstr="(int) $15 = 4")
- @unittest2.expectedFailure("lldb scope lookup of functions bugs")
+ @expectedFailure("lldb scope lookup of functions bugs")
def test_function_scope_lookup_with_run_command(self):
"""Test scope lookup of functions in lldb."""
self.build()
# before functions.
self.expect("expr -- foo()", startstr="(int) $2 = 42")
- @unittest2.expectedFailure("lldb file scope lookup bugs")
+ @expectedFailure("lldb file scope lookup bugs")
@skipIfWindows # This is flakey on Windows: llvm.org/pr38373
def test_file_scope_lookup_with_run_command(self):
"""Test file scope lookup in lldb."""
# Evaluate func2() - should call A::func2()
self.expect("expr -- func2()", startstr="(int) $0 = 3")
- @unittest2.expectedFailure(
+ @expectedFailure(
"lldb scope lookup after using declaration bugs")
# NOTE: this test may fail on older systems that don't emit import
# emtries in DWARF - may need to add checks for compiler versions here.
# Evaluate func() - should call A::func()
self.expect("expr -- func()", startstr="(int) $0 = 3")
- @unittest2.expectedFailure("lldb scope lookup ambiguity after using bugs")
+ @expectedFailure("lldb scope lookup ambiguity after using bugs")
def test_scope_ambiguity_after_using_lookup_with_run_command(self):
"""Test scope lookup ambiguity after using in lldb."""
self.build()
mydir = TestBase.compute_mydir(__file__)
- @unittest2.expectedFailure # llvm.org/pr15401
+ @expectedFailure # llvm.org/pr15401
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
def test_with_run_command(self):
"""Test that member variables have the correct layout, scope and qualifiers when stopped inside and outside C++ methods"""
self.build()
self.frame_var(False)
- @unittest2.expectedFailure("rdar://18683637")
+ @expectedFailure("rdar://18683637")
@skipUnlessDarwin
def test_frame_variable_across_modules(self):
if self.getArchitecture() == 'i386':
post_handle_thread_id = int(post_handle_thread_id, 16)
self.assertEqual(post_handle_thread_id, print_thread_id)
- @unittest2.expectedFailure()
+ @expectedFailure
@debugserver_test
@skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
def test_Hc_then_Csignal_signals_correct_thread_launch_debugserver(self):