Skip to content

feat(ct,eunit): collect coverage on Windows and only when coverage is enabled - #21

Open
TrapsterDK wants to merge 1 commit into
bazelverse:mainfrom
TrapsterDK:windows-coverage
Open

TrapsterDK wants to merge 1 commit into
bazelverse:mainfrom
TrapsterDK:windows-coverage

Conversation

@TrapsterDK

@TrapsterDK TrapsterDK commented Nov 18, 2026 •

Copy link
Copy Markdown

Fixes #20

The bash scripts of ct_test and eunit start cover when the COVERAGE environment variable is set. They now also check ctx.configuration.coverage_enabled, which is rendered into the script as {coverage}. A stray COVERAGE in the environment no longer starts cover or calls coverdata_to_lcov, whose runfiles are only added when coverage is on.

The Windows scripts get the same cover steps as the bash ones:

  • eunit: when coverage is on, cover-compiles the app ebin dirs before eunit:test, exports cover data to COVERAGE_OUTPUT_FILE afterwards, then runs coverdata_to_lcov. The dirs and the output path are passed as -cover_dirs and -cover_out and read back with init:get_argument.
  • ct_test: writes a ct.cover.spec (incl_app, incl_dirs, export) into TEST_UNDECLARED_OUTPUTS_DIR, passes it with -cover, and runs coverdata_to_lcov after ct_run succeeds. Paths inside the spec use forward slashes. A failing ct_run still returns its exit code first.

Without coverage, the generated Windows scripts run the same commands as before.

Tests: the repo's CI is Linux only and has no coverage test, so there is none for this. I could not run the Windows scripts here (no Erlang on the machine).

Assisted by Claude.

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.

ct_test and eunit: no coverage on Windows, COVERAGE env var enables cover without coverage enabled

1 participant