Skip to content

Commit 32c351d

Browse files
committed
Use the guard when compiling compile-time benchmarks
1 parent d0d7d92 commit 32c351d

File tree

1 file changed

+8
-0
lines changed
  • collector/src/compile/execute

1 file changed

+8
-0
lines changed

collector/src/compile/execute/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use crate::compile::benchmark::profile::Profile;
55
use crate::compile::benchmark::scenario::Scenario;
66
use crate::compile::benchmark::BenchmarkName;
77
use crate::toolchain::Toolchain;
8+
use crate::utils::fs::EnsureImmutableFile;
89
use crate::{async_command_output, command_output, utils};
910
use anyhow::Context;
1011
use bencher::Bencher;
@@ -203,6 +204,12 @@ impl<'a> CargoProcess<'a> {
203204
);
204205

205206
loop {
207+
// Make sure that Cargo.lock isn't changed by the build
208+
let _guard = EnsureImmutableFile::new(
209+
&self.cwd.join("Cargo.lock"),
210+
self.processor_name.0.clone(),
211+
)?;
212+
206213
// Get the subcommand. If it's not `rustc` it must should be a
207214
// subcommand that itself invokes `rustc` (so that the `FAKE_RUSTC`
208215
// machinery works).
@@ -316,6 +323,7 @@ impl<'a> CargoProcess<'a> {
316323

317324
let cmd = tokio::process::Command::from(cmd);
318325
let output = async_command_output(cmd).await?;
326+
319327
if let Some((ref mut processor, scenario, scenario_str, patch)) = self.processor_etc {
320328
let data = ProcessOutputData {
321329
name: self.processor_name.clone(),

0 commit comments

Comments
 (0)