]> git.proxmox.com Git - rustc.git/blob - src/test/run-make-fulldeps/coverage/coverage_tools.mk
New upstream version 1.49.0~beta.4+dfsg1
[rustc.git] / src / test / run-make-fulldeps / coverage / coverage_tools.mk
1 # Common Makefile include for Rust `run-make-fulldeps/instrument-coverage-* tests. Include this
2 # file with the line:
3 #
4 # -include ../instrument-coverage/coverage_tools.mk
5 #
6 # To enable the Rust compiler option `-C link-dead-code`, also set the following variable
7 # *BEFORE* the `-include` line:
8 #
9 # LINK_DEAD_CODE=yes
10
11 -include ../tools.mk
12
13 ifndef LINK_DEAD_CODE
14 LINK_DEAD_CODE=no
15 endif
16
17 # ISSUE(76038): When targeting MSVC, Rust binaries built with both `-Z instrument-coverage` and
18 # `-C link-dead-code` typically crash (with a seg-fault) or at best generate an empty `*.profraw`
19 # file, required for coverage reports.
20 #
21 # Enabling `-C link-dead-code` is preferred when compiling with `-Z instrument-coverage`, so
22 # `-C link-dead-code` is automatically enabled for all platform targets _except_ MSVC.
23 #
24 # Making the state of `-C link-dead-code` platform-dependent creates a problem for cross-platform
25 # tests because the injected counters, coverage reports, and some low-level output can be different,
26 # depending on the `-C link-dead-code` setting. For example, coverage reports will not report any
27 # coverage for a dead code region when the `-C link-dead-code` option is disabled, but with the
28 # option enabled, those same regions will show coverage counter values (of zero, of course).
29 #
30 # To ensure cross-platform `-Z instrument-coverage` generate consistent output, the
31 # `-C link-dead-code` option is always explicitly enabled or disabled.
32 #
33 # Since tests that execute binaries enabled with both `-Z instrument-coverage` and
34 # `-C link-dead-code` are known to fail, those tests will need the `# ignore-msvc` setting.
35 #
36 # If and when the above issue is resolved, the `# ignore-msvc` option can be removed, and the
37 # tests can be simplified to always test with `-C link-dead-code`.
38
39 UNAME = $(shell uname)
40
41 # FIXME(richkadel): Can any of the features tested by `run-make-fulldeps/coverage-*` tests be tested
42 # just as completely by more focused unit tests of the code logic itself, to reduce the number of
43 # test result files generated and maintained, and to help identify specific test failures and root
44 # causes more easily?