[Lldb-commits] [lldb] f8865aa - [lldb] Fix tests to resolve symlinks when checking paths (#132053)

via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 21 09:02:30 PDT 2025


Author: David Peixotto
Date: 2025-03-21T09:02:27-07:00
New Revision: f8865aa876a663a26d0b9ce5d26c9d6df6b9d18f

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

LOG: [lldb] Fix tests to resolve symlinks when checking paths (#132053)

The inferior used in the process launch test prints out its working
directory using the `getcwd` function, which is not allowed to return
symbolic links in the path components. When testing against the output
from `getcwd` we should resolve the full path to match the expected
output.

The source manager test sets a breakpoint on a main-copy.c file that is
copied into the build output directory. The source manager resolves this
path to its real location. When testing the output from the source cache
we need to resolve the expected path in the test to remove symlinks.

Added: 
    

Modified: 
    lldb/test/API/commands/process/launch/TestProcessLaunch.py
    lldb/test/API/source-manager/TestSourceManager.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/commands/process/launch/TestProcessLaunch.py b/lldb/test/API/commands/process/launch/TestProcessLaunch.py
index 2d23c0a48960e..92d0c468741e5 100644
--- a/lldb/test/API/commands/process/launch/TestProcessLaunch.py
+++ b/lldb/test/API/commands/process/launch/TestProcessLaunch.py
@@ -220,7 +220,7 @@ def test_target_launch_working_dir_prop(self):
         mywd = "my_working_dir"
         out_file_name = "my_working_dir_test.out"
 
-        my_working_dir_path = self.getBuildArtifact(mywd)
+        my_working_dir_path = Path(self.getBuildArtifact(mywd)).resolve()
         lldbutil.mkdir_p(my_working_dir_path)
         out_file_path = os.path.join(my_working_dir_path, out_file_name)
         another_working_dir_path = Path(

diff  --git a/lldb/test/API/source-manager/TestSourceManager.py b/lldb/test/API/source-manager/TestSourceManager.py
index eca0dd5e6159f..3500dded815b9 100644
--- a/lldb/test/API/source-manager/TestSourceManager.py
+++ b/lldb/test/API/source-manager/TestSourceManager.py
@@ -35,7 +35,7 @@ def setUp(self):
         # Call super's setUp().
         TestBase.setUp(self)
         # Find the line number to break inside main().
-        self.file = self.getBuildArtifact("main-copy.c")
+        self.file = os.path.realpath(self.getBuildArtifact("main-copy.c"))
         self.line = line_number("main.c", "// Set break point at this line.")
 
     def modify_content(self):


        


More information about the lldb-commits mailing list