kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

test/coff — PE/COFF format roundtrip harness

Round-trip testing for emit_coff / read_coff against the x86_64-windows and aarch64-windows targets. Peer of test/elf/ and test/macho/.

Scope

Hand-built ObjBuilderemit_coff → bytes → read_coff → second emit_coff against the readback. The harness asserts:

  1. Structural equivalence between the original ObjBuilder and the readback (sections, symbols, relocations, groups all preserved modulo synthesized SECTION symbols and section-definition aux records — the asymmetry that src/obj/coff/read.c documents).
  2. Byte stability across emit_coff(read_coff(emit_coff(ob))) — the second emit must produce the exact bytes of the first.

Running

make test-coff

This builds build/test/kit-roundtrip-coff and runs the embedded unit cases. It also runs windows-ucrt-hosted-smoke.sh, which self-skips unless an llvm-mingw UCRT sysroot is available via KIT_SYSROOT, under build/llvm-mingw/*/ucrt, or under /tmp/llvm-mingw*. Windows VM execution is optional; see doc/WINDOWS.md.

Layers

CORPUS.md enumerates the cases worth covering, marked:

Layer A is sufficient to gate the wire encoder / decoder against each other. Layers B/C/D will catch cross-tool agreement and end-to-end runtime correctness once the surrounding infrastructure lands.

Pointer

See doc/WINDOWS.md for the UCRT sysroot provisioning and VM execution commands.