test(ngs2): guard reported PCM input lifetime and late tail writes #19349

Merged
JJenkx merged 4 commits from upstream-pr/19349 into main 2026-11-13 09:04:21 +00:00
JJenkx commented 2026-11-13 05:03:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-11-13T05:03:35Z.


What

Add PCM lifetime regression coverage to both existing NGS2 PCM suites. For all six formats, mono/stereo, three input rates and three pitches (108 combinations per library), overwrite only bytes reported decoded after each render. Patch an unreported tail inside the same submitted block after the first render. Require exact samples against an immutable-prefix reference carrying the expected new tail, and require the changed tail to affect output against an unchanged-tail control.

This protects the ownership property discussed in #5548: callers can reuse reported bytes without hiding later writes to unreported input. It changes no production code, byte accounting or console decode policy. The case keeps playback active because VoiceGetState clears counters once a voice is empty. --reported-lifetime runs this matrix separately for focused diagnosis. The normal PCM suite includes it too.

Tested

Linux, GCC 16.2.1 Release; base e8b95881c391, head 060555b89ee0. Built ngs2_pcm_tests and ngs2_core_pcm_tests; both complete PCM suites pass, including 108 new cases each (0.13/0.15 s, no skips).

Private negative controls independently introduce (1) whole-block first-read snapshots and (2) decoded-byte accounting twice as far as the consumed cursor. Both controls fail the new isolated mode at the output/reference sample comparison in both libraries, four expected failures. Restoring main's production code returns both complete PCM suites to green. Conventions and whitespace pass. No game/audio, Windows, GPU, physical-console or performance result is claimed; repeat visibility and console granularity remain outside this test.

Verbose runs, control patches, regression patch, exact pins and manifest — SHA-256 89476a4f9853fb89c2fdc17060e279cb2f014b9a26f46c5c17c2eed284193c96; downloaded again and all 15 manifest members verified.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (CPU NGS2 tests)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5290369991 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19349). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-11-13T05:03:35Z. --- ### What Add PCM lifetime regression coverage to both existing NGS2 PCM suites. For all six formats, mono/stereo, three input rates and three pitches (108 combinations per library), overwrite only bytes reported decoded after each render. Patch an unreported tail inside the same submitted block after the first render. Require exact samples against an immutable-prefix reference carrying the expected new tail, and require the changed tail to affect output against an unchanged-tail control. This protects the ownership property discussed in #5548: callers can reuse reported bytes without hiding later writes to unreported input. It changes no production code, byte accounting or console decode policy. The case keeps playback active because `VoiceGetState` clears counters once a voice is empty. `--reported-lifetime` runs this matrix separately for focused diagnosis. The normal PCM suite includes it too. ### Tested Linux, GCC 16.2.1 Release; base `e8b95881c391`, head `060555b89ee0`. Built `ngs2_pcm_tests` and `ngs2_core_pcm_tests`; both complete PCM suites pass, including 108 new cases each (0.13/0.15 s, no skips). Private negative controls independently introduce (1) whole-block first-read snapshots and (2) decoded-byte accounting twice as far as the consumed cursor. Both controls fail the new isolated mode at the output/reference sample comparison in both libraries, four expected failures. Restoring main's production code returns both complete PCM suites to green. Conventions and whitespace pass. No game/audio, Windows, GPU, physical-console or performance result is claimed; repeat visibility and console granularity remain outside this test. [Verbose runs, control patches, regression patch, exact pins and manifest](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/ngs2-reported-pcm-lifetime-linux-20261113.tar.gz) — SHA-256 `89476a4f9853fb89c2fdc17060e279cb2f014b9a26f46c5c17c2eed284193c96`; downloaded again and all 15 manifest members verified. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (CPU NGS2 tests) - [x] AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!19349
No description provided.