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 ObjBuilder → emit_coff → bytes → read_coff → second
emit_coff against the readback. The harness asserts:
- Structural equivalence between the original
ObjBuilderand the readback (sections, symbols, relocations, groups all preserved modulo synthesized SECTION symbols and section-definition aux records — the asymmetry thatsrc/obj/coff/read.cdocuments). - 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:
- U (unit) — hand-built
ObjBuilderfixtures. Layer A. The current harness only carries U cases. - C (cases) — mingw-cross-built
.objfixtures. Layer B. The hosted UCRT smoke now covers one aarch64 llvm-mingw sysroot path; broader fixture coverage remains pending. - E (exec) — link + exec via configured Windows VMs, with Wine as a fallback when available.
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.