Tools, tests, and experimenting with MIR-derived coverage counters
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 #75828, with the remaining parts of
that PR distributed among other separate and indentpent PRs.
This PR depends on three of those other PRs: #76000, #76002, and
Rust compiler MCP rust-lang/compiler-team#278
Relevant issue: #34701 - Implement support for LLVMs code coverage
instrumentation

2020-08-27 14:13:04 -07:00
|
|
|
# Common Makefile include for Rust `run-make-fulldeps/instrument-coverage-* tests. Include this
|
|
|
|
|
# file with the line:
|
|
|
|
|
#
|
|
|
|
|
# -include ../instrument-coverage/coverage_tools.mk
|
|
|
|
|
|
|
|
|
|
-include ../tools.mk
|
|
|
|
|
|
|
|
|
|
# ISSUE(76038): When targeting MSVC, Rust binaries built with both `-Z instrument-coverage` and
|
|
|
|
|
# `-C link-dead-code` typically crash (with a seg-fault) or at best generate an empty `*.profraw`
|
|
|
|
|
# file, required for coverage reports.
|
|
|
|
|
#
|
2020-11-30 23:58:08 -08:00
|
|
|
# Enabling `-C link-dead-code` is not necessary when compiling with `-Z instrument-coverage`,
|
|
|
|
|
# due to improvements in the coverage map generation, to add unreachable functions known to Rust.
|
|
|
|
|
# Therefore, `-C link-dead-code` is no longer automatically enabled.
|
Tools, tests, and experimenting with MIR-derived coverage counters
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 #75828, with the remaining parts of
that PR distributed among other separate and indentpent PRs.
This PR depends on three of those other PRs: #76000, #76002, and
Rust compiler MCP rust-lang/compiler-team#278
Relevant issue: #34701 - Implement support for LLVMs code coverage
instrumentation

2020-08-27 14:13:04 -07:00
|
|
|
|
|
|
|
|
UNAME = $(shell uname)
|
2020-10-30 16:09:05 -07:00
|
|
|
|
2020-11-24 11:50:24 -08:00
|
|
|
# Rust option `-Z instrument-coverage` uses LLVM Coverage Mapping Format version 4,
|
|
|
|
|
# which requires LLVM 11 or greater.
|
|
|
|
|
LLVM_VERSION_11_PLUS := $(shell \
|
|
|
|
|
LLVM_VERSION=$$("$(LLVM_BIN_DIR)"/llvm-config --version) && \
|
|
|
|
|
LLVM_VERSION_MAJOR=$${LLVM_VERSION/.*/} && \
|
|
|
|
|
[ $$LLVM_VERSION_MAJOR -ge 11 ] && echo true || echo false)
|