Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit f462af2

Browse files
committed
Use the guard when compiling runtime benchmarks
1 parent 32c351d commit f462af2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

collector/src/runtime/benchmark.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::runtime_group_step_name;
22
use crate::toolchain::Toolchain;
3+
use crate::utils::fs::EnsureImmutableFile;
34
use anyhow::Context;
45
use benchlib::benchmark::passes_filter;
56
use cargo_metadata::Message;
@@ -195,6 +196,14 @@ pub fn prepare_runtime_benchmark_suite(
195196

196197
let target_dir = temp_dir.as_ref().map(|d| d.path());
197198

199+
// Make sure that Cargo.lock isn't changed by the build if we're running in isolated mode
200+
let _guard = match isolation_mode {
201+
CargoIsolationMode::Cached => None,
202+
CargoIsolationMode::Isolated => Some(EnsureImmutableFile::new(
203+
&benchmark_crate.path.join("Cargo.lock"),
204+
benchmark_crate.name.clone(),
205+
)?),
206+
};
198207
let result = start_cargo_build(toolchain, &benchmark_crate.path, target_dir, &opts)
199208
.with_context(|| {
200209
anyhow::anyhow!("Cannot start compilation of {}", benchmark_crate.name)

0 commit comments

Comments
 (0)