Skip to content

ci: report test coverage and enforce a minimum threshold - #44

Merged
SizzleUnrlsd merged 3 commits into
mainfrom
ci/19-coverage
Sep 30, 2026
Merged

SizzleUnrlsd merged 3 commits into
mainfrom
ci/19-coverage

Conversation

@SizzleUnrlsd

@SizzleUnrlsd SizzleUnrlsd commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add a Coverage workflow on Linux. It builds with --coverage -fprofile-update=atomic, runs the whole suite, then runs gcovr 8.6 on src/ and include/, and publishes a markdown summary to the job summary.
  • The job fails when line coverage drops below 88%, the value measured on this branch (--fail-under-line). The summary is still published when it fails. A comment next to the threshold records where it comes from, so it can be raised as coverage grows.
  • Atomic counters are required: with the default counters, the multithreaded tests corrupt them and gcovr aborts on negative hit counts (GCC bug 68080).
  • gcovr only searches the library, example and test objects, because CMake's compiler detection also leaves coverage data under build/CMakeFiles that gcov cannot resolve.

With the tests from #14 and #15 (and #17, #18), line coverage goes from 48.7% on main (llvm-cov) to 88.7% with GCC. What remains uncovered is mostly the defensive branches: EINTR and partial-write retries, the gmtime failure path, and the unreachable if (!started) branch in write_hex().

Stacked on #43.

Verification

  • CI on this branch (GCC 13, gcovr 8.6): lines 88.7% (525/592), functions 96.6% (57/59), branches 63.3%. The first run exposed the negative-hit problem, and the second one the provisional 90% threshold.
  • Locally (gcovr with llvm-cov gcov, AppleClang 17): lines 91.7%. --fail-under-line 90 exits with 0 and --fail-under-line 99 exits with 2.

Closes #19

@SizzleUnrlsd SizzleUnrlsd self-assigned this Sep 30, 2026
Base automatically changed from test/18-colors-pty to main September 30, 2026 06:11
@SizzleUnrlsd
SizzleUnrlsd merged commit 97dc5cc into main Sep 30, 2026
13 checks passed
@SizzleUnrlsd
SizzleUnrlsd deleted the ci/19-coverage branch September 30, 2026 06: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.

ci: report test coverage and enforce a minimum threshold

1 participant