test framework phase 1: compile-time registry + El-side runner with per-test timing #133
Reference in New Issue
Block a user
Delete Branch "wt/soul-runtime-reconcile"
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?
Phase 1 of the El test framework (DESIGN.md)
Replaces the hardcoded test harness
main()with a compile-time registry and moves all reporting into an El-side runner.Why
The old harness inlined direct calls into
main()and counted assertions in two globals (__el_pass/__el_fail). That shape cannot report which test failed, how long any test took, or whether a test ran at all — registration paired a string to a function name by hand, so a typo reported success for a test that never executed.It also had no timing. That is why a 3.58s test file sat in the suite unnoticed, and why the compiler's quadratic went unmeasured for months.
What changed
test { }blocks lower to a static__el_registry[]table. Discovery strictly precedes execution — the precondition for--list, filtering, sharding and per-test reporting in later phases.__el_reg_count/name/invoke/last_ns/msg/asserts). This is the entire seam between generated C and El.CLOCK_MONOTONICimmediately around the call, so no El call overhead lands in the measurement.lang/runtime/eltest.el). Structured NDJSON events are the source of truth; human output renders from the same fields. We do not parse human output back into structure (Go'stest2jsonmistake).Verification
Self-hosting fixpoint holds — gen2 and gen3 byte-identical (367,901 bytes).
6 of 11 suites now run and report per-test timing (
test_compiler82 tests,test_string27,test_math13,test_text12,test_core10,test_env9).The other 5 fail to COMPILE — and fail identically under the committed compiler. Pre-existing breakage (
fs_list_json,state_has,assert_trueundeclared), surfaced for the first time because nothing previously reported suite-level state. Not addressed here.Deliberately not in this PR
runtime/test.elis not deleted. The end state is delete-not-shim, but 10 files (lang/tests/suite/src/*,lang/swarm/tests/*) still use its API. That is the Phase 5 migration PR.Design update
DESIGN.md §6.5 corrected:
expect allocs O(n)must fit count AND bytes and fail if either exceeds the declared curve. A quadratic accumulator's allocation count is exactly linear — only bytes reveal it (ratios 3.94/3.97/3.99 → 4.0). That is elc's own defect shape.