[Lldb-commits] [lldb] [lldb][tests] Fix FS timing issue in `TestRerunAndExprDylib`. (PR #205116)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Jun 22 07:52:10 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Ingo Müller (ingomueller-net)
<details>
<summary>Changes</summary>
This PR fixes a timing issue that made `TestRerunAndExprDylib` fail with a small probability. The test rebuilds a library; however, the build and the re-build may fall into the same timestamp if the underlying filesystem only has second granularity such that the rebuild isn't actually triggered. If that happens, the test fails.
The fix consists in artifically aging the artifacts from the first build, i.e., setting their timestamps 10 seconds into the past.
This issue exists for at least six months, possible since the tests exists; I was not able to test older versions. However, we have recently seen frequent failures, probably due to some change in our underlying testing infrastructure.
---
Full diff: https://github.com/llvm/llvm-project/pull/205116.diff
1 Files Affected:
- (modified) lldb/test/API/functionalities/rerun_and_expr_dylib/TestRerunAndExprDylib.py (+11)
``````````diff
diff --git a/lldb/test/API/functionalities/rerun_and_expr_dylib/TestRerunAndExprDylib.py b/lldb/test/API/functionalities/rerun_and_expr_dylib/TestRerunAndExprDylib.py
index af413642632b9..acfa0f6a4d961 100644
--- a/lldb/test/API/functionalities/rerun_and_expr_dylib/TestRerunAndExprDylib.py
+++ b/lldb/test/API/functionalities/rerun_and_expr_dylib/TestRerunAndExprDylib.py
@@ -4,6 +4,9 @@
TypeSystems tied to that process.
"""
+import os
+import time
+
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
@@ -72,6 +75,14 @@ def test(self):
}
)
+ # Age the build artifacts to 10 seconds in the past so that the rebuilt
+ # library is guaranteed to have a newer modification time on filesystems
+ # with 1s resolution.
+ old_mtime = time.time() - 10
+ for artifact in [FULL_DYLIB_NAME, "a.out"]:
+ fpath = self.getBuildArtifact(artifact)
+ os.utime(fpath, (old_mtime, old_mtime))
+
exe = self.getBuildArtifact("a.out")
target = self.dbg.CreateTarget(exe)
target.BreakpointCreateBySourceRegex("dlclose", lldb.SBFileSpec("main.cpp"))
``````````
</details>
https://github.com/llvm/llvm-project/pull/205116
More information about the lldb-commits
mailing list