coverage: Explicitly test the coverage maps produced by codegen/LLVM#114843
coverage: Explicitly test the coverage maps produced by codegen/LLVM#114843bors merged 3 commits intorust-lang:masterfrom
Conversation
|
(rustbot has picked a reviewer for you, use r? to override) |
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
|
I plan to use these tests to help ensure that the changes in #114399 don't regress/bloat the emitted coverage mappings. |
This comment has been minimized.
This comment has been minimized.
2a4d4e3 to
37c010e
Compare
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
37c010e to
6085e7f
Compare
src/tools/coverage-dump/Cargo.toml
Outdated
There was a problem hiding this comment.
All of these version numbers are just copied from whatever happened to be in Cargo.lock at the time, to avoid bumping the existing versions.
6c19230 to
5a5511c
Compare
Cargo.lock
Outdated
There was a problem hiding this comment.
As far as I can tell, leb128 is maintained and published by the same org as gimli, under the same Apache2/MIT license.
(gimli previously used leb128 as a dependency, but nowadays it uses its own slightly-modified copy in a submodule.)
5a5511c to
317c18d
Compare
Swatinem
left a comment
There was a problem hiding this comment.
🎉 its a lot more readable like this :-)
2d68e55 to
33f3722
Compare
33f3722 to
55f2e57
Compare
|
I decided to remove |
db419f6 to
307d599
Compare
|
Looks like a legitimate error for this PR this time. |
|
This looks like a genuine test failure, so presumably the CI problem is fixed now. |
|
@rustbot author |
|
OK, I think what's happening here is that the snapshots assume So for now I should probably enable an optimization level explicitly in |
dbc47c6 to
5d70c45
Compare
We compile each test file to LLVM IR assembly, and then pass that IR to a dedicated program that can decode LLVM coverage maps and print them in a more human-readable format. We can then check that output against known-good snapshots. This test suite has some advantages over the existing `run-coverage` tests: - We can test coverage instrumentation without needing to run target binaries. - We can observe subtle improvements/regressions in the underlying coverage mappings that don't make a visible difference to coverage reports.
The output of these tests is too complicated to comfortably verify by hand, but we can still use them to observe changes to the underlying mappings produced by codegen/LLVM. If these tests fail due to non-coverage changes (e.g. in HIR-to-MIR lowering or MIR optimizations), it should usually be OK to just `--bless` them, as long as the `run-coverage` test suite still works.
5d70c45 to
3141177
Compare
|
|
(Oh, and presumably this doesn't need to be p=101 any more; that's just left over from this PR being used to check whether CI was still broken.) |
|
@bors r+ p=0 |
|
⌛ Testing commit 3141177 with merge 8d14f2b0f8bb5a9ebb73ab19c480ec321215fc7a... |
|
💔 Test failed - checks-actions |
|
A job failed! Check out the build log: (web) (plain) Click to see the possible cause of the failure (guessed by this bot) |
|
Looks like CI flaked out again on that run. |
|
Also note that this and #114656 are racing in silent conflict; whichever one lands first will require the other to update |
|
@bors retry |
|
☀️ Test successful - checks-actions |
|
Finished benchmarking commit (ab45885): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 628.171s -> 626.58s (-0.25%) |
Our existing coverage tests verify the output of end-to-end coverage reports, but we don't have any way to test the specific mapping information (code regions and their associated counters) that are emitted by
rustc_codegen_llvmand LLVM. That makes it harder to to be confident in changes that would modify those mappings (whether deliberately or accidentally).This PR addresses that by adding a new
coverage-maptest suite that does the following:.ll)src/tools/coverage-dump) that extracts and decodes coverage mappings, and prints them in a more human-readable formatI recommend excluding the last commit while reviewing the main changes, because that last commit is just ~40 test files copied over from
tests/run-coverage, plus their blessed coverage-map snapshots and a readme file. Those snapshots aren't really intended to be checked by hand; they're mostly there to increase the chances that an unintended change to coverage maps will be observable (even if it requires relatively specific circumstances to manifest).