From 8ee24eb3b0ca11d4bd0b488bfb67a8c24434d71e Mon Sep 17 00:00:00 2001 From: Shane Date: Tue, 3 Nov 2026 10:36:51 +0000 Subject: [PATCH] Tests: allow 60 ms of slack in the audio catch-up checks - The checks allowed 30 ms above the target, which a busy CI runner can exceed - Use kSlackMs = 60 ms, the resync threshold in host.cpp - A queue still holding the 400 ms stall stays far above the bound, so the test still catches a regression --- tests/test_audio.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/test_audio.cpp b/tests/test_audio.cpp index b5c8d87..e092cd0 100644 --- a/tests/test_audio.cpp +++ b/tests/test_audio.cpp @@ -43,6 +43,12 @@ bool open(audio::HostOutput& out) { return true; } +// The controller lets the queue sit up to 60 ms above the target before it +// drops samples (kResyncMs in host.cpp), and a busy machine (a shared CI +// runner) can keep it there for a while, so that is the bound to check: a +// queue still holding the 400 ms stall would be far above it. +constexpr double kSlackMs = 60.0; + } // namespace TEST_CASE("after the device stalls, the sound catches up at once instead of running late") { @@ -51,7 +57,7 @@ TEST_CASE("after the device stalls, the sound catches up at once instead of runn play(out, 500ms); const double target = out.target_ms(); CHECK(target >= 30.0); - CHECK(out.queue_ms() < target + 30.0); + CHECK(out.queue_ms() < target + kSlackMs); // The device stops taking samples for a while (as while the system // switches to another device): the queue fills up. @@ -62,5 +68,5 @@ TEST_CASE("after the device stalls, the sound catches up at once instead of runn // faster, took about 20 seconds). play(out, 1000ms); CHECK(out.resyncs() >= 1); - CHECK(out.queue_ms() < target + 30.0); + CHECK(out.queue_ms() < target + kSlackMs); }