llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: John Harrison (ashgti) <details> <summary>Changes</summary> This decorator is trying to reference the file that is already deleted by the time the `nm` call is made. Moving the delete to `__del__` instead should fix this. --- Full diff: https://github.com/llvm/llvm-project/pull/176463.diff 2 Files Affected: - (modified) lldb/packages/Python/lldbsuite/support/temp_file.py (+11-3) - (modified) lldb/packages/Python/lldbsuite/test/decorators.py (+1) ``````````diff diff --git a/lldb/packages/Python/lldbsuite/support/temp_file.py b/lldb/packages/Python/lldbsuite/support/temp_file.py index a21e212d279d6..e28eaaef1379c 100644 --- a/lldb/packages/Python/lldbsuite/support/temp_file.py +++ b/lldb/packages/Python/lldbsuite/support/temp_file.py @@ -12,12 +12,20 @@ class OnDiskTempFile: def __init__(self, delete=True): self.path = None - def __enter__(self): + def __del__(self): + if self.path and os.path.exists(self.path): + os.remove(self.path) + + def _set_path(self): + if self.path: + return fd, path = tempfile.mkstemp() os.close(fd) self.path = path + + def __enter__(self): + self._set_path() return self def __exit__(self, exc_type, exc_val, exc_tb): - if os.path.exists(self.path): - os.remove(self.path) + pass diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index a7df9fe63badc..b1516bf214a87 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -1114,6 +1114,7 @@ def is_compiler_with_bounds_safety(): return skipTestIfFn(is_compiler_with_bounds_safety)(func) + def skipIfAsan(func): """Skip this test if the environment is set up to run LLDB *itself* under ASAN.""" return skipTestIfFn(is_running_under_asan)(func) `````````` </details> https://github.com/llvm/llvm-project/pull/176463 _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
