[Lldb-commits] [lldb] bf93f4b - [lldb] Fix and rename skipIfHostIncompatibleWithRemote

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 16 07:59:18 PST 2024


Author: Jonas Devlieghere
Date: 2024-02-16T07:59:03-08:00
New Revision: bf93f4b85fd4efbd7a3083935a2ddbbb00f1a35f

URL: https://github.com/llvm/llvm-project/commit/bf93f4b85fd4efbd7a3083935a2ddbbb00f1a35f
DIFF: https://github.com/llvm/llvm-project/commit/bf93f4b85fd4efbd7a3083935a2ddbbb00f1a35f.diff

LOG: [lldb] Fix and rename skipIfHostIncompatibleWithRemote

Fix and rename the broken and confusingly named decorator
skipIfHostIncompatibleWithRemote. The decorator is meant to skip test
which uses the inferior test build system (i.e. to build test inferiors)
to build host binaries (e.g. lldb drivers).

The decorator was broken on macOS, where the host and target platform
report macosx, but the decorator overwrote it with Darwin, resulting in
tests incorrectly being skipped.

The decorator was also missing on a handful of tests that use the
buildDriver helper, which this commit fixes as well.

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/decorators.py
    lldb/test/API/api/command-return-object/TestSBCommandReturnObject.py
    lldb/test/API/api/multiple-debuggers/TestMultipleDebuggers.py
    lldb/test/API/api/multiple-targets/TestMultipleTargets.py
    lldb/test/API/api/multithreaded/TestMultithreaded.py
    lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py
index 86594c2b409e79..a5d7a7a25879df 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -746,18 +746,14 @@ def skipUnlessTargetAndroid(func):
     )(func)
 
 
-def skipIfHostIncompatibleWithRemote(func):
-    """Decorate the item to skip tests if binaries built on this host are incompatible."""
+def skipIfHostIncompatibleWithTarget(func):
+    """Decorate the item to skip tests when the host and target are incompatible."""
 
     def is_host_incompatible_with_remote():
         host_arch = lldbplatformutil.getLLDBArchitecture()
         host_platform = lldbplatformutil.getHostPlatform()
         target_arch = lldbplatformutil.getArchitecture()
-        target_platform = (
-            "darwin"
-            if lldbplatformutil.platformIsDarwin()
-            else lldbplatformutil.getPlatform()
-        )
+        target_platform = lldbplatformutil.getPlatform()
         if (
             not (target_arch == "x86_64" and host_arch == "i386")
             and host_arch != target_arch

diff  --git a/lldb/test/API/api/command-return-object/TestSBCommandReturnObject.py b/lldb/test/API/api/command-return-object/TestSBCommandReturnObject.py
index 98f08937736349..e992f62ba91441 100644
--- a/lldb/test/API/api/command-return-object/TestSBCommandReturnObject.py
+++ b/lldb/test/API/api/command-return-object/TestSBCommandReturnObject.py
@@ -12,6 +12,7 @@ class TestSBCommandReturnObject(TestBase):
     @expectedFailureAll(
         oslist=["windows"], archs=["i[3-6]86", "x86_64"], bugnumber="llvm.org/pr43570"
     )
+    @skipIfHostIncompatibleWithTarget
     def test_sb_command_return_object(self):
         env = {self.dylibPath: self.getLLDBLibraryEnvVal()}
 

diff  --git a/lldb/test/API/api/multiple-debuggers/TestMultipleDebuggers.py b/lldb/test/API/api/multiple-debuggers/TestMultipleDebuggers.py
index 15b2012eee13b6..b818268f2efa80 100644
--- a/lldb/test/API/api/multiple-debuggers/TestMultipleDebuggers.py
+++ b/lldb/test/API/api/multiple-debuggers/TestMultipleDebuggers.py
@@ -13,6 +13,7 @@ class TestMultipleSimultaneousDebuggers(TestBase):
 
     @skipIfNoSBHeaders
     @skipIfWindows
+    @skipIfHostIncompatibleWithTarget
     def test_multiple_debuggers(self):
         env = {self.dylibPath: self.getLLDBLibraryEnvVal()}
 

diff  --git a/lldb/test/API/api/multiple-targets/TestMultipleTargets.py b/lldb/test/API/api/multiple-targets/TestMultipleTargets.py
index 4fb9279e978d7b..a2e0f08d3b3bc7 100644
--- a/lldb/test/API/api/multiple-targets/TestMultipleTargets.py
+++ b/lldb/test/API/api/multiple-targets/TestMultipleTargets.py
@@ -13,11 +13,11 @@ class TestMultipleTargets(TestBase):
 
     @skipIf(oslist=["linux"], archs=["arm", "aarch64"])
     @skipIfNoSBHeaders
-    @skipIfHostIncompatibleWithRemote
     @expectedFailureAll(
         oslist=["windows"], archs=["i[3-6]86", "x86_64"], bugnumber="llvm.org/pr20282"
     )
     @expectedFlakeyNetBSD
+    @skipIfHostIncompatibleWithTarget
     def test_multiple_targets(self):
         env = {self.dylibPath: self.getLLDBLibraryEnvVal()}
 

diff  --git a/lldb/test/API/api/multithreaded/TestMultithreaded.py b/lldb/test/API/api/multithreaded/TestMultithreaded.py
index 1eeff12da4920d..9f2756fcd46fc9 100644
--- a/lldb/test/API/api/multithreaded/TestMultithreaded.py
+++ b/lldb/test/API/api/multithreaded/TestMultithreaded.py
@@ -27,6 +27,7 @@ def setUp(self):
     @skipIfRemote
     # clang-cl does not support throw or catch (llvm.org/pr24538)
     @skipIfWindows
+    @skipIfHostIncompatibleWithTarget
     def test_python_stop_hook(self):
         """Test that you can run a python command in a stop-hook when stdin is File based."""
         self.build_and_test("driver.cpp test_stop-hook.cpp", "test_python_stop_hook")
@@ -34,6 +35,7 @@ def test_python_stop_hook(self):
     @skipIfRemote
     # clang-cl does not support throw or catch (llvm.org/pr24538)
     @skipIfWindows
+    @skipIfHostIncompatibleWithTarget
     def test_breakpoint_callback(self):
         """Test the that SBBreakpoint callback is invoked when a breakpoint is hit."""
         self.build_and_test(
@@ -43,6 +45,7 @@ def test_breakpoint_callback(self):
     @skipIfRemote
     # clang-cl does not support throw or catch (llvm.org/pr24538)
     @skipIfWindows
+    @skipIfHostIncompatibleWithTarget
     def test_breakpoint_location_callback(self):
         """Test the that SBBreakpointLocation callback is invoked when a breakpoint is hit."""
         self.build_and_test(
@@ -54,6 +57,7 @@ def test_breakpoint_location_callback(self):
     # clang-cl does not support throw or catch (llvm.org/pr24538)
     @skipIfWindows
     @expectedFlakeyFreeBSD
+    @skipIfHostIncompatibleWithTarget
     def test_sb_api_listener_event_description(self):
         """Test the description of an SBListener breakpoint event is valid."""
         self.build_and_test(
@@ -65,6 +69,7 @@ def test_sb_api_listener_event_description(self):
     # clang-cl does not support throw or catch (llvm.org/pr24538)
     @skipIfWindows
     @expectedFlakeyFreeBSD
+    @skipIfHostIncompatibleWithTarget
     def test_sb_api_listener_event_process_state(self):
         """Test that a registered SBListener receives events when a process
         changes state.
@@ -79,6 +84,7 @@ def test_sb_api_listener_event_process_state(self):
     @skipIfWindows
     @expectedFlakeyFreeBSD
     @skipIf(oslist=["linux"])  # flakey
+    @skipIfHostIncompatibleWithTarget
     def test_sb_api_listener_resume(self):
         """Test that a process can be resumed from a non-main thread."""
         self.build_and_test(

diff  --git a/lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py b/lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py
index 46ebbef5c3ab6b..d2df036683bf6f 100644
--- a/lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py
+++ b/lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py
@@ -13,9 +13,7 @@ def setUp(self):
         TestBase.setUp(self)
 
     @skipIfNoSBHeaders
-    # Requires a compatible arch and platform to link against the host's built
-    # lldb lib.
-    @skipIfHostIncompatibleWithRemote
+    @skipIfHostIncompatibleWithTarget
     @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
     @no_debug_info_test
     def test_load_plugin(self):


        


More information about the lldb-commits mailing list