Skip to content

Integration tests - #1

Merged
iTechMedic merged 6 commits into
mainfrom
integration-tests
Jul 21, 2026
Merged

Integration tests#1
iTechMedic merged 6 commits into
mainfrom
integration-tests

Conversation

@iTechMedic

Copy link
Copy Markdown
Owner

No description provided.

iTechMedic and others added 6 commits July 19, 2026 17:23
Compiles the real usbcdgadget sources (command handlers, BOT state
machine, Update() chunked reads) plus the real cueparser for the build
machine against thin stub Circle headers, and drives the gadget exactly
like a USB host: CBW in via OnTransferComplete(), data phases and CSW
captured from BeginTransfer(), Update() pumped for chunked reads.

34 tests lock in wire-level behavior real hosts depend on, including
every Win98-derived fix from the 3.2.x line: medium type per disc
(issue danifunker#164), MODE SENSE(10) pad-to-allocation-length, legacy CDB[9]
session-info encoding, CSW data residue on short responses, STALL
before failing CSW, unit attention gating, READ(10) batching for both
USB speeds, and the full MCICDA analog audio sequence including a
byte-exact MODE SENSE page 0x0E response from the retail Win98 SE
golden trace.

Production sources needed two inert accommodations: the ARM cache
maintenance asm in tcdstate_update.cpp gained an explicit
'#elif AARCH == 32' so the host build compiles (device branches are
unchanged), and CUSBCDGadget grew one friend declaration.

Runs in CI on ubuntu-latest via .github/workflows/host-tests.yml on
any push/PR touching the gadget, cueparser, discimage, or the tests.

Found while building the bench: constructing CUSBCDGadget with a
device pointer makes SetDevice() delete the device it was just given
and keep using the freed pointer. Production always constructs with
nullptr (CDROMService::Initialize), so the path is dormant; the bench
mirrors production. Worth removing the constructor parameter later.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R3BZWQ8DajGvxGtf6BmCYb
macOS's libc++ pulls string.h in transitively, GNU's libstdc++ does not,
so scsi_toolbox.cpp failed to find memcpy in CI. Mirror the device,
where these arrive through Circle headers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R3BZWQ8DajGvxGtf6BmCYb
…erage

Move the host-compiled SCSI/BOT regression suite from test/host into
integration-tests/{harness,test-suite} (per Dani's single-folder request)
and extend it to drive the real disc-image readers against real files.

What is new:
* FatFs host seam (harness/fatfs_host.cpp) plus a FatFsOptimizer stub
  (harness/discimage_host.cpp) so the real cuebinfile/chdfile readers
  compile and run on the host over stdio, with no reader logic reimplemented.
* Real-image tests (test-suite/test_realimages.cpp): the tracked ISO, a real
  FreeDOS ISO9660 + Joliet disc built from genuine FreeDOS 1.3 GPL files,
  synthetic and committed CUE/BIN pairs (audio and mixed mode) with byte
  exact reads across the 2048 to 2352 track boundary, cue sheets loaded off
  the filesystem through the FatFs shim, and a chdman built mixed CHD whose
  data and audio tracks decode byte exact through real libchdr.
* Test fixtures under integration-tests/testdata (all free to redistribute:
  FreeDOS GPL plus generated content), decompressed by the Makefile at build.
* Stub accuracy and coverage fixes from an independent review: endpoint
  transfer/direction enums aligned to Circle, stronger ISO/mixed/CHD oracles.
* CI (host-tests.yml) updated for the new paths and a WITH_CHD run.

Host-only test infrastructure; no firmware behavior changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R3BZWQ8DajGvxGtf6BmCYb
Add a real game data CD (testdata/shareware.iso.gz, volume id SHAREWARE)
and a whole-disc readback test. The reader pulls every byte of the ~3.5 MB
disc through the real cuebinfile path in an odd-sized chunk (unaligned to the
cache window, so refills and cross-window reads are exercised) and compares
it byte for byte against the raw file. This stresses a real ISO9660 + Joliet
filesystem holding multi-megabyte files spanning many sectors.

Contents, both cleared for free redistribution and unmodified:
* Descent shareware v1.2 (Parallax Software / Interplay), the freely
  distributable shareware release as its original installer package.
* SkyRoads (Bluemoon Interactive), developer released freeware whose own
  readme grants free redistribution as an intact single unit.

Provenance and licensing are documented on the disc (PROVENANCE.TXT) and in
testdata/README-testdata.md. This fixture is isolated in its own commit so it
can be dropped if a fully third-party-copyright-free test set is preferred.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R3BZWQ8DajGvxGtf6BmCYb
The WITH_CHD step compiles the vendored libchdr, which lives in a git
submodule (addon/libchdr-src). actions/checkout does not fetch submodules by
default, so the runner was missing libchdr/chd.h and the CHD build failed.
Fetch just that submodule, scoped to its path so the large circle-stdlib
submodule is not cloned (the host tests do not need it).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R3BZWQ8DajGvxGtf6BmCYb
The WITH_CHD build links the vendored zstd. On x86-64 zstd enables an
assembly Huffman decode fast-loop (huf_decompress_amd64.S) that the Makefile
does not assemble, so the link failed with undefined references to
HUF_decompress4X{1,2}_usingDTable_internal_fast_asm_loop. Define
ZSTD_DISABLE_ASM so zstd uses its equivalent portable C decode path. This did
not surface on Apple Silicon, where that assembly path is off already.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R3BZWQ8DajGvxGtf6BmCYb
@iTechMedic
iTechMedic merged commit 646ce06 into main Jul 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant