[Lldb-commits] [lldb] [lldb][tests] Fix FS timing issue in `TestRerunAndExprDylib`. (PR #205116)

Ingo Müller via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 22 07:51:11 PDT 2026


https://github.com/ingomueller-net created https://github.com/llvm/llvm-project/pull/205116

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.

>From dbba24e9b8fdcac9d09f7a1deb070a7cb7f291fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ingo=20M=C3=BCller?= <ingomueller at google.com>
Date: Mon, 22 Jun 2026 16:44:15 +0200
Subject: [PATCH] [lldb][tests] Fix FS timing issue in `TestRerunAndExprDylib`.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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.

Signed-off-by: Ingo Müller <ingomueller at google.com>
---
 .../rerun_and_expr_dylib/TestRerunAndExprDylib.py     | 11 +++++++++++
 1 file changed, 11 insertions(+)

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"))



More information about the lldb-commits mailing list