[Lldb-commits] [lldb] [lldb] Fix and re-enable TestUseSourceCache.py (PR #111237)
Emre Kultursay via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 8 17:57:38 PDT 2024
emrekultursay wrote:
OK, I figured the problem. In the test, we call `os.removeFile()` which does not actually represent the real end-user use-case (which is to edit the file and save it).
Empirically, on Windows 11, I can verify that when LLDB mmaps these large files, then:
1. I can append to the file from Python (mode="a")
2. I can delete the file from Python (what the current test is doing)
3. I cannot delete the file from File Explorer => says lldb.exe is using the file
4. I cannot overwrite the file from Python (mode="w")
5. I cannot overwrite/save the file from Notepad++
6. I can overwrite/save the file from vi.
I am guessing that there are different mechanisms for deleting/editing/saving, and different editors/tools use different approaches.
To make the test more representative, I replaced the `removeFile()` method with the following
```
def overwriteFile(self, src):
"""Write to file and return true iff file was successfully written."""
try:
f = open(src, "w")
f.writelines(["// hello world\n"])
return True
except Exception:
return False
https://github.com/llvm/llvm-project/pull/111237
More information about the lldb-commits
mailing list