Skip to content

Make audio device watchdog tests independent of scheduler delays - #2113

Open
thehobbit85 wants to merge 1 commit into
seedds:mainfrom
thehobbit85:codex/fix-audio-device-ci-clock
Open

thehobbit85 wants to merge 1 commit into
seedds:mainfrom
thehobbit85:codex/fix-audio-device-ci-clock

Conversation

@thehobbit85

Copy link
Copy Markdown
Contributor

The mocked audio-device test assumes a successful start without callbacks will stop the device within three wall-clock seconds. The watchdog deliberately restarts its timeout after a late wake, so that assumption fails when its thread is delayed. Delaying watchdog sleeps to 250 ms reproduces the blocked_start assertion reported by #948's sanitizer job on unchanged main. This demonstrates the fixture defect; the historical job has no scheduler trace establishing its exact delay pattern.

Extract the unchanged registry-tick body into au_watchdog_tick and drive it explicitly in the mocked-device fixture. Production retains its 50 ms loop, clock read under the registry lock, callback timeout, retries and statistics drain. Independent review verified that inlining the helper restores the entire previous production source, apart from whitespace and its new comment.

The test now checks twelve late wakes, the exact one-second no-callback boundary, and the state immediately before and at each retry deadline. It still exercises the real asynchronous start worker, callback hold/handoff, silent sink, suspend/resume, reset and close. The long handoff buffer is consumed through the callback before a separate 10 ms buffer checks real silent-sink release, keeping simulated watchdog time independent of PCM pacing. Existing waits and pointer assertions remain; there are no suppression or baseline changes.

Validation on Apple M2 Max, macOS 26.6, Xcode 27.2, Apple Clang 21, Python 3.14.6 and LLVM 23.1.4:

  • Final fixture: five normal, five ThreadSanitizer and five AddressSanitizer/UndefinedBehaviorSanitizer runs passed. Four isolated mutations are rejected: missing late-wake reset, late no-callback timeout, early retry and late retry.
  • Full host unit suite and the Super Mario Bros. Wonder (010015100B514000) Mac host rebuild passed. Final changed-file C lint has zero new findings; the production file has none.
  • Full C lint checks 274 sources: 224 findings against 223 baseline, solely the unchanged t_pso_archive.m nullable marker write already covered by t_pso_archive's cold-quit marker write is nil-safe: lint-c's clang-tidy ratchet is green on main again #2080. Full Python lint has 339 findings against 336 baseline, solely the unchanged dmsh_build.py name collision covered by Fix shader-tool lint and stale shader test fixtures #2111. Both files are byte-identical to this PR's base. Shared fixes remain separate.
  • The complete local graphics suite passed, including Metal tests. Python tool suite: 1,423 tests, with one inherited ABI-ratchet failure and 23 skips (the nvn_mtl.m unknown-kind ? collision covered by test_dmsh_abi's ratchet no longer counts "?": the unknown binding kind is also what log lines write for a name they do not have, and the third such placeholder in nvn_mtl.m fails the Tool tests on main (issue #1656) #1981); all 52 iOS unit tests passed. No shared fix is folded into this PR.
  • regress.py impact 6c676444..HEAD: zero direct or broad matches, four unaffected manifests and 149 unknown profiles. This is a mapping result, not gameplay evidence. A full regress.py check was attempted for Super Mario Odyssey, Breath of the Wild, Tears of the Kingdom, Pokémon Scarlet and Luigi's Mansion 3, covering Nintendo EPD, Game Freak and Next Level Games audio users; it stopped with exit 2 because REGRESS_ROOT and REGRESS_GAMES are not configured. No game shader rebuild, gameplay, device or performance validation is claimed; other games are unchecked.

Independent review found and resolved the real-buffer timing coupling, then reported no remaining blocking findings on the final diff. No player-facing audio behavior, shader-chain version, game profile or front-end contract changes.

@github-actions github-actions Bot added the host The Horizon host: SVCs, services, threads, memory (dm/host) label Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

host The Horizon host: SVCs, services, threads, memory (dm/host)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants