Revise the docs for coverage instrumentation tests
This commit is contained in:
parent
f987fe8382
commit
5813662ef3
|
|
@ -274,13 +274,22 @@ since it will not be called), and adds a new `FunctionCoverage`, with
|
||||||
|
|
||||||
## Testing LLVM Coverage
|
## Testing LLVM Coverage
|
||||||
|
|
||||||
Coverage instrumentation in the MIR is validated by a `mir-opt` test:
|
[(See also the compiletest documentation for the `tests/coverage-map` and
|
||||||
[`instrument-coverage`][mir-opt-test].
|
`tests/run-coverage` test suites.)](./tests/compiletest.md#coverage-tests)
|
||||||
|
|
||||||
More complete testing of end-to-end coverage instrumentation and reports are
|
Coverage instrumentation in the MIR is validated by a `mir-opt` test:
|
||||||
done in the `run-make-fulldeps` tests, with sample Rust programs (to be
|
[`tests/mir-opt/instrument_coverage.rs`].
|
||||||
instrumented) in the [`tests/run-coverage`] directory,
|
|
||||||
together with the actual tests and expected results.
|
Coverage instrumentation in LLVM IR is validated by the [`tests/coverage-map`]
|
||||||
|
test suite. These tests compile a test program to LLVM IR assembly, and then
|
||||||
|
use the [`src/tools/coverage-dump`] tool to extract and pretty-print the
|
||||||
|
coverage mappings that would be embedded in the final binary.
|
||||||
|
|
||||||
|
End-to-end testing of coverage instrumentation and coverage reporting is
|
||||||
|
performed by the [`tests/run-coverage`] and [`tests/run-coverage-rustdoc`]
|
||||||
|
test suites. These tests compile and run a test program with coverage
|
||||||
|
instrumentation, then use LLVM tools to convert the coverage data into a
|
||||||
|
human-readable coverage report.
|
||||||
|
|
||||||
Finally, the [`coverage-llvmir`] test compiles a simple Rust program
|
Finally, the [`coverage-llvmir`] test compiles a simple Rust program
|
||||||
with `-C instrument-coverage` and compares the compiled program's LLVM IR to
|
with `-C instrument-coverage` and compares the compiled program's LLVM IR to
|
||||||
|
|
@ -288,18 +297,19 @@ expected LLVM IR instructions and structured data for a coverage-enabled
|
||||||
program, including various checks for Coverage Map-related metadata and the LLVM
|
program, including various checks for Coverage Map-related metadata and the LLVM
|
||||||
intrinsic calls to increment the runtime counters.
|
intrinsic calls to increment the runtime counters.
|
||||||
|
|
||||||
Expected results for both the `mir-opt` tests and the `coverage*` tests
|
Expected results for the `coverage-map`, `run-coverage`, `run-coverage-rustdoc`,
|
||||||
can be refreshed by running:
|
and `mir-opt` tests can be refreshed by running:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
./x test tests/*coverage* --bless
|
||||||
./x test tests/mir-opt --bless
|
./x test tests/mir-opt --bless
|
||||||
./x test tests/run-coverage --bless
|
|
||||||
./x test tests/run-coverage-rustdoc --bless
|
|
||||||
```
|
```
|
||||||
|
|
||||||
[mir-opt-test]: https://github.com/rust-lang/rust/blob/master/tests/mir-opt/instrument_coverage.rs
|
[`tests/mir-opt/instrument_coverage.rs`]: https://github.com/rust-lang/rust/blob/master/tests/mir-opt/instrument_coverage.rs
|
||||||
|
[`tests/coverage-map`]: https://github.com/rust-lang/rust/tree/master/tests/coverage-map
|
||||||
|
[`src/tools/coverage-dump`]: https://github.com/rust-lang/rust/tree/master/src/tools/coverage-dump
|
||||||
[`tests/run-coverage`]: https://github.com/rust-lang/rust/tree/master/tests/run-coverage
|
[`tests/run-coverage`]: https://github.com/rust-lang/rust/tree/master/tests/run-coverage
|
||||||
[spanview-debugging]: compiler-debugging.md#viewing-spanview-output
|
[`tests/run-coverage-rustdoc`]: https://github.com/rust-lang/rust/tree/master/tests/run-coverage-rustdoc
|
||||||
[`coverage-llvmir`]: https://github.com/rust-lang/rust/tree/master/tests/run-make/coverage-llvmir
|
[`coverage-llvmir`]: https://github.com/rust-lang/rust/tree/master/tests/run-make/coverage-llvmir
|
||||||
|
|
||||||
## Implementation Details of the `InstrumentCoverage` MIR Pass
|
## Implementation Details of the `InstrumentCoverage` MIR Pass
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue