OxL Reference

Line coverage (TZ 3.5)

Targets: compiler/ >= 85 %, runtime/ >= 80 % of the lines, measured by unit tests + conformance (stages <= 3).

sh
nohup scripts/coverage.sh --files --check >cov.log 2>&1 &   # build-cov/, ~1 h at -j2 (25 min build, 20 unit, 15 conformance)
scripts/coverage.sh --no-conformance                         # unit tests only
scripts/coverage.sh --no-build --stage 2 --filter 'ser'      # quick re-run on an existing build-cov/

How it works (scripts/coverage.sh, scripts/cov_summary.py)#

  • Builds into build-cov/ with -fprofile-instr-generate -fcoverage-mapping (OXL_COVERAGE=ON, own build dir, -j$OXL_COV_JOBS, default 2); every gtest binary and the oxl driver are instrumented.
  • Unit phase: ctest -j2, one .profraw per process. Conformance phase: run_conformance.py --stage 3 with OXL_LINKER pointing at a wrapper that adds -fprofile-instr-generate, so each compiled OxL program dumps the counters of the instrumented liboxlrt.a. Profiles of this phase use the pooled name conf-%4m.profraw: counters of one binary are merged into at most 4 files at exit instead of one 4 MB file per oxl invocation (this removed the hour-long merge and gigabytes of profiles of the first version; using the pooled name in the parallel gtest binaries crashed test_codegen once, so the unit phase keeps one file per process).
  • Merge: batches of 200 files with llvm-profdata merge -sparse -failure-mode=all (a truncated profile of a killed or timed-out process is skipped with a warning instead of failing the whole merge), then the parts are merged.
  • llvm-cov export -summary-only, aggregated per directory (tests/, tools/ and build dirs excluded). --check exits 1 when a target is missed (used by the nightly job). Every phase prints a time stamp.
  • Programs that end via abort / _exit / a signal write no profile.

Results#

Measured 2026-10-30 on the lead branch of that day plus this task (clang 18, llvm-cov 18, Debug), unit tests + conformance stage <= 3 (1083 passing programs). test_codegen crashed in that run (see above) and therefore contributed no counters, so these numbers are a lower bound.

AreaLinesCovered%
compiler total434024004692.27 %
compiler/src/ast2151207296.33 %
compiler/src/basic18016692.22 %
compiler/src/codegen129081196392.68 %
compiler/src/driver1173104088.66 %
compiler/src/format69767897.27 %
compiler/src/lex1304128698.62 %
compiler/src/lsp4027367491.23 %
compiler/src/parse4518441197.63 %
compiler/src/sema164441475689.73 %
runtime total149941362890.89 %
runtime/src (top level: str, list, map, ser_*, fmt, ...)4085372191.09 %
runtime/src/config1056102096.59 %
runtime/src/grpc1734166195.79 %
runtime/src/http21299126097.00 %
runtime/src/net1849167290.43 %
runtime/src/obs19418997.42 %
runtime/src/rpc114964856.40 %
runtime/src/sched2346222995.01 %
runtime/src/text13812691.30 %
runtime/src/timelib1144110296.33 %

Both targets are met. (Wave-0 partial numbers were 90.6 % / 88.3 %.)

Weak spots#

runtime/src/rpc is the only runtime area below 80 % (rpc/net.cpp 14 %, rpc/net_stream.cpp 17 %: the network transport of rpc, exercised only by multi-node tests that do not run in this setup). Largest uncovered files elsewhere: compiler/src/sema/Reflect.cpp (344 lines), runtime/src/ser_json.cpp (210), codegen/CGExpr.cpp, codegen/CGIntrinsicsStd.cpp, lsp/AstNodes.cpp, sema/CheckExpr.cpp. scripts/coverage.sh --files lists the current top 40.

Tests added earlier (task 1)#

tests/unit/sema/consteval_test.cpp, operators_test.cpp, tests/unit/parse/ast_visit_test.cpp, tests/unit/runtime/memory_ffi_test.cpp, tests/unit/codegen/conformance_corpus_test.cpp (in-process conformance corpus), tests/unit/compile_util.h fix.

Source: docs/coverage.md

OxL 1.0.0-beta · Documentation version 1.0.0-beta© OxwaldLink · generated from the Standard, the std sources and the guides