Skip to content

test(cov): raise core line coverage to ≥95% - #50

Merged
esrrhs merged 5 commits into
masterfrom
test/core-coverage-95
Nov 4, 2026
Merged

esrrhs merged 5 commits into
masterfrom
test/core-coverage-95

Conversation

@esrrhs

@esrrhs esrrhs commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Bring core line coverage from 94.6% → 95.8% (12234/12770), with c_gen.cpp included (95.14% on that file alone).
  • Prior baseline on this effort: 92.6% (pre WIP) / 94.6% (tip before this commit).
  • Prefer tests over production changes: expose SemanticAnalysis::CollectReturnsForBlock for direct coverage of the return-walk helper; add focused GTest + Lua cases for interp runtime/vm_ops edges, VarToVi/ViToVar bridges, TCC libraries config path, and file-level literals / empty body / dynamic for-step errors.

Reproduce (local, USE_COV=ON)

# from repo root, after building build-cov with USE_COV=ON
find build-cov -name '*.gcda' -delete
python3 tools/run_tests.py --build-dir build-cov -j $(nproc) --filter='-*redis*:*mysql.integration*'
lcov --capture --directory build-cov/src --directory build-cov/test --directory build-cov/cmd \
  --ignore-errors inconsistent,mismatch,corrupt,gcov,source,count -o coverage.info
lcov --extract coverage.info \
  '*/src/compile/*' '*/src/jit/*' '*/src/interp/*' '*/src/state/*' '*/src/var/*' '*/src/util/*' \
  --ignore-errors inconsistent,mismatch,unused -o coverage_core.info
lcov --summary coverage_core.info --ignore-errors inconsistent,mismatch

Tip: e50b569 on test/core-coverage-95. Do not merge until reviewed.

Test plan

  • unit_tests --gtest_filter='core_cov_gaps.*' (18/18 pass)
  • Parallel filtered suite (one unrelated flaky/pre-existing common.c_runtime_cov_matches_kCRuntimeHeader failure on one shard; re-run alone passes)
  • Core summary ≥95% with c_gen.cpp present in coverage_core.info

Add focused GTest/Lua cases for var/state/logging and math inline paths;
extend math builtin fast-paths (fmod/ldexp/type/tointeger/ult) used by those tests.
Expose CollectReturnsForBlock for direct unit coverage of return-walk
paths; add focused GTest/Lua cases for interp runtime/vm_ops edges,
VarToVi/ViToVar bridges, TCC library config, and file-level literals.
Measured locally: 94.6% -> 95.8% (12234/12770) with c_gen.cpp included.
Replace POSIX setenv/unsetenv with a portable helper so MinGW CI
builds test_core_cov_gaps.cpp; use a nonexistent CC for the failure path.
@codecov-commenter

codecov-commenter commented Nov 3, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.75%. Comparing base (6331a7c) to head (149f1a9).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #50      +/-   ##
==========================================
+ Coverage   88.49%   89.75%   +1.25%     
==========================================
  Files         125      125              
  Lines       27211    27231      +20     
==========================================
+ Hits        24081    24441     +360     
+ Misses       3130     2790     -340     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Move coverage-gap tests from test_core_cov_gaps.cpp into existing
module suites (common, syntax_tree, string, math, log, jitter, util,
native, var, runtime) and delete the catch-all file.
@esrrhs
esrrhs merged commit 6f54d8d into master Nov 4, 2026
9 checks passed
@esrrhs
esrrhs deleted the test/core-coverage-95 branch November 4, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants