Stop the sleep lock budget assertion from flaking

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) <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-08-10 03:31:17 -07:00
co-authored by Claude Opus 5
parent f228c4d390
commit dc1224c03a
+6 -1
View File
@@ -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"