llvm-project/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_args.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

34 lines
1.1 KiB
Python

"""
Test lldb-dap launch request.
"""
from lldbsuite.test.decorators import expectedFailureWindows
import lldbdap_testcase
class TestDAP_launch_args(lldbdap_testcase.DAPTestCaseBase):
"""
Tests launch of a simple program with arguments
"""
def test(self):
program = self.getBuildArtifact("a.out")
args = ["one", "with space", "'with single quotes'", '"with double quotes"']
self.build_and_launch(program, args=args)
self.continue_to_exit()
# Now get the STDOUT and verify our arguments got passed correctly
output = self.get_stdout()
self.assertTrue(output and len(output) > 0, "expect program output")
lines = output.splitlines()
# Skip the first argument that contains the program name
lines.pop(0)
# Make sure arguments we specified are correct
for i, arg in enumerate(args):
quoted_arg = '"%s"' % (arg)
self.assertIn(
quoted_arg,
lines[i],
'arg[%i] "%s" not in "%s"' % (i + 1, quoted_arg, lines[i]),
)