Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - fix coverage in attr macro spans #85173

Closed
wants to merge 2 commits into from

Conversation

richkadel
Copy link
Contributor

Such as #[fuchsia_async::run_singlethreaded]

Note the spanview output seems to show good coverage spans, but when
running coverage reports, the fuchsia_async functions showed 0 for
coverage of tests that ran once, and llvm-cov reports a Malformed
Coverage error.

r? @tmandry

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 11, 2021
@richkadel richkadel marked this pull request as draft May 11, 2021 08:37
@bors
Copy link
Contributor

bors commented May 12, 2021

☔ The latest upstream changes (presumably #84278) made this pull request unmergeable. Please resolve the merge conflicts.

Fixes: rust-lang#84018

With `-Z instrument-coverage`, coverage reporting of dead blocks
(for example, blocks dropped because a conditional branch is dropped,
based on const evaluation) is now supported.

Note, this PR relands an earlier, reverted PR that failed when compiling
generators. Generators clone blocks, so CFG simplification is used to
remove the original `BasicBlocks`; and since they were cloned, the
original blocks should not be saved. (Saving them resulted in duplicate
coverage counters, and `llvm-cov` failed with a "Malformed coverage
data" error.

If `instrument-coverage` is enabled,
`simplify::remove_dead_blocks_with_coverage()`,
with `DroppedCoverage::SaveUnreachable`, finds all dropped coverage
`Statement`s and adds their `code_region`s as `Unreachable` coverage
`Statement`s to the `START_BLOCK`, so they are still included in the
coverage map.

Check out the resulting changes in the test coverage reports in this PR.
@rust-log-analyzer

This comment has been minimized.

Such as #[fuchsia_async::run_singlethreaded]

Note the spanview output seems to show good coverage spans, but when
running coverage reports, the fuchsia_async functions showed `0` for
coverage of tests that ran once, and `llvm-cov` reports a Malformed
Coverage error.
@richkadel
Copy link
Contributor Author

Closing this PR because I was able to resolve the problem by fixing the proc macro (in the specific case).

@richkadel richkadel closed this May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants