[Lldb-commits] [lldb] [lldb][Windows] extend @skipIfWindows to lldb-server or in process (PR #202688)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 9 08:23:03 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Charles Zablit (charles-zablit)
<details>
<summary>Changes</summary>
Some tests fail when using `lldb-server.exe` and pass when using the in process plugin and vice-versa.
This patch adds the `use_lldb_server` parameter to `skipIfWindows` and `expectedFailureWindows` to only skip tests if they run on `lldb-server` or the in process plugin, or both.
This fixes 4 XPASS when running tests with `USE_LLDB_SERVER=1`.
---
Full diff: https://github.com/llvm/llvm-project/pull/202688.diff
6 Files Affected:
- (modified) lldb/packages/Python/lldbsuite/test/decorators.py (+54-17)
- (modified) lldb/test/API/commands/platform/connect/TestPlatformConnect.py (+2-2)
- (modified) lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py (+1-1)
- (modified) lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py (+1-1)
- (modified) lldb/test/API/functionalities/breakpoint/delayed_breakpoints/TestDelayedBreakpoint.py (+1-1)
- (modified) lldb/test/API/functionalities/scripted_frame_provider/circular_dependency/TestFrameProviderCircularDependency.py (+2-2)
``````````diff
diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py
index 134591d3a5c67..d992a7077f3f0 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -672,7 +672,21 @@ def expectedFailureNetBSD(bugnumber=None):
return expectedFailureOS(["netbsd"], bugnumber)
-def expectedFailureWindows(bugnumber=None):
+def expectedFailureWindows(bugnumber=None, use_lldb_server=None):
+ """Mark a test as expected to fail on Windows.
+
+ `use_lldb_server` further restricts the xfail based on the
+ ``LLDB_USE_LLDB_SERVER`` environment variable, which selects between
+ the in-process Win32 ``windows`` process plugin (env unset/off, the
+ default) and the gdb-remote path through ``lldb-server`` (env on).
+ Pass ``True`` to xfail only when lldb-server is in use; pass ``False``
+ to xfail only when the in-process plugin is in use.
+ """
+ if use_lldb_server is not None:
+ env = os.environ.get("LLDB_USE_LLDB_SERVER", "").lower()
+ using_server = env in ("on", "yes", "1", "true")
+ if using_server != use_lldb_server:
+ return lambda func: func
return expectedFailureOS(["windows"], bugnumber)
@@ -887,29 +901,52 @@ def skipIfNoSignals(func):
return skipIfPlatform(["windows", "wasip1", "wasi"])(func)
-def skipIfWindows(func=None, windows_version=None):
- """Decorate the item to skip tests that should be skipped on Windows."""
+def skipIfWindows(func=None, windows_version=None, use_lldb_server=None):
+ """Decorate the item to skip tests that should be skipped on Windows.
+
+ `windows_version` is a two-element list ``[op, version]`` (e.g.
+ ``["<", "10.0.17763"]``) that further restricts the skip to Windows
+ versions matching that comparison.
+
+ `use_lldb_server` further restricts the skip based on the
+ ``LLDB_USE_LLDB_SERVER`` environment variable, which selects between
+ the in-process Win32 ``windows`` process plugin (env unset/off, the
+ default) and the gdb-remote path through ``lldb-server`` (env on).
+ Pass ``True`` to skip only when lldb-server is in use; pass ``False``
+ to skip only when the in-process plugin is in use.
+ """
def decorator(func):
- if windows_version is None:
+ if windows_version is None and use_lldb_server is None:
return skipIfPlatform(["windows"])(func)
- else:
- actual_win_version = lldbplatformutil.getWindowsVersion()
- def version_check():
- if actual_win_version == "unknown":
- return False
- operator, required_windows_version = windows_version
- return lldbplatformutil.isExpectedVersion(
+ actual_win_version = lldbplatformutil.getWindowsVersion()
+
+ def should_skip():
+ if actual_win_version == "unknown":
+ return False
+ if windows_version is not None:
+ operator, required = windows_version
+ if not lldbplatformutil.isExpectedVersion(
actual_version=actual_win_version,
- required_version=required_windows_version,
+ required_version=required,
operator=operator,
- )
+ ):
+ return False
+ if use_lldb_server is not None:
+ env = os.environ.get("LLDB_USE_LLDB_SERVER", "").lower()
+ using_server = env in ("on", "yes", "1", "true")
+ if using_server != use_lldb_server:
+ return False
+ return True
+
+ reason = f"Test is skipped on Windows '{actual_win_version}'"
+ if use_lldb_server is True:
+ reason += " (LLDB_USE_LLDB_SERVER on)"
+ elif use_lldb_server is False:
+ reason += " (LLDB_USE_LLDB_SERVER off)"
- return unittest.skipIf(
- version_check(),
- f"Test is skipped on Windows '{actual_win_version}'",
- )(func)
+ return unittest.skipIf(should_skip(), reason)(func)
if func is not None:
return decorator(func)
diff --git a/lldb/test/API/commands/platform/connect/TestPlatformConnect.py b/lldb/test/API/commands/platform/connect/TestPlatformConnect.py
index 0f9a51e216215..5e5757416815a 100644
--- a/lldb/test/API/commands/platform/connect/TestPlatformConnect.py
+++ b/lldb/test/API/commands/platform/connect/TestPlatformConnect.py
@@ -13,7 +13,7 @@ class TestPlatformProcessConnect(TestBase):
@skipIfRemote
@expectedFailureAll(hostoslist=["windows"], triple=".*-android")
@skipIfDarwin # lldb-server not found correctly
- @expectedFailureAll(oslist=["windows"]) # process modules not loaded
+ @expectedFailureWindows(use_lldb_server=False) # process modules not loaded
# lldb-server platform times out waiting for the gdbserver port number to be
# written to the pipe, yet it seems the gdbserver already has written it.
@expectedFailureAll(
@@ -62,7 +62,7 @@ def test_platform_process_connect(self):
@skipIfRemote
@expectedFailureAll(hostoslist=["windows"], triple=".*-android")
@skipIfDarwin # lldb-server not found correctly
- @expectedFailureAll(oslist=["windows"]) # process modules not loaded
+ @expectedFailureWindows(use_lldb_server=False) # process modules not loaded
# lldb-server platform times out waiting for the gdbserver port number to be
# written to the pipe, yet it seems the gdbserver already has written it.
@expectedFailureAll(
diff --git a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
index 6139584c1b0d9..6fbd5b80c95f8 100644
--- a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
+++ b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
@@ -16,7 +16,7 @@ class BreakpointCommandTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
SHARED_BUILD_TESTCASE = False
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528")
+ @expectedFailureWindows(use_lldb_server=False, bugnumber="llvm.org/pr24528")
def test_breakpoint_command_sequence(self):
"""Test a sequence of breakpoint command add, list, and delete."""
self.build()
diff --git a/lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py b/lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
index 6ed3c902f79e3..72a944953a54b 100644
--- a/lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
+++ b/lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
@@ -10,7 +10,7 @@
class BreakpointLocationsTestCase(TestBase):
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528")
+ @expectedFailureWindows(use_lldb_server=False, bugnumber="llvm.org/pr24528")
def test_enable(self):
"""Test breakpoint enable/disable for a breakpoint ID with multiple locations."""
self.build()
diff --git a/lldb/test/API/functionalities/breakpoint/delayed_breakpoints/TestDelayedBreakpoint.py b/lldb/test/API/functionalities/breakpoint/delayed_breakpoints/TestDelayedBreakpoint.py
index a3709fd62a202..27b1ea13f9e33 100644
--- a/lldb/test/API/functionalities/breakpoint/delayed_breakpoints/TestDelayedBreakpoint.py
+++ b/lldb/test/API/functionalities/breakpoint/delayed_breakpoints/TestDelayedBreakpoint.py
@@ -5,7 +5,7 @@
import os
- at skipIfWindows
+ at skipIfWindows(use_lldb_server=False)
class TestDelayedBreakpoint(TestBase):
def test(self):
self.build()
diff --git a/lldb/test/API/functionalities/scripted_frame_provider/circular_dependency/TestFrameProviderCircularDependency.py b/lldb/test/API/functionalities/scripted_frame_provider/circular_dependency/TestFrameProviderCircularDependency.py
index dcba03e0413a2..0401a14b5c6b4 100644
--- a/lldb/test/API/functionalities/scripted_frame_provider/circular_dependency/TestFrameProviderCircularDependency.py
+++ b/lldb/test/API/functionalities/scripted_frame_provider/circular_dependency/TestFrameProviderCircularDependency.py
@@ -47,7 +47,7 @@ def launch_and_stop_at_breakpoint(self):
return target, thread
@expectedFailureAll(oslist=["linux"], archs=["arm$"])
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
+ @expectedFailureWindows(use_lldb_server=False, bugnumber="llvm.org/pr24778")
def test_circular_dependency_with_function_replacement(self):
"""
Test the circular dependency fix with a provider that replaces function names.
@@ -165,7 +165,7 @@ def test_circular_dependency_handle_command_in_init(self):
frame.GetFunctionName(), f"Frame {i} should have function name"
)
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
+ @expectedFailureWindows(use_lldb_server=False, bugnumber="llvm.org/pr24778")
def test_circular_dependency_evaluate_expression_in_get_frame(self):
"""
Test that calling EvaluateExpression in get_frame_at_index doesn't
``````````
</details>
https://github.com/llvm/llvm-project/pull/202688
More information about the lldb-commits
mailing list