llvm-project/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_version.py
Charles Zablit 6a365b004d
[lldb-dap][windows] fix lldb-dap's self.get_stdout() method (#181813)
`DAPTestCaseBase.get_stdout()` was originally not supported on Windows
due to the lack of ConPTY support.
https://github.com/llvm/llvm-project/pull/168729 fixed that by
implenenting the ConPTY support. It was partly reverted in
https://github.com/llvm/llvm-project/pull/177610 due to hard to
reproduce test failures.

The tests are now fixed (see the 2 patches below) and removing the check
for `GetFlags().Test(lldb::eLaunchFlagLaunchInTTY);` is the last step to
re-enabling ConPTY support.

This patch requires:
- https://github.com/llvm/llvm-project/pull/181811
- https://github.com/llvm/llvm-project/pull/181809

Fixes https://github.com/llvm/llvm-project/issues/137599.

rdar://168932366
2026-02-18 17:05:29 +00:00

38 lines
1.2 KiB
Python

"""
Test lldb-dap launch request.
"""
from lldbsuite.test.decorators import expectedFailureWindows
from lldbsuite.test.lldbtest import line_number
import lldbdap_testcase
class TestDAP_launch_version(lldbdap_testcase.DAPTestCaseBase):
"""
Tests that "initialize" response contains the "version" string the same
as the one returned by "version" command.
"""
def test(self):
program = self.getBuildArtifact("a.out")
self.build_and_launch(program)
source = "main.c"
breakpoint_line = line_number(source, "// breakpoint 1")
lines = [breakpoint_line]
# Set breakpoint in the thread function so we can step the threads
breakpoint_ids = self.set_source_breakpoints(source, lines)
self.continue_to_breakpoints(breakpoint_ids)
version_eval_response = self.dap_server.request_evaluate(
"`version", context="repl"
)
version_eval_output = version_eval_response["body"]["result"]
version_string = self.dap_server.get_capability("$__lldb_version")
self.assertEqual(
version_eval_output.splitlines(),
version_string.splitlines(),
"version string does not match",
)