Add unit tests across all core packages, fix boot catalog section parsing - #15
Merged
Conversation
Replace the hardcoded isocreate scaffolding with a real command line tool: volume and preparer identity, Rock Ridge / Joliet / interchange level toggles, BIOS and EFI El Torito boot entries (with boot info table for the BIOS loader), and isohybrid MBR/GPT flags, following the same usage-package conventions as isoextract. Add a GitHub Actions CI workflow: gofmt gate, build, vet, race-enabled tests, and a coverage summary. The workflow installs xorriso, fdisk, and parted so the interoperability tests exercise their verification paths instead of skipping. Rewrite the README to reflect current functionality: library examples for create/modify/boot flows, CLI usage, and an honest format support matrix (reads and writes for ISO 9660, Rock Ridge, Joliet, El Torito, and hybrid layouts; read-only for multi-extent files and UDF).
…sing Add direct unit tests for packages previously covered only incidentally through the end-to-end suite: - extensions: full Rock Ridge marshal/unmarshal round-trip, symlink target variants (absolute, relative, dot components, root), NM splitting and reassembly for names beyond one entry, long-form TF parsing, PosixMode/parseFileMode inversion across file types and special bits, SUSP entry binary shapes, unknown-entry tolerance, ST termination, and CE decoding - boot: catalog round-trips (single entry and multi-platform sections), validation entry checksum/key/truncation rejection, SetExtent load size semantics including the 16-bit saturation, boot image extraction, and >128 KiB size reporting - directory: record round-trips with system use data, flag bits, pad byte behavior, Joliet UCS-2 identifier decoding, error paths, best name and permission fallbacks - pathtable: record round-trips in both byte orders, endianness divergence, table build/reparse, error paths - systemarea: MBR round-trip and signature rejection, CHS saturation, GPT header/entry CRC verification, backup header cross-references, build errors, and reproducible output - encoding: both-byte-order mismatch detection, recording date/time bounds and timezone round-trips, UCS-2 encode/decode - filesystem: entry content/hash/extract behavior, multi-extent reader single-segment and negative-offset cases - validation: character sets and interchange level rules - iso9660: created-image getters (historically nil-panic territory), Joliet-preference getter branches, layout objects, pristine passthrough save, mutation error paths, local directory import with symlinks and permissions The new section-entry tests exposed a real parser bug: a non-bootable section entry (boot indicator 0x00) was treated as end-of-catalog even when its section header promised more entries, dropping the rest of the catalog. Entries promised by a header are now consumed before the end-of-catalog check applies. Cross-package coverage rises from 65.7% to 74.3%, with the remainder concentrated in trivial accessors and logging shims.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The coverage push: direct unit tests for every load-bearing package that was previously exercised only transitively through the end-to-end suite. Cross-package coverage: 65.7% → 74.3%, with the remainder concentrated in trivial accessors (Type/Name/Description getters) and logging shims.
These are behavioral tests, not line-fillers: round-trips assert exact byte layouts and value recovery, error paths assert rejection of corrupt input, and semantic contracts (load-size saturation, CHS limits, GPT CRCs, deterministic output) are pinned.
Bug found by the new tests
A non-bootable El Torito section entry (boot indicator 0x00) was parsed as end-of-catalog even when its section header promised more entries — silently dropping the rest of a multi-boot catalog. Entries promised by a header are now consumed before the end-of-catalog check applies. (0x00 is ambiguous by spec: it means both "not bootable" and "empty catalog space"; only the header count disambiguates.)
Test additions by package
Test plan
go test -race -count=1 ./...