Uh oh!
There was an error while loading. Please reload this page.
Tools, tests, and experimenting with MIR-derived coverage counters - #76004
Conversation
3fa311a to
0d2d15cCompare@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. |
richkadel
commented
Aug 27, 2020
tmandry
commented
Aug 28, 2020
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
94857ebComparerichkadel
commented
Aug 28, 2020
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. |
richkadel
commented
Aug 28, 2020
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.
@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.
Uh oh!
There was an error while loading. Please reload this page.
cbe4c0a to
acdebcbComparerichkadel
commented
Aug 29, 2020
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
53945a3Comparebors
commented
Aug 30, 2020
☔ The latest upstream changes (presumably #74862) made this pull request unmergeable. Please resolve the merge conflicts. |
53945a3 to
a0a5cffComparea0a5cff to
558e1d7CompareSimilar 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
141642bCompare…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
704b8c8Comparerichkadel
commented
Sep 2, 2020
@tmandry@wesleywiser - rebased after the last dependency just landed. This PR should be ready for bors. Thanks! |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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 
704b8c8 to
51d692cComparerichkadel
commented
Sep 3, 2020
@tmandry - I addressed your feedback. This should be good to go I believe. |
richkadel
commented
Sep 3, 2020
@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". |
tmandry
commented
Sep 3, 2020
@bors r+ rollup=never |
bors
commented
Sep 3, 2020
📌 Commit 51d692c has been approved by |
bors
commented
Sep 4, 2020
bors
commented
Sep 4, 2020
☀️ 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-coveragetest 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-codedisabled).New tests validate coverage region generation and coverage reports with multiple counters per function. Starting with a simple
if-elsebranch 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-coverageoption 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-coverageoption 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