From dc1224c03a1d560128a4e5837c1a053133da9ea5 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 10 Aug 2026 03:31:17 -0700 Subject: [PATCH] Stop the sleep lock budget assertion from flaking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A 1500ms budget plus the one 100ms poll interval the trailing sleep can overshoot is exactly 1600ms, which was the bound — but the test measures a whole process around that, so startup pushed real runs to 1602ms. Carry another interval. Two intervals of overshoot, the regression this guards, still trips it. Co-Authored-By: Claude Opus 5 (1M context) --- test/shell.d/sleep-lock-test.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/shell.d/sleep-lock-test.sh b/test/shell.d/sleep-lock-test.sh index c9385946..519f2350 100755 --- a/test/shell.d/sleep-lock-test.sh +++ b/test/shell.d/sleep-lock-test.sh @@ -128,7 +128,12 @@ pass "sleep lock reports failure when the session never secures" # The contract is the budget plus at most one poll interval, since the pause # between polls is not itself clipped. Derived budgets hold back a full second # for logind, so that overshoot is always well inside the reserve. -(( elapsed_us <= 1600000 )) || +# +# 1500ms budget + a 100ms interval is 1600ms of script time, and this measures a +# whole process around it, so the bound carries another interval for startup — +# without it the assertion sits exactly on the worst case and flakes. Two +# intervals of overshoot, the regression worth catching, is still 1800ms. +(( elapsed_us <= 1700000 )) || fail "sleep lock gives up within its budget" "elapsed: ${elapsed_us}us" pass "sleep lock gives up within its budget"