Line coverage (TZ 3.5)
Targets: compiler/ >= 85 %, runtime/ >= 80 % of the lines, measured by unit tests + conformance (stages <= 3).
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 theoxldriver are instrumented. - Unit phase:
ctest -j2, one.profrawper process. Conformance phase:run_conformance.py --stage 3withOXL_LINKERpointing at a wrapper that adds-fprofile-instr-generate, so each compiled OxL program dumps the counters of the instrumentedliboxlrt.a. Profiles of this phase use the pooled nameconf-%4m.profraw: counters of one binary are merged into at most 4 files at exit instead of one 4 MB file peroxlinvocation (this removed the hour-long merge and gigabytes of profiles of the first version; using the pooled name in the parallel gtest binaries crashedtest_codegenonce, 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).--checkexits 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.
| Area | Lines | Covered | % |
|---|---|---|---|
| compiler total | 43402 | 40046 | 92.27 % |
| compiler/src/ast | 2151 | 2072 | 96.33 % |
| compiler/src/basic | 180 | 166 | 92.22 % |
| compiler/src/codegen | 12908 | 11963 | 92.68 % |
| compiler/src/driver | 1173 | 1040 | 88.66 % |
| compiler/src/format | 697 | 678 | 97.27 % |
| compiler/src/lex | 1304 | 1286 | 98.62 % |
| compiler/src/lsp | 4027 | 3674 | 91.23 % |
| compiler/src/parse | 4518 | 4411 | 97.63 % |
| compiler/src/sema | 16444 | 14756 | 89.73 % |
| runtime total | 14994 | 13628 | 90.89 % |
| runtime/src (top level: str, list, map, ser_*, fmt, ...) | 4085 | 3721 | 91.09 % |
| runtime/src/config | 1056 | 1020 | 96.59 % |
| runtime/src/grpc | 1734 | 1661 | 95.79 % |
| runtime/src/http2 | 1299 | 1260 | 97.00 % |
| runtime/src/net | 1849 | 1672 | 90.43 % |
| runtime/src/obs | 194 | 189 | 97.42 % |
| runtime/src/rpc | 1149 | 648 | 56.40 % |
| runtime/src/sched | 2346 | 2229 | 95.01 % |
| runtime/src/text | 138 | 126 | 91.30 % |
| runtime/src/timelib | 1144 | 1102 | 96.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