Author: Jonas Devlieghere Date: 2025-07-01T18:01:19-07:00 New Revision: a87b27fd5161ec43527fc3356852046a321ea82c
URL: https://github.com/llvm/llvm-project/commit/a87b27fd5161ec43527fc3356852046a321ea82c DIFF: https://github.com/llvm/llvm-project/commit/a87b27fd5161ec43527fc3356852046a321ea82c.diff LOG: [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. Added: Modified: lldb/test/API/functionalities/breakpoint/hardware_breakpoints/base.py lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/TestRequireHWBreakpoints.py lldb/test/API/functionalities/breakpoint/hardware_breakpoints/write_memory_with_hw_breakpoint/TestWriteMemoryWithHWBreakpoint.py Removed: ################################################################################ diff --git a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/base.py b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/base.py index 0ab5dd0f910f2..0ad903befc65e 100644 --- a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/base.py +++ b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/base.py @@ -14,5 +14,15 @@ def supports_hw_breakpoints(self): self.runCmd("breakpoint set -b main --hardware") self.runCmd("run") 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 None + + def hw_breakpoints_unsupported(self): + if not self.supports_hw_breakpoints(): + return "Hardware breakpoints are unsupported" + return None diff --git a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py index 1a0515aa04c07..4632c3bed1899 100644 --- a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py +++ b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py @@ -12,16 +12,13 @@ class HardwareBreakpointMultiThreadTestCase(HardwareBreakpointTestBase): - def does_not_support_hw_breakpoints(self): - return not super().supports_hw_breakpoints() - - @skipTestIfFn(does_not_support_hw_breakpoints) + @skipTestIfFn(HardwareBreakpointTestBase.hw_breakpoints_unsupported) def test_hw_break_set_delete_multi_thread_macos(self): self.build() self.setTearDownCleanup() 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): self.build() self.setTearDownCleanup() diff --git a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/TestRequireHWBreakpoints.py b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/TestRequireHWBreakpoints.py index 89d57683a8007..a8c9cdeea9362 100644 --- a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/TestRequireHWBreakpoints.py +++ b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/TestRequireHWBreakpoints.py @@ -26,7 +26,7 @@ def test_breakpoint(self): breakpoint = target.BreakpointCreateByLocation("main.c", 1) self.assertTrue(breakpoint.IsHardware()) - @skipTestIfFn(HardwareBreakpointTestBase.supports_hw_breakpoints) + @skipTestIfFn(HardwareBreakpointTestBase.hw_breakpoints_supported) def test_step_range(self): """Test stepping when hardware breakpoints are required.""" self.build() @@ -49,7 +49,7 @@ def test_step_range(self): "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): """Test stepping out when hardware breakpoints are required.""" self.build() @@ -71,7 +71,7 @@ def test_step_out(self): "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): """Test stepping over when hardware breakpoints are required.""" self.build() @@ -91,7 +91,7 @@ def test_step_over(self): # Was reported to sometimes pass on certain hardware. @skipIf(oslist=["linux"], archs=["arm$"]) - @skipTestIfFn(HardwareBreakpointTestBase.supports_hw_breakpoints) + @skipTestIfFn(HardwareBreakpointTestBase.hw_breakpoints_supported) def test_step_until(self): """Test stepping until when hardware breakpoints are required.""" self.build() diff --git a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/write_memory_with_hw_breakpoint/TestWriteMemoryWithHWBreakpoint.py b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/write_memory_with_hw_breakpoint/TestWriteMemoryWithHWBreakpoint.py index e4e25ae877ded..c82ae24a6d9ab 100644 --- a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/write_memory_with_hw_breakpoint/TestWriteMemoryWithHWBreakpoint.py +++ b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/write_memory_with_hw_breakpoint/TestWriteMemoryWithHWBreakpoint.py @@ -12,10 +12,9 @@ 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): self.build() exe = self.getBuildArtifact("a.out") _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits