-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Tools, tests, and experimenting with MIR-derived coverage counters #76004
Conversation
3fa311a
to
0d2d15c
Compare
@tmandry @wesleywiser - Note there are 3 commits in this PR but two of them are cherry-picked from PRs: #76002 and #76003. So check out the last commit for the changes specific to this PR. Note that most of the files are in the refactored tests and test data. The actual source changes here are much smaller than the number of "files changed" might indicate. |
Is there a reason not to split the tooling out from the changes to coverage instrumentation? The tests for the HTML have a lot of duplicated content. Can we test that output only once? We don't have to cover every case for that since it's not an end user thing (I think we have a single empty-main test for the graphviz output for instance; it mostly tests that the wiring for the feature is working). |
…2, r=wesleywiser Adds --bless support to test/run-make-fulldeps The ability to "bless" output for some of these tests is critical to making it practical to adapt tests to unrelated changes. This is needed for new coverage tests, as shown in PR rust-lang#76004 . r? @tmandry FYI: @wesleywiser
0d2d15c
to
94857eb
Compare
I'm looking into this. If there is something reasonable that I can split out, I'll do it. If I don't see a good way to split it up without consequences, I'll explain my thinking. |
As mentioned in sidebar conversation, I realized that there were several With --bless, the Makefile was rebuilding the I improved the Makefiles to wipe out I went ahead and pushed the changes to this PR, so it no longer includes files that it shouldn't. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tmandry said:
Is there a reason not to split the tooling out from the changes to coverage instrumentation?
Check out what I did with the new commit and see if this helps mitigate your concern.
It's possible to split these into separate commits, but the reason I didn't do it originally (which still holds true), is the refactored tests depend on changes to both InstrumentCoverage and the new file format.
cbe4c0a
to
acdebcb
Compare
I decided to do that after all. See PR #76074, which has only the new spanview document generation capability (and API to be used by this PR). PR #76074 also adds mir-opt tests for the feature that mirror the simple test for I'll update this PR to depend on PR #76074. |
50908e0
to
53945a3
Compare
☔ The latest upstream changes (presumably #74862) made this pull request unmergeable. Please resolve the merge conflicts. |
53945a3
to
a0a5cff
Compare
a0a5cff
to
558e1d7
Compare
Similar to `-Z dump-mir-graphviz`, this adds the option to write HTML+CSS files that allow users to analyze the spans associated with MIR elements (by individual statement, just terminator, or overall basic block). This PR was split out from PR rust-lang#76004, and exposes an API for spanview HTML+CSS files that is also used to analyze code regions chosen for coverage instrumentation (in a follow-on PR). Rust compiler MCP rust-lang/compiler-team#278 Relevant issue: rust-lang#34701 - Implement support for LLVMs code coverage instrumentation
845d66e
to
141642b
Compare
…5.1, r=wesleywiser Add new `-Z dump-mir-spanview` option Similar to `-Z dump-mir-graphviz`, this adds the option to write HTML+CSS files that allow users to analyze the spans associated with MIR elements (by individual statement, just terminator, or overall basic block). This PR was split out from PR rust-lang#76004, and exposes an API for spanview HTML+CSS files that is also used to analyze code regions chosen for coverage instrumentation (in a follow-on PR). Rust compiler MCP rust-lang/compiler-team#278 Relevant issue: rust-lang#34701 - Implement support for LLVMs code coverage instrumentation r? @tmandry FYI @wesleywiser
141642b
to
704b8c8
Compare
@tmandry @wesleywiser - rebased after the last dependency just landed. This PR should be ready for bors. Thanks! |
src/test/run-make-fulldeps/instrument-coverage-cov-reports-base/Makefile
Show resolved
Hide resolved
Adds a new mir_dump output file in HTML/CSS to visualize code regions and the MIR features that they came from (including overlapping spans). See example below: Includes a basic, MIR-block-based implementation of coverage injection, available via `-Zexperimental-coverage`. This implementation has known flaws and omissions, but is simple enough to validate the new tools and tests. The existing `-Zinstrument-coverage` option currently enables function-level coverage only, which at least appears to generate accurate coverage reports at that level. Experimental coverage is not accurate at this time. When branch coverage works as intended, the `-Zexperimental-coverage` option should be removed. This PR replaces the bulk of PR rust-lang#75828, with the remaining parts of that PR distributed among other separate and indentpent PRs. This PR depends on three of those other PRs: rust-lang#76000, rust-lang#76002, and Rust compiler MCP rust-lang/compiler-team#278 Relevant issue: rust-lang#34701 - Implement support for LLVMs code coverage instrumentation ![Screen-Recording-2020-08-21-at-2](https://user-images.githubusercontent.com/3827298/90972923-ff417880-e4d1-11ea-92bb-8713c6198f6d.gif)
704b8c8
to
51d692c
Compare
@tmandry - I addressed your feedback. This should be good to go I believe. |
@tmandry @wesleywiser - I have tested things locally, including with MSVC on Windows. But since this is the first time running this new refactored test framework, including the special cases for MSVC, I recommend "rollup never". |
@bors r+ rollup=never |
📌 Commit 51d692c has been approved by |
☀️ Test successful - checks-actions, checks-azure |
Leverages the new mir_dump output file in HTML+CSS (from #76074) to visualize coverage code regions
and the MIR features that they came from (including overlapping spans).
See example below.
The
run-make-fulldeps/instrument-coverage
test has been refactored to maximize test coverage and reduce code duplication. The new tests support testing with and without-Clink-dead-code
, so Rust coverage can be tested on MSVC (which, currently, only works withlink-dead-code
disabled).New tests validate coverage region generation and coverage reports with multiple counters per function. Starting with a simple
if-else
branch tests, coverage tests for each additional syntax type can be added by simply dropping in a new Rust sample program.Includes a basic, MIR-block-based implementation of coverage injection,
available via
-Zexperimental-coverage
. This implementation has knownflaws and omissions, but is simple enough to validate the new tools and
tests.
The existing
-Zinstrument-coverage
option currently enablesfunction-level coverage only, which at least appears to generate
accurate coverage reports at that level.
Experimental coverage is not accurate at this time. When branch coverage
works as intended, the
-Zexperimental-coverage
option should beremoved.
This PR replaces the bulk of PR #75828, with the remaining parts of
that PR distributed among other separate and indentpent PRs.
This PR depends on two of those other PRs: #76002, #76003 and #76074
Rust compiler MCP rust-lang/compiler-team#278
Relevant issue: #34701 - Implement support for LLVMs code coverage
instrumentation
r? @tmandry
FYI: @wesleywiser