@@ -274,32 +274,42 @@ since it will not be called), and adds a new `FunctionCoverage`, with
274274
275275## Testing LLVM Coverage
276276
277+ [ (See also the compiletest documentation for the ` tests/coverage-map ` and
278+ ` tests/run-coverage ` test suites.)] ( ./tests/compiletest.md#coverage-tests )
279+
277280Coverage instrumentation in the MIR is validated by a ` mir-opt ` test:
278- [ ` instrument-coverage ` ] [ mir-opt-test ] .
281+ [ ` tests/mir-opt/instrument_coverage.rs ` ] .
282+
283+ Coverage instrumentation in LLVM IR is validated by the [ ` tests/coverage-map ` ]
284+ test suite. These tests compile a test program to LLVM IR assembly, and then
285+ use the [ ` src/tools/coverage-dump ` ] tool to extract and pretty-print the
286+ coverage mappings that would be embedded in the final binary.
279287
280- More complete testing of end-to-end coverage instrumentation and reports are
281- done in the ` run-make-fulldeps ` tests, with sample Rust programs (to be
282- instrumented) in the [ ` tests/run-coverage ` ] directory,
283- together with the actual tests and expected results.
288+ End-to-end testing of coverage instrumentation and coverage reporting is
289+ performed by the [ ` tests/run-coverage ` ] and [ ` tests/run-coverage-rustdoc ` ]
290+ test suites. These tests compile and run a test program with coverage
291+ instrumentation, then use LLVM tools to convert the coverage data into a
292+ human-readable coverage report.
284293
285294Finally, the [ ` coverage-llvmir ` ] test compiles a simple Rust program
286295with ` -C instrument-coverage ` and compares the compiled program's LLVM IR to
287296expected LLVM IR instructions and structured data for a coverage-enabled
288297program, including various checks for Coverage Map-related metadata and the LLVM
289298intrinsic calls to increment the runtime counters.
290299
291- Expected results for both the ` mir-opt ` tests and the ` coverage* ` tests
292- can be refreshed by running:
300+ Expected results for the ` coverage-map ` , ` run- coverage` , ` run-coverage-rustdoc ` ,
301+ and ` mir-opt ` tests can be refreshed by running:
293302
294303``` shell
304+ ./x test tests/* coverage* --bless
295305./x test tests/mir-opt --bless
296- ./x test tests/run-coverage --bless
297- ./x test tests/run-coverage-rustdoc --bless
298306```
299307
300- [ mir-opt-test ] : https://github.com/rust-lang/rust/blob/master/tests/mir-opt/instrument_coverage.rs
308+ [ `tests/mir-opt/instrument_coverage.rs` ] : https://github.com/rust-lang/rust/blob/master/tests/mir-opt/instrument_coverage.rs
309+ [ `tests/coverage-map` ] : https://github.com/rust-lang/rust/tree/master/tests/coverage-map
310+ [ `src/tools/coverage-dump` ] : https://github.com/rust-lang/rust/tree/master/src/tools/coverage-dump
301311[ `tests/run-coverage` ] : https://github.com/rust-lang/rust/tree/master/tests/run-coverage
302- [ spanview-debugging ] : compiler-debugging.md#viewing-spanview-output
312+ [ `tests/run-coverage-rustdoc` ] : https://github.com/rust-lang/rust/tree/master/tests/run-coverage-rustdoc
303313[ `coverage-llvmir` ] : https://github.com/rust-lang/rust/tree/master/tests/run-make/coverage-llvmir
304314
305315## Implementation Details of the ` InstrumentCoverage ` MIR Pass
0 commit comments