Skip to content

Commit f8865aa

Browse files
authored
[lldb] Fix tests to resolve symlinks when checking paths (llvm#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.
1 parent 954a3de commit f8865aa

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lldb/test/API/commands/process/launch/TestProcessLaunch.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def test_target_launch_working_dir_prop(self):
220220
mywd = "my_working_dir"
221221
out_file_name = "my_working_dir_test.out"
222222

223-
my_working_dir_path = self.getBuildArtifact(mywd)
223+
my_working_dir_path = Path(self.getBuildArtifact(mywd)).resolve()
224224
lldbutil.mkdir_p(my_working_dir_path)
225225
out_file_path = os.path.join(my_working_dir_path, out_file_name)
226226
another_working_dir_path = Path(

lldb/test/API/source-manager/TestSourceManager.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def setUp(self):
3535
# Call super's setUp().
3636
TestBase.setUp(self)
3737
# Find the line number to break inside main().
38-
self.file = self.getBuildArtifact("main-copy.c")
38+
self.file = os.path.realpath(self.getBuildArtifact("main-copy.c"))
3939
self.line = line_number("main.c", "// Set break point at this line.")
4040

4141
def modify_content(self):

0 commit comments

Comments
 (0)