-
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
Tracking Issue for LLVM InstrProf code coverage (current flag: -Zinstrument-coverage
)
#79121
Comments
Just a quick note to the compiler team and interested contributors: As of today, I'm going to be much less active on Rust Coverage, due to other work priorities. I believe the implementation is essentially "complete" (including detailed documentation in the Rust Dev Guide that should help future contributors). I plan to support any serious bugs in the implementation, as they arise, but otherwise, I encourage any contributors interested in taking on any of the "Open Issues" listed above. I should be able to advise/answer questions as needed. Thank you so much to @tmandry and @wesleywiser for partnering with me on this feature, exceptionally detailed code reviews, and incredibly helpful guidance along the way! Thanks also to the many other members of the Rust community who contributed requirements, testing, bug reports, and helpful tips along the way! |
Thanks for your work on this @richkadel! |
Is there an issue somewhere tracking potentially adding a Right now all of the guides I see still rely on manually merging/searching for different files, so I imagine this would be nice to have, even if it didn't do anything other than just put the coverage data in an easy-to-access place. |
I ran into an issue for coreutils, uutils/coreutils#2324. The "ls" tests are angry at the default.profraw file. How do you set an environment variable so profiles write to a fixed directory like /tmp/coreutils-coverage? |
Thanks for asking. This has been discussed, and I think it's a good idea. I don't have a timeline for working on this but I think there should at least be an issue to track it. I'll add one. |
@chadbrewbaker - Thanks for the comment. Can you create a separate issue on this, preferably with MCVE? Thank you! |
@richkadel According to https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#id4 there is a LLVM_PROFILE_FILE environment variable. I can't seem to figure out how to get it to write to a fixed directory. |
@chadbrewbaker - This Tracking Issue isn't the right forum for discussing issues like that. |
Sorry, didn't mean to spam the wrong forum. What is "MCVE", and where would you suggest I move discussion of fixing the profile writing location within the current nightly toolchain? |
If you believe there is a bug, please file a new issue. The template includes a section "I tried this code". MCVE is cryptic (but google-able) for "a small example of code and steps so someone else can quickly and easily reproduce the issue" (my words). I use the term because it's used by Rust (label |
Haven't seen this mentioned yet, but @taiki-e has created cc @clarfonthey |
From the unresolved questions:
Given that LLVM 13 has now been released, requiring LLVM 11 for coverage support seems like a reasonable requirement. If people don't have at least LLVM 11, nothing else breaks; they just can't use coverage support. Given that coverage support currently requires a nightly compiler and LLVM 11 or newer, allowing it on a stable compiler built with LLVM 11 or newer seems like an improvement. |
I've submitted #90128 to propose stabilizing |
@Swatinem - FYI, another data point on maintaining LLVM 11 support as long as it's feasible. |
I submitted #90132 to propose stabilizing |
…overage, r=wesleywiser Stabilize `-Z instrument-coverage` as `-C instrument-coverage` (Tracking issue for `instrument-coverage`: rust-lang#79121) This PR stabilizes support for instrumentation-based code coverage, previously provided via the `-Z instrument-coverage` option. (Continue supporting `-Z instrument-coverage` for compatibility for now, but show a deprecation warning for it.) Many, many people have tested this support, and there are numerous reports of it working as expected. Move the documentation from the unstable book to stable rustc documentation. Update uses and documentation to use the `-C` option. Addressing questions raised in the tracking issue: > If/when stabilized, will the compiler flag be updated to -C instrument-coverage? (If so, the -Z variant could also be supported for some time, to ease migrations for existing users and scripts.) This stabilization PR updates the option to `-C` and keeps the `-Z` variant to ease migration. > The Rust coverage implementation depends on (and automatically turns on) -Z symbol-mangling-version=v0. Will stabilizing this feature depend on stabilizing v0 symbol-mangling first? If so, what is the current status and timeline? This stabilization PR depends on rust-lang#90128 , which stabilizes `-C symbol-mangling-version=v0` (but does not change the default symbol-mangling-version). > The Rust coverage implementation implements the latest version of LLVM's Coverage Mapping Format (version 4), which forces a dependency on LLVM 11 or later. A compiler error is generated if attempting to compile with coverage, and using an older version of LLVM. Given that LLVM 13 has now been released, requiring LLVM 11 for coverage support seems like a reasonable requirement. If people don't have at least LLVM 11, nothing else breaks; they just can't use coverage support. Given that coverage support currently requires a nightly compiler and LLVM 11 or newer, allowing it on a stable compiler built with LLVM 11 or newer seems like an improvement. The [tracking issue](rust-lang#79121) and the [issue label A-code-coverage](https://github.com/rust-lang/rust/labels/A-code-coverage) link to a few open issues related to `instrument-coverage`, but none of them seem like showstoppers. All of them seem like improvements and refinements we can make after stabilization. The original `-Z instrument-coverage` support went through a compiler-team MCP at rust-lang/compiler-team#278 . Based on that, `@pnkfelix` suggested that this needed a stabilization PR and a compiler-team FCP.
…overage, r=wesleywiser Stabilize `-Z instrument-coverage` as `-C instrument-coverage` (Tracking issue for `instrument-coverage`: rust-lang#79121) This PR stabilizes support for instrumentation-based code coverage, previously provided via the `-Z instrument-coverage` option. (Continue supporting `-Z instrument-coverage` for compatibility for now, but show a deprecation warning for it.) Many, many people have tested this support, and there are numerous reports of it working as expected. Move the documentation from the unstable book to stable rustc documentation. Update uses and documentation to use the `-C` option. Addressing questions raised in the tracking issue: > If/when stabilized, will the compiler flag be updated to -C instrument-coverage? (If so, the -Z variant could also be supported for some time, to ease migrations for existing users and scripts.) This stabilization PR updates the option to `-C` and keeps the `-Z` variant to ease migration. > The Rust coverage implementation depends on (and automatically turns on) -Z symbol-mangling-version=v0. Will stabilizing this feature depend on stabilizing v0 symbol-mangling first? If so, what is the current status and timeline? This stabilization PR depends on rust-lang#90128 , which stabilizes `-C symbol-mangling-version=v0` (but does not change the default symbol-mangling-version). > The Rust coverage implementation implements the latest version of LLVM's Coverage Mapping Format (version 4), which forces a dependency on LLVM 11 or later. A compiler error is generated if attempting to compile with coverage, and using an older version of LLVM. Given that LLVM 13 has now been released, requiring LLVM 11 for coverage support seems like a reasonable requirement. If people don't have at least LLVM 11, nothing else breaks; they just can't use coverage support. Given that coverage support currently requires a nightly compiler and LLVM 11 or newer, allowing it on a stable compiler built with LLVM 11 or newer seems like an improvement. The [tracking issue](rust-lang#79121) and the [issue label A-code-coverage](https://github.com/rust-lang/rust/labels/A-code-coverage) link to a few open issues related to `instrument-coverage`, but none of them seem like showstoppers. All of them seem like improvements and refinements we can make after stabilization. The original `-Z instrument-coverage` support went through a compiler-team MCP at rust-lang/compiler-team#278 . Based on that, ``@pnkfelix`` suggested that this needed a stabilization PR and a compiler-team FCP.
…overage, r=wesleywiser Stabilize `-Z instrument-coverage` as `-C instrument-coverage` (Tracking issue for `instrument-coverage`: rust-lang#79121) This PR stabilizes support for instrumentation-based code coverage, previously provided via the `-Z instrument-coverage` option. (Continue supporting `-Z instrument-coverage` for compatibility for now, but show a deprecation warning for it.) Many, many people have tested this support, and there are numerous reports of it working as expected. Move the documentation from the unstable book to stable rustc documentation. Update uses and documentation to use the `-C` option. Addressing questions raised in the tracking issue: > If/when stabilized, will the compiler flag be updated to -C instrument-coverage? (If so, the -Z variant could also be supported for some time, to ease migrations for existing users and scripts.) This stabilization PR updates the option to `-C` and keeps the `-Z` variant to ease migration. > The Rust coverage implementation depends on (and automatically turns on) -Z symbol-mangling-version=v0. Will stabilizing this feature depend on stabilizing v0 symbol-mangling first? If so, what is the current status and timeline? This stabilization PR depends on rust-lang#90128 , which stabilizes `-C symbol-mangling-version=v0` (but does not change the default symbol-mangling-version). > The Rust coverage implementation implements the latest version of LLVM's Coverage Mapping Format (version 4), which forces a dependency on LLVM 11 or later. A compiler error is generated if attempting to compile with coverage, and using an older version of LLVM. Given that LLVM 13 has now been released, requiring LLVM 11 for coverage support seems like a reasonable requirement. If people don't have at least LLVM 11, nothing else breaks; they just can't use coverage support. Given that coverage support currently requires a nightly compiler and LLVM 11 or newer, allowing it on a stable compiler built with LLVM 11 or newer seems like an improvement. The [tracking issue](rust-lang#79121) and the [issue label A-code-coverage](https://github.com/rust-lang/rust/labels/A-code-coverage) link to a few open issues related to `instrument-coverage`, but none of them seem like showstoppers. All of them seem like improvements and refinements we can make after stabilization. The original `-Z instrument-coverage` support went through a compiler-team MCP at rust-lang/compiler-team#278 . Based on that, ```@pnkfelix``` suggested that this needed a stabilization PR and a compiler-team FCP.
…overage, r=wesleywiser Stabilize `-Z instrument-coverage` as `-C instrument-coverage` (Tracking issue for `instrument-coverage`: rust-lang#79121) This PR stabilizes support for instrumentation-based code coverage, previously provided via the `-Z instrument-coverage` option. (Continue supporting `-Z instrument-coverage` for compatibility for now, but show a deprecation warning for it.) Many, many people have tested this support, and there are numerous reports of it working as expected. Move the documentation from the unstable book to stable rustc documentation. Update uses and documentation to use the `-C` option. Addressing questions raised in the tracking issue: > If/when stabilized, will the compiler flag be updated to -C instrument-coverage? (If so, the -Z variant could also be supported for some time, to ease migrations for existing users and scripts.) This stabilization PR updates the option to `-C` and keeps the `-Z` variant to ease migration. > The Rust coverage implementation depends on (and automatically turns on) -Z symbol-mangling-version=v0. Will stabilizing this feature depend on stabilizing v0 symbol-mangling first? If so, what is the current status and timeline? This stabilization PR depends on rust-lang#90128 , which stabilizes `-C symbol-mangling-version=v0` (but does not change the default symbol-mangling-version). > The Rust coverage implementation implements the latest version of LLVM's Coverage Mapping Format (version 4), which forces a dependency on LLVM 11 or later. A compiler error is generated if attempting to compile with coverage, and using an older version of LLVM. Given that LLVM 13 has now been released, requiring LLVM 11 for coverage support seems like a reasonable requirement. If people don't have at least LLVM 11, nothing else breaks; they just can't use coverage support. Given that coverage support currently requires a nightly compiler and LLVM 11 or newer, allowing it on a stable compiler built with LLVM 11 or newer seems like an improvement. The [tracking issue](rust-lang#79121) and the [issue label A-code-coverage](https://github.com/rust-lang/rust/labels/A-code-coverage) link to a few open issues related to `instrument-coverage`, but none of them seem like showstoppers. All of them seem like improvements and refinements we can make after stabilization. The original `-Z instrument-coverage` support went through a compiler-team MCP at rust-lang/compiler-team#278 . Based on that, `@pnkfelix` suggested that this needed a stabilization PR and a compiler-team FCP.
Thanks for working on this. I just wanted to note that the blog post https://blog.rust-lang.org/inside-rust/2020/11/12/source-based-code-coverage.html now has a broken link to https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/source-based-code-coverage.html under "how to get started" - maybe because it's stablizing? (Which is very exciting!) |
@sourcefrog Feel free to submit a PR at
https://github.com/rust-lang/blog.rust-lang.org
|
So, I commented on #79556 which seems to be the primary issue tracking this, but since this issue hasn't been closed yet, I figured I'd state this here for visibility. A large number of targets seem to not support
After trialing multiple targets on I'm not sure the exact reasoning for holding off on closing this issue considering how this has already been released on stable rust and a blog post has been written about it, but I do think that the lack of support for tier 2 targets is a big deal that should probably be looked into. |
@clarfonthey Thanks for bringing this up, I responded on that issue. I'm also going to close this issue, since the feature has now been stabilized. Issues with the feature can be tracked using the label, A-code-coverage. |
This is a tracking issue for the MCP "Implement LLVM-compatible source-based code coverage" (rust-lang/compiler-team#278).
Original feature request: Issue #34701.
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
Rustc Dev Guide
includes detailed documentation on the implementation in a new section,LLVM Source-Based Code Coverage
Rust Unstable Book
at https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/source-based-code-coverage.htmlInside Rust Blog
article at https://blog.rust-lang.org/inside-rust/2020/11/12/source-based-code-coverage.htmlUnresolved Questions
There are no unresolved questions from the MCP.
Some implementation options were debated and, if deferred, were logged as
FIXME
comments in the compiler source code or tests.FIXME
comments related to stabilization have been added asrust-lang/rust
issues.If/when stabilized, will the compiler flag be updated to
-C instrument-coverage
? (If so, the-Z
variant could also be supported for some time, to ease migrations for existing users and scripts.)The Rust coverage implementation depends on (and automatically turns on)
-Z symbol-mangling-version=v0
. Will stabilizing this feature depend on stabilizingv0
symbol-mangling first? If so, what is the current status and timeline?The Rust coverage implementation implements the latest version of LLVM's Coverage Mapping Format (version 4), which forces a dependency on LLVM 11 or later. A compiler error is generated if attempting to compile with coverage, and using an older version of LLVM.
What other questions need to be answered before the feature can be stabilized?
Open Issues related to this Tracking Issue
Somewhat ordered by priority:
-Zinstrument-coverage
" (Rustdoc doctests should have their file/lines remapped when using-Zinstrument-coverage
#79417)#[should_panic]
tests andcatch_unwind()
handlers" (MIR InstrumentCoverage: Improve coverage of#[should_panic]
tests andcatch_unwind()
handlers #78544)-Z instrument-coverage
#85902)FakeRead
statements be more consistent?" (MIR InstrumentCoverage - Can the source_info.span forFakeRead
statements be more consistent? #78546)Also, note the issue tracking label: A-code-coverage
Implementation history
nightly
channel as of November 8, 2020.The text was updated successfully, but these errors were encountered: