]>
git.proxmox.com Git - rustc.git/blob - tests/mir-opt/instrument_coverage.rs
1 // Test that `-C instrument-coverage` injects Coverage statements. The Coverage Counter statements
2 // are later converted into LLVM instrprof.increment intrinsics, during codegen.
4 // unit-test: InstrumentCoverage
5 // needs-profiler-support
7 // compile-flags: -C instrument-coverage --remap-path-prefix={{src-base}}=/the/src
9 // EMIT_MIR instrument_coverage.main.InstrumentCoverage.diff
10 // EMIT_MIR instrument_coverage.bar.InstrumentCoverage.diff
24 // Note that the MIR with injected coverage intrinsics includes references to source locations,
25 // including the source file absolute path. Typically, MIR pretty print output with file
26 // references are safe because the file prefixes are substituted with `$DIR`, but in this case
27 // the file references are encoded as function arguments, with an `Operand` type representation
28 // (`Slice` `Allocation` interned byte array) that cannot be normalized by simple substitution.
30 // The first workaround is to use the `SourceMap`-supported `--remap-path-prefix` option; however,
31 // the implementation of the `--remap-path-prefix` option currently joins the new prefix and the
32 // remaining source path with an OS-specific path separator (`\` on Windows). This difference still
33 // shows up in the byte array representation of the path, causing Windows tests to fail to match
34 // blessed results baselined with a `/` path separator.
36 // Since this `mir-opt` test does not have any significant platform dependencies, other than the
37 // path separator differences, the final workaround is to disable testing on Windows.