tatyana-krasnukha created this revision.
tatyana-krasnukha added reviewers: JDevlieghere, labath.
tatyana-krasnukha added a project: LLDB.
Herald added a subscriber: lldb-commits.

Create a common base class for them to re-use supports_hw_breakpoints function 
in decorators.

This is a preparatory patch for the D84254 <https://reviews.llvm.org/D84254> 
which adds one more test with hardware breakpoints.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84311

Files:
  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/Makefile
  
lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/TestRequireHWBreakpoints.py
  
lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/main.c
  lldb/test/API/functionalities/breakpoint/require_hw_breakpoints/Makefile
  
lldb/test/API/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py
  lldb/test/API/functionalities/breakpoint/require_hw_breakpoints/main.c

Index: lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/TestRequireHWBreakpoints.py
===================================================================
--- lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/TestRequireHWBreakpoints.py
+++ lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/TestRequireHWBreakpoints.py
@@ -8,20 +8,13 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+from functionalities.breakpoint.hardware_breakpoints.base import *
 
-class BreakpointLocationsTestCase(TestBase):
-    NO_DEBUG_INFO_TESTCASE = True
+class BreakpointLocationsTestCase(HardwareBreakpointTestBase):
     mydir = TestBase.compute_mydir(__file__)
 
     def supports_hw_breakpoints(self):
-        self.build()
-        self.runCmd("file " + self.getBuildArtifact("a.out"),
-                    CURRENT_EXECUTABLE_SET)
-        self.runCmd("breakpoint set -b main --hardware")
-        self.runCmd("run")
-        if 'stopped' in self.res.GetOutput():
-            return 'Hardware breakpoints are supported'
-        return None
+        return super().supports_hw_breakpoints()
 
     def test_breakpoint(self):
         """Test regular breakpoints when hardware breakpoints are required."""
Index: lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
===================================================================
--- lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
+++ lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
@@ -9,15 +9,18 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
-class HardwareBreakpointMultiThreadTestCase(TestBase):
-    NO_DEBUG_INFO_TESTCASE = True
+from functionalities.breakpoint.hardware_breakpoints.base import *
 
+class HardwareBreakpointMultiThreadTestCase(HardwareBreakpointTestBase):
     mydir = TestBase.compute_mydir(__file__)
 
+    def does_not_support_hw_breakpoints(self):
+        return not super().supports_hw_breakpoints()
+
     # LLDB on linux supports hardware breakpoints for arm and aarch64
     # architectures.
     @skipUnlessPlatform(oslist=['linux'])
-    @skipIf(archs=no_match(['arm', 'aarch64']))
+    @skipTestIfFn(does_not_support_hw_breakpoints)
     def test_hw_break_set_delete_multi_thread_linux(self):
         self.build()
         self.setTearDownCleanup()
@@ -26,7 +29,7 @@
     # LLDB on linux supports hardware breakpoints for arm and aarch64
     # architectures.
     @skipUnlessPlatform(oslist=['linux'])
-    @skipIf(archs=no_match(['arm', 'aarch64']))
+    @skipTestIfFn(does_not_support_hw_breakpoints)
     def test_hw_break_set_disable_multi_thread_linux(self):
         self.build()
         self.setTearDownCleanup()
@@ -36,7 +39,7 @@
     # architectures.
     @skipUnlessDarwin
     @skipIfOutOfTreeDebugserver
-    @expectedFailureAll(archs=["arm64"])
+    @skipTestIfFn(does_not_support_hw_breakpoints)
     def test_hw_break_set_delete_multi_thread_macos(self):
         self.build()
         self.setTearDownCleanup()
@@ -46,7 +49,7 @@
     # architectures.
     @skipUnlessDarwin
     @skipIfOutOfTreeDebugserver
-    @expectedFailureAll(archs=["arm64"])
+    @skipTestIfFn(does_not_support_hw_breakpoints)
     def test_hw_break_set_disable_multi_thread_macos(self):
         self.build()
         self.setTearDownCleanup()
Index: lldb/test/API/functionalities/breakpoint/hardware_breakpoints/base.py
===================================================================
--- /dev/null
+++ lldb/test/API/functionalities/breakpoint/hardware_breakpoints/base.py
@@ -0,0 +1,19 @@
+"""
+Base class for hardware breakpoints tests.
+"""
+
+from lldbsuite.test.lldbtest import *
+
+class HardwareBreakpointTestBase(TestBase):
+    NO_DEBUG_INFO_TESTCASE = True
+
+
+    def supports_hw_breakpoints(self):
+        self.build()
+        self.runCmd("file " + self.getBuildArtifact("a.out"),
+                    CURRENT_EXECUTABLE_SET)
+        self.runCmd("breakpoint set -b main --hardware")
+        self.runCmd("run")
+        if 'stopped' in self.res.GetOutput():
+            return 'Hardware breakpoints are supported'
+        return None
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
  • [Lldb-commits] [PATCH] ... Tatyana Krasnukha via Phabricator via lldb-commits

Reply via email to