1 Commits

Author SHA1 Message Date
Kevin Bortis
79b2c0dff8 test: add Mode 2 CD read path regression tests
7 tests across two files covering three upstreamed Mode 2 bug fixes:

mode2_nocrc.cpp — fix/mode2-form2-nocrc-edc regression:
- NoCrcEdcBytesAreZero: Form 2 sectors with zero EDC read back with
  bytes 2348..2351 zeroed (not uninitialized). Uses poisoned buffer
  (0xCC fill) to detect missing memset.
- ValidEdcSurvivesRoundtrip: sanity check that valid-EDC sectors are
  not treated as NoCrc.
- MixedNoCrcAndValidEdcPerSector: alternating NoCrc/Ok sectors verify
  per-sector DDT suffix status tracking.

mode2_errored.cpp — fix/mode2-errored-suffix-read and
fix/mode2-form-detection-read regressions:
- ErroredForm2SuffixRestored: wrong EDC (0xDEADBEEF) survives roundtrip
  through the 4-byte suffix buffer for Form 2 errored sectors.
- ErroredForm1SuffixRestored: full 280-byte suffix (EDC+ECC) survives
  roundtrip for Form 1 errored sectors.
- MixedErroredForm1AndForm2: alternating forms in one track, verifying
  the DDT correctly dispatches per-sector.
- DisagreeingSubheaderUsesForm2: subheader copy 1 says Form 1, copy 2
  says Form 2 — verifies OR logic picks Form 2 and all 2324 bytes of
  user data are intact (old bug corrupted bytes 2072+).

All tests use programmatic fixtures via aaruf_create/write_sector_long
with crafted 2352-byte sectors — no external data files needed.
2026-04-02 07:56:21 +02:00