[Lldb-commits] [lldb] [lldb-dap] Make dap tests tolerant of path separator (PR #197942)

via lldb-commits lldb-commits at lists.llvm.org
Fri May 15 07:30:16 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)

<details>
<summary>Changes</summary>

When running the tests with `LLDB_USE_LLDB_SERVER=1`, the lldb-server gdb-remote vRun packet sends the executable path in FileSpec's normalised form (forward slashes). On Windows the inferior's `argv[0]` therefore uses '/', while the program path in the setup uses '\\'. CreateProcessW accepts either spelling, so the inferior runs fine but the strict-equality assertion fails.

This patch normalises the paths to relax the match.

---
Full diff: https://github.com/llvm/llvm-project/pull/197942.diff


3 Files Affected:

- (modified) lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py (+6-3) 
- (modified) lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_basic.py (+5-1) 
- (modified) lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_stdio_redirection.py (+3-1) 


``````````diff
diff --git a/lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py b/lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py
index 7cbad03eeeead..ddbf984d6aaec 100644
--- a/lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py
+++ b/lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py
@@ -17,6 +17,9 @@ def setup(self):
         outfile = lldbutil.append_to_process_working_directory(self, "stdio.log")
         return (exe, outfile)
 
+    def _assert_stdio_log_matches(self, expected, actual):
+        self.assertEqual(expected.replace("\\", "/"), actual.replace("\\", "/"))
+
     def test_process_launch_no_args(self):
         # When there are no extra arguments we just have 0, the program name.
         exe, outfile = self.setup()
@@ -24,7 +27,7 @@ def test_process_launch_no_args(self):
         self.runCmd("continue")
 
         stdio_log = lldbutil.read_file_on_target(self, outfile)
-        self.assertEqual(
+        self._assert_stdio_log_matches(
             dedent(
                 """\
             Got 1 argument(s).
@@ -44,7 +47,7 @@ def test_process_launch_command_args(self):
         self.runCmd("continue")
 
         stdio_log = lldbutil.read_file_on_target(self, outfile)
-        self.assertEqual(
+        self._assert_stdio_log_matches(
             dedent(
                 """\
             Got 4 argument(s).
@@ -67,7 +70,7 @@ def test_process_launch_target_args(self):
         self.runCmd("continue")
 
         stdio_log = lldbutil.read_file_on_target(self, outfile)
-        self.assertEqual(
+        self._assert_stdio_log_matches(
             dedent(
                 """\
             Got 3 argument(s).
diff --git a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_basic.py b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_basic.py
index 93ae5d05e9d6c..437a9812b51ee 100644
--- a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_basic.py
+++ b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_basic.py
@@ -20,4 +20,8 @@ def test(self):
         output = self.get_stdout()
         self.assertTrue(output and len(output) > 0, "expect program output")
         lines = output.splitlines()
-        self.assertIn(program, lines[0], "make sure program path is in first argument")
+        self.assertIn(
+            program.replace("\\", "/"),
+            lines[0],
+            "make sure program path is in first argument",
+        )
diff --git a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_stdio_redirection.py b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_stdio_redirection.py
index 81501702624be..1376e964b97e4 100644
--- a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_stdio_redirection.py
+++ b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_stdio_redirection.py
@@ -20,5 +20,7 @@ def test(self):
             self.verify_process_exited()
             lines = f.readlines()
             self.assertIn(
-                program, lines[0], "make sure program path is in first argument"
+                program.replace("\\", "/"),
+                lines[0],
+                "make sure program path is in first argument",
             )

``````````

</details>


https://github.com/llvm/llvm-project/pull/197942


More information about the lldb-commits mailing list