Skip to content

Commit 7ed2817

Browse files
authored
Merge pull request #1556 from rust-lang/fix-llvm-lines
Fix `EXPECT_ONLY_WRAPPED_RUSTC` for `cargo llvm-lines`
2 parents 9dfaa35 + af4fc01 commit 7ed2817

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

ci/check-profiling.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,21 +137,18 @@ test ! -s results/eprintln-Test-helloworld-Check-Full
137137
# Including both `helloworld` and `regex-1.5.5` benchmarks, as they exercise the
138138
# zero dependency and the greater than zero dependency cases, respectively, the
139139
# latter of which has broken before.
140-
#
141-
# XXX: `regex-1.5.5` is currently excluded because it's failing on CI, even
142-
# though it works locally. #1537 is the issue for this.
143140
RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
144141
cargo run -p collector --bin collector -- \
145142
profile_local llvm-lines $bindir/rustc \
146143
--id Test \
147144
--profiles Debug \
148145
--cargo $bindir/cargo \
149-
--include helloworld \
146+
--include helloworld,regex-1.5.5 \
150147
--scenarios Full
151148
test -f results/ll-Test-helloworld-Debug-Full
152149
grep -q "Lines.*Copies.*Function name" results/ll-Test-helloworld-Debug-Full
153-
#test -f results/ll-Test-regex-1.5.5-Debug-Full
154-
#grep -q "Lines.*Copies.*Function name" results/ll-Test-regex-1.5.5-Debug-Full
150+
test -f results/ll-Test-regex-1.5.5-Debug-Full
151+
grep -q "Lines.*Copies.*Function name" results/ll-Test-regex-1.5.5-Debug-Full
155152

156153
# llvm-ir. `Debug` not `Check` because it works better that way.
157154
RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \

collector/src/execute/mod.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ impl PerfTool {
7575
}
7676
}
7777

78+
/// Should return true if this perf tool calls Cargo "recursively" inside of it.
79+
/// This is not compatible with a check that is performed to make sure that only the
80+
/// final rustc is invoked during a benchmark/profiling phase.
81+
/// See the `EXPECT_ONLY_WRAPPED_RUSTC` environment variable in `rustc-fake`.
82+
fn calls_cargo_recursively(&self) -> bool {
83+
matches!(self, PerfTool::ProfileTool(profiler::Profiler::LlvmLines))
84+
}
85+
7886
fn is_scenario_allowed(&self, scenario: Scenario) -> bool {
7987
use bencher::Bencher::*;
8088
use profiler::Profiler::*;
@@ -252,7 +260,9 @@ impl<'a> CargoProcess<'a> {
252260
// If we're using a processor, we expect that only the crate
253261
// we're interested in benchmarking will be built, not any
254262
// dependencies.
255-
cmd.env("EXPECT_ONLY_WRAPPED_RUSTC", "1");
263+
if !processor.perf_tool().calls_cargo_recursively() {
264+
cmd.env("EXPECT_ONLY_WRAPPED_RUSTC", "1");
265+
}
256266
cmd.arg("--wrap-rustc-with");
257267
cmd.arg(perf_tool_name);
258268
cmd.args(&self.rustc_args);

0 commit comments

Comments
 (0)