[Lldb-commits] [lldb] [lldb][test] Rename session logs through their extended-length path (PR #226976)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Sep 28 06:00:34 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Charles Zablit (charles-zablit)
<details>
<summary>Changes</summary>
On Windows, renaming `Incomplete.log` to `<Prefix>_<test-name>.log` makes the destination longer than the source, so it can cross `MAX_PATH` where the source did not. `os.rename` then fails with `WinError 3` on a file that exists, and a test that behaved correctly is reported as unresolved:
```
FileNotFoundError: [WinError 3] The system cannot find the path specified:
'...\Incomplete.log' -> '...\ExpectedFailure_test_implementation_only_import_main_executable_resilient_no_library_module_dwarf_clang_swift.log'
```
Address the destination through `lldbutil.get_extended_windows_path`, including the existence check and removal above it.
---
Full diff: https://github.com/llvm/llvm-project/pull/226976.diff
1 Files Affected:
- (modified) lldb/packages/Python/lldbsuite/test/lldbtest.py (+4-3)
``````````diff
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 1f4329147252e..0c577d1aea73f 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1438,17 +1438,18 @@ def dumpSessionInfo(self):
for src in self.log_files:
if os.path.isfile(src):
dst = src.replace(src_log_basename, dst_log_basename)
- if os.name == "nt" and os.path.isfile(dst):
+ long_dst = lldbutil.get_extended_windows_path(dst)
+ if os.name == "nt" and os.path.isfile(long_dst):
# On Windows, renaming a -> b will throw an exception if
# b exists. On non-Windows platforms it silently
# replaces the destination. Ultimately this means that
# atomic renames are not guaranteed to be possible on
# Windows, but we need this to work anyway, so just
# remove the destination first if it already exists.
- remove_file(dst)
+ remove_file(long_dst)
lldbutil.mkdir_p(os.path.dirname(dst))
- os.rename(src, dst)
+ os.rename(lldbutil.get_extended_windows_path(src), long_dst)
files.append(dst)
if files:
print(
``````````
</details>
https://github.com/llvm/llvm-project/pull/226976
More information about the lldb-commits
mailing list