Follow-up to #12: line coverage for the testing framework (bin/x test --coverage) #45
Labels
No labels
area:ci
area:docs
area:input
area:net
area:rendering
area:repo
area:stdlib
area:tooling
area:types
cleanup
dx
priority:high
priority:low
priority:medium
proposal
status:in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: workshopsoft/ludic#45
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to #12, which shipped the testing framework in
ea2c6ab:test "name" { … }blocks,expect/expect_eq/expect_nearassertions, a synthetic runner that prints per-test pass/fail + a== N passed, M failed ==summary and exits non-zero on failure.This tracks the one remaining acceptance item deliberately left out — the issue's own biggest lift: per-file line coverage.
Scope:
--coverageflag (default off) so ordinary builds — and the compiler's own self-compile — stay byte-identical and the C-free bootstrap fixpoint is untouched.bin/x test --coverage: aggregate the dumps into a clean per-file line-coverage report.Design note: keep the instrumentation flag-gated and additive so the fixpoint stays trivial to reason about (the same discipline used for panic/expect). Related: #12 (the shipped framework).
Shipped in
4985933.--coverageinstrumentation — the compiler now bumps a per-source-line hit counter at each emitted statement, gated behind a new--coverageflag (default off). Ordinary builds and the compiler's own self-compile stay byte-identical (verified: snake/testing/reflect IR unchanged without the flag), and the C-free bootstrap fixpoint is untouched (x reseed+x bootstrap-cfreereproduce the seed byte-for-byte).Runtime dump — a static line table plus a parallel hit-counter array are dumped at exit via an
atexithook (registered through an LLVM global constructor, so it fires regardless of program shape) to the file named by$LUDIC_COVERAGE(defaultludic.cov): aFILE <name>header then one<line> <hits>row per instrumented line.bin/x test --coverage— compiles the test specs with instrumentation, runs each into its own dump, and aggregates a per-file report naming the unreached lines:Docs + example —
examples/library/coverage.ludic(a spec whose tests deliberately miss one branch, which the report flags at line 33), the testing docs page, and a changeset. Full suite: 70/70 pass.This closes the last open acceptance item deliberately left out of #12.