Skip to content

Add unit tests across all core packages, fix boot catalog section parsing - #15

Merged
bgrewell merged 5 commits into
mainfrom
test/coverage
Aug 6, 2026
Merged

Add unit tests across all core packages, fix boot catalog section parsing#15
bgrewell merged 5 commits into
mainfrom
test/coverage

Conversation

@bgrewell

@bgrewell bgrewell commented Aug 6, 2026

Copy link
Copy Markdown
Owner

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

  • extensions: RR marshal/unmarshal round-trips, symlink target variants, NM continuation splitting/reassembly, long-form TF, PosixMode↔parseFileMode inversion, SUSP entry shapes, unknown-entry tolerance + ST termination, CE decoding
  • boot: catalog round-trips (single + multi-platform sections), validation-entry corruption rejection, SetExtent semantics incl. 16-bit saturation, ExtractBootImages, >128 KiB size reporting
  • directory: record round-trips with SU data, flags, padding, Joliet UCS-2 identifiers, error paths, RR name/permission fallbacks
  • pathtable: both byte orders, endianness divergence, build→reparse, error paths
  • systemarea: MBR round-trip/rejection, CHS saturation, GPT CRC verification, backup header cross-refs, reproducibility
  • encoding: both-byte-order mismatch detection, date/time bounds + timezone round-trips, UCS-2
  • filesystem: entry content/hashes/extract, multi-extent reader edges
  • validation: character sets, interchange levels
  • iso9660: created-image getters (the historical nil-panic minefield), Joliet-preference branches, pristine passthrough, mutation error paths, AddLocalDirectory with symlinks/permissions

Test plan

  • Full suite green including go test -race -count=1 ./...
  • gofmt/vet clean

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.
@bgrewell
bgrewell merged commit a706754 into main Aug 6, 2026
1 check passed
@bgrewell
bgrewell deleted the test/coverage branch August 6, 2026 14:27
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