Skip to content

Exclude test code from coverage and run candidates once - #7

Merged
cppbear merged 1 commit into
mainfrom
fix/exclude-test-coverage
Oct 7, 2026
Merged

cppbear merged 1 commit into
mainfrom
fix/exclude-test-coverage

Conversation

@cppbear

@cppbear cppbear commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Test functions and helpers in src/ previously contributed to raw coverage, and requesting XML plus JSON ran each candidate twice. Coverage now temporarily marks test-only modules/functions with #[coverage(off)], runs tests once, and exports JSON from the same data as XML. Production callees remain instrumented and candidate runs retain cargo-llvm-cov’s default cleanup.

The shared entry also powers utgen coverage -p <standalone-crate-copy> for original-test baselines without model configuration. Temporary same-line feature gates preserve line numbers and leave compiler flags untouched; source bytes saved at coverage entry are restored after successful runs and returned build/report errors. Preprocessing shares test identification, including standalone cfg(test) helpers. No new dependencies or fingerprinting were added; the regression script now compares bytes directly.

Validation on the pinned nightly and cargo-llvm-cov 0.6.16:

  • cargo build --workspace --locked passed.
  • cargo test --workspace --locked: 26 passed, one existing opt-in live-model test ignored.
  • Full deterministic minimal pipeline passed: original tests still execute, test/helper records are absent, XML/JSON execute each test body once, production branches remain covered, per-candidate profiles do not accumulate, generation and repair succeed, and coverage source edits are restored after assertion/build/report failures.

Scope remains a standalone crate with src/ plus Cargo target entry files. Macro expansion, broader generation/repair recovery, forced-termination recovery, concurrency limits, and timeouts remain later work. Git history is retained.

Linux validation also passed for both the branch run and the PR run, including the full minimal pipeline.

@cppbear
cppbear merged commit 373183d into main Oct 7, 2026
2 checks passed
@cppbear
cppbear deleted the fix/exclude-test-coverage branch October 11, 2026 14:49
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.

1 participant