diff --git a/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff b/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff index dec99ff4601a0..01b01ea5c1756 100644 --- a/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff +++ b/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff @@ -4,7 +4,7 @@ fn bar() -> bool { let mut _0: bool; -+ coverage Code(Counter(0)) => /the/src/instrument_coverage.rs:21:1 - 23:2; ++ coverage Code(Counter(0)) => $DIR/instrument_coverage.rs:19:1 - 21:2; + bb0: { + Coverage::CounterIncrement(0); diff --git a/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff b/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff index 368088d12961a..3606a9e393231 100644 --- a/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff +++ b/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff @@ -9,11 +9,11 @@ + coverage ExpressionId(0) => Expression { lhs: Counter(0), op: Add, rhs: Counter(1) }; + coverage ExpressionId(1) => Expression { lhs: Expression(0), op: Subtract, rhs: Counter(1) }; -+ coverage Code(Counter(0)) => /the/src/instrument_coverage.rs:12:1 - 12:11; -+ coverage Code(Expression(0)) => /the/src/instrument_coverage.rs:13:5 - 14:17; -+ coverage Code(Expression(1)) => /the/src/instrument_coverage.rs:15:13 - 15:18; -+ coverage Code(Counter(1)) => /the/src/instrument_coverage.rs:16:10 - 16:11; -+ coverage Code(Expression(1)) => /the/src/instrument_coverage.rs:18:1 - 18:2; ++ coverage Code(Counter(0)) => $DIR/instrument_coverage.rs:10:1 - 10:11; ++ coverage Code(Expression(0)) => $DIR/instrument_coverage.rs:11:5 - 12:17; ++ coverage Code(Expression(1)) => $DIR/instrument_coverage.rs:13:13 - 13:18; ++ coverage Code(Counter(1)) => $DIR/instrument_coverage.rs:14:10 - 14:11; ++ coverage Code(Expression(1)) => $DIR/instrument_coverage.rs:16:1 - 16:2; + bb0: { + Coverage::CounterIncrement(0); diff --git a/tests/mir-opt/instrument_coverage.rs b/tests/mir-opt/instrument_coverage.rs index 010f7bf4d80b2..ae63990f253df 100644 --- a/tests/mir-opt/instrument_coverage.rs +++ b/tests/mir-opt/instrument_coverage.rs @@ -1,11 +1,9 @@ -// skip-filecheck -// Test that `-C instrument-coverage` injects Coverage statements. The Coverage Counter statements -// are later converted into LLVM instrprof.increment intrinsics, during codegen. +// Test that `-C instrument-coverage` injects Coverage statements. +// The Coverage::CounterIncrement statements are later converted into LLVM +// instrprof.increment intrinsics, during codegen. //@ unit-test: InstrumentCoverage -//@ needs-profiler-support -//@ ignore-windows -//@ compile-flags: -C instrument-coverage --remap-path-prefix={{src-base}}=/the/src +//@ compile-flags: -Cinstrument-coverage -Zno-profiler-runtime // EMIT_MIR instrument_coverage.main.InstrumentCoverage.diff // EMIT_MIR instrument_coverage.bar.InstrumentCoverage.diff @@ -22,17 +20,9 @@ fn bar() -> bool { true } -// Note that the MIR with injected coverage intrinsics includes references to source locations, -// including the source file absolute path. Typically, MIR pretty print output with file -// references are safe because the file prefixes are substituted with `$DIR`, but in this case -// the file references are encoded as function arguments, with an `Operand` type representation -// (`Slice` `Allocation` interned byte array) that cannot be normalized by simple substitution. -// -// The first workaround is to use the `SourceMap`-supported `--remap-path-prefix` option; however, -// the implementation of the `--remap-path-prefix` option currently joins the new prefix and the -// remaining source path with an OS-specific path separator (`\` on Windows). This difference still -// shows up in the byte array representation of the path, causing Windows tests to fail to match -// blessed results baselined with a `/` path separator. -// -// Since this `mir-opt` test does not have any significant platform dependencies, other than the -// path separator differences, the final workaround is to disable testing on Windows. +// CHECK: coverage ExpressionId({{[0-9]+}}) => +// CHECK-DAG: coverage Code(Counter({{[0-9]+}})) => +// CHECK-DAG: coverage Code(Expression({{[0-9]+}})) => +// CHECK: bb0: +// CHECK-DAG: Coverage::ExpressionUsed({{[0-9]+}}) +// CHECK-DAG: Coverage::CounterIncrement({{[0-9]+}}) diff --git a/tests/mir-opt/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff b/tests/mir-opt/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff index ff65ca7703928..34d011540b9c1 100644 --- a/tests/mir-opt/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff +++ b/tests/mir-opt/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff @@ -5,15 +5,15 @@ let mut _0: (); let mut _1: bool; - coverage branch { true: BlockMarkerId(0), false: BlockMarkerId(1) } => /the/src/instrument_coverage_cleanup.rs:15:8: 15:36 (#0) + coverage branch { true: BlockMarkerId(0), false: BlockMarkerId(1) } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0) coverage ExpressionId(0) => Expression { lhs: Counter(0), op: Subtract, rhs: Counter(1) }; coverage ExpressionId(1) => Expression { lhs: Counter(1), op: Add, rhs: Expression(0) }; - coverage Code(Counter(0)) => /the/src/instrument_coverage_cleanup.rs:14:1 - 15:36; - coverage Code(Expression(0)) => /the/src/instrument_coverage_cleanup.rs:15:37 - 15:39; - coverage Code(Counter(1)) => /the/src/instrument_coverage_cleanup.rs:15:39 - 15:40; - coverage Code(Expression(1)) => /the/src/instrument_coverage_cleanup.rs:16:1 - 16:2; - coverage Branch { true_term: Expression(0), false_term: Counter(1) } => /the/src/instrument_coverage_cleanup.rs:15:8 - 15:36; + coverage Code(Counter(0)) => $DIR/instrument_coverage_cleanup.rs:13:1 - 14:36; + coverage Code(Expression(0)) => $DIR/instrument_coverage_cleanup.rs:14:37 - 14:39; + coverage Code(Counter(1)) => $DIR/instrument_coverage_cleanup.rs:14:39 - 14:40; + coverage Code(Expression(1)) => $DIR/instrument_coverage_cleanup.rs:15:1 - 15:2; + coverage Branch { true_term: Expression(0), false_term: Counter(1) } => $DIR/instrument_coverage_cleanup.rs:14:8 - 14:36; bb0: { Coverage::CounterIncrement(0); diff --git a/tests/mir-opt/instrument_coverage_cleanup.main.InstrumentCoverage.diff b/tests/mir-opt/instrument_coverage_cleanup.main.InstrumentCoverage.diff index 8757559149a43..6756d5c1e1b2c 100644 --- a/tests/mir-opt/instrument_coverage_cleanup.main.InstrumentCoverage.diff +++ b/tests/mir-opt/instrument_coverage_cleanup.main.InstrumentCoverage.diff @@ -5,15 +5,15 @@ let mut _0: (); let mut _1: bool; - coverage branch { true: BlockMarkerId(0), false: BlockMarkerId(1) } => /the/src/instrument_coverage_cleanup.rs:15:8: 15:36 (#0) + coverage branch { true: BlockMarkerId(0), false: BlockMarkerId(1) } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0) + coverage ExpressionId(0) => Expression { lhs: Counter(0), op: Subtract, rhs: Counter(1) }; + coverage ExpressionId(1) => Expression { lhs: Counter(1), op: Add, rhs: Expression(0) }; -+ coverage Code(Counter(0)) => /the/src/instrument_coverage_cleanup.rs:14:1 - 15:36; -+ coverage Code(Expression(0)) => /the/src/instrument_coverage_cleanup.rs:15:37 - 15:39; -+ coverage Code(Counter(1)) => /the/src/instrument_coverage_cleanup.rs:15:39 - 15:40; -+ coverage Code(Expression(1)) => /the/src/instrument_coverage_cleanup.rs:16:1 - 16:2; -+ coverage Branch { true_term: Expression(0), false_term: Counter(1) } => /the/src/instrument_coverage_cleanup.rs:15:8 - 15:36; ++ coverage Code(Counter(0)) => $DIR/instrument_coverage_cleanup.rs:13:1 - 14:36; ++ coverage Code(Expression(0)) => $DIR/instrument_coverage_cleanup.rs:14:37 - 14:39; ++ coverage Code(Counter(1)) => $DIR/instrument_coverage_cleanup.rs:14:39 - 14:40; ++ coverage Code(Expression(1)) => $DIR/instrument_coverage_cleanup.rs:15:1 - 15:2; ++ coverage Branch { true_term: Expression(0), false_term: Counter(1) } => $DIR/instrument_coverage_cleanup.rs:14:8 - 14:36; + bb0: { + Coverage::CounterIncrement(0); diff --git a/tests/mir-opt/instrument_coverage_cleanup.rs b/tests/mir-opt/instrument_coverage_cleanup.rs index 8a2fd67139bd9..7db76339e551d 100644 --- a/tests/mir-opt/instrument_coverage_cleanup.rs +++ b/tests/mir-opt/instrument_coverage_cleanup.rs @@ -7,7 +7,6 @@ //@ unit-test: InstrumentCoverage //@ compile-flags: -Cinstrument-coverage -Zcoverage-options=branch -Zno-profiler-runtime -//@ compile-flags: --remap-path-prefix={{src-base}}=/the/src // EMIT_MIR instrument_coverage_cleanup.main.InstrumentCoverage.diff // EMIT_MIR instrument_coverage_cleanup.main.CleanupPostBorrowck.diff