[lldb] Fix the hardware breakpoint decorator (#146609)
A decorator to skip or XFAIL a test takes effect when the function that's passed in returns a reason string. The wrappers around hw_breakpoints_supported were doing that incorrectly by inverting (calling `not`) on the result, turning it into a boolean, which means the test is always skipped.
This commit is contained in:
committed by
GitHub
parent
7502af89fc
commit
a87b27fd51
@@ -14,5 +14,15 @@ class HardwareBreakpointTestBase(TestBase):
|
|||||||
self.runCmd("breakpoint set -b main --hardware")
|
self.runCmd("breakpoint set -b main --hardware")
|
||||||
self.runCmd("run")
|
self.runCmd("run")
|
||||||
if "stopped" in self.res.GetOutput():
|
if "stopped" in self.res.GetOutput():
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def hw_breakpoints_supported(self):
|
||||||
|
if self.supports_hw_breakpoints():
|
||||||
return "Hardware breakpoints are supported"
|
return "Hardware breakpoints are supported"
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def hw_breakpoints_unsupported(self):
|
||||||
|
if not self.supports_hw_breakpoints():
|
||||||
|
return "Hardware breakpoints are unsupported"
|
||||||
|
return None
|
||||||
|
|||||||
@@ -12,16 +12,13 @@ from functionalities.breakpoint.hardware_breakpoints.base import *
|
|||||||
|
|
||||||
|
|
||||||
class HardwareBreakpointMultiThreadTestCase(HardwareBreakpointTestBase):
|
class HardwareBreakpointMultiThreadTestCase(HardwareBreakpointTestBase):
|
||||||
def does_not_support_hw_breakpoints(self):
|
@skipTestIfFn(HardwareBreakpointTestBase.hw_breakpoints_unsupported)
|
||||||
return not super().supports_hw_breakpoints()
|
|
||||||
|
|
||||||
@skipTestIfFn(does_not_support_hw_breakpoints)
|
|
||||||
def test_hw_break_set_delete_multi_thread_macos(self):
|
def test_hw_break_set_delete_multi_thread_macos(self):
|
||||||
self.build()
|
self.build()
|
||||||
self.setTearDownCleanup()
|
self.setTearDownCleanup()
|
||||||
self.break_multi_thread("delete")
|
self.break_multi_thread("delete")
|
||||||
|
|
||||||
@skipTestIfFn(does_not_support_hw_breakpoints)
|
@skipTestIfFn(HardwareBreakpointTestBase.hw_breakpoints_unsupported)
|
||||||
def test_hw_break_set_disable_multi_thread_macos(self):
|
def test_hw_break_set_disable_multi_thread_macos(self):
|
||||||
self.build()
|
self.build()
|
||||||
self.setTearDownCleanup()
|
self.setTearDownCleanup()
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class BreakpointLocationsTestCase(HardwareBreakpointTestBase):
|
|||||||
breakpoint = target.BreakpointCreateByLocation("main.c", 1)
|
breakpoint = target.BreakpointCreateByLocation("main.c", 1)
|
||||||
self.assertTrue(breakpoint.IsHardware())
|
self.assertTrue(breakpoint.IsHardware())
|
||||||
|
|
||||||
@skipTestIfFn(HardwareBreakpointTestBase.supports_hw_breakpoints)
|
@skipTestIfFn(HardwareBreakpointTestBase.hw_breakpoints_supported)
|
||||||
def test_step_range(self):
|
def test_step_range(self):
|
||||||
"""Test stepping when hardware breakpoints are required."""
|
"""Test stepping when hardware breakpoints are required."""
|
||||||
self.build()
|
self.build()
|
||||||
@@ -49,7 +49,7 @@ class BreakpointLocationsTestCase(HardwareBreakpointTestBase):
|
|||||||
"Could not create hardware breakpoint for thread plan", error.GetCString()
|
"Could not create hardware breakpoint for thread plan", error.GetCString()
|
||||||
)
|
)
|
||||||
|
|
||||||
@skipTestIfFn(HardwareBreakpointTestBase.supports_hw_breakpoints)
|
@skipTestIfFn(HardwareBreakpointTestBase.hw_breakpoints_supported)
|
||||||
def test_step_out(self):
|
def test_step_out(self):
|
||||||
"""Test stepping out when hardware breakpoints are required."""
|
"""Test stepping out when hardware breakpoints are required."""
|
||||||
self.build()
|
self.build()
|
||||||
@@ -71,7 +71,7 @@ class BreakpointLocationsTestCase(HardwareBreakpointTestBase):
|
|||||||
"Could not create hardware breakpoint for thread plan", error.GetCString()
|
"Could not create hardware breakpoint for thread plan", error.GetCString()
|
||||||
)
|
)
|
||||||
|
|
||||||
@skipTestIfFn(HardwareBreakpointTestBase.supports_hw_breakpoints)
|
@skipTestIfFn(HardwareBreakpointTestBase.hw_breakpoints_supported)
|
||||||
def test_step_over(self):
|
def test_step_over(self):
|
||||||
"""Test stepping over when hardware breakpoints are required."""
|
"""Test stepping over when hardware breakpoints are required."""
|
||||||
self.build()
|
self.build()
|
||||||
@@ -91,7 +91,7 @@ class BreakpointLocationsTestCase(HardwareBreakpointTestBase):
|
|||||||
|
|
||||||
# Was reported to sometimes pass on certain hardware.
|
# Was reported to sometimes pass on certain hardware.
|
||||||
@skipIf(oslist=["linux"], archs=["arm$"])
|
@skipIf(oslist=["linux"], archs=["arm$"])
|
||||||
@skipTestIfFn(HardwareBreakpointTestBase.supports_hw_breakpoints)
|
@skipTestIfFn(HardwareBreakpointTestBase.hw_breakpoints_supported)
|
||||||
def test_step_until(self):
|
def test_step_until(self):
|
||||||
"""Test stepping until when hardware breakpoints are required."""
|
"""Test stepping until when hardware breakpoints are required."""
|
||||||
self.build()
|
self.build()
|
||||||
|
|||||||
@@ -12,10 +12,9 @@ from functionalities.breakpoint.hardware_breakpoints.base import *
|
|||||||
|
|
||||||
|
|
||||||
class WriteMemoryWithHWBreakpoint(HardwareBreakpointTestBase):
|
class WriteMemoryWithHWBreakpoint(HardwareBreakpointTestBase):
|
||||||
def does_not_support_hw_breakpoints(self):
|
|
||||||
return not super().supports_hw_breakpoints()
|
|
||||||
|
|
||||||
@skipTestIfFn(does_not_support_hw_breakpoints)
|
@skipTestIfFn(HardwareBreakpointTestBase.supports_hw_breakpoints)
|
||||||
|
@skip
|
||||||
def test_copy_memory_with_hw_break(self):
|
def test_copy_memory_with_hw_break(self):
|
||||||
self.build()
|
self.build()
|
||||||
exe = self.getBuildArtifact("a.out")
|
exe = self.getBuildArtifact("a.out")
|
||||||
|
|||||||
Reference in New Issue
Block a user