Skip to content

Fix coverage annotation compatibility and test-only helpers - #8

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

cppbear merged 1 commit into
mainfrom
fix/coverage-annotations

Conversation

@cppbear

@cppbear cppbear commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Projects that already use coverage attributes could fail with duplicate attributes or feature gates, while test-only methods and file-level test modules still entered coverage. Coverage now adds attributes only under the complement of existing conditions, leaving cfg evaluation to rustc. Preprocessing and coverage recognize test-only impls/methods and file-level cfg(test) consistently, with separate edit visitors.

Non-entry Rust files that parse as expression fragments are preserved by both commands, allowing simple include! expressions. Cargo target entries must still parse as complete files, including custom entry paths. Other parse errors remain errors. Explicit coverage(on) settings remain respected; fragment contents and macro-generated tests are not automatically rewritten.

The change stays within coverage/preprocessing and their checks/docs. No new dependencies, compiler-flag overrides, fingerprinting, general cfg evaluator, or macro expansion were added. The one-run XML/JSON flow and coverage restoration remain in place.

Validation with nightly-2025-03-19 and cargo-llvm-cov 0.6.16:

  • Workspace build and tests passed: 29 tests passed; the existing opt-in live-model test was ignored.
  • New scripts/check_coverage.py passed 11 compatibility cases plus custom-entry rejection checks. It checks normal-library and test builds, feature enabled/disabled, unchanged test outcomes, production-only coverage, restored source bytes, and preprocessing offsets/removal.
  • Full deterministic minimal generation/repair/coverage pipeline passed (6 local generation responses, 1 repair response), including failure restoration and single-run reporting.
  • The bytes working copy passed 980 tests before and during coverage; source bytes were restored.

The compatibility script is now part of Linux CI. Concurrency, timeouts, and broader generation/repair recovery remain separate later work.

Linux CI passed for the branch run and PR run, including the new compatibility checks and full minimal pipeline.

@cppbear
cppbear merged commit fec29fb into main Oct 7, 2026
2 checks passed
@cppbear
cppbear deleted the fix/coverage-annotations 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