diff --git a/collector/src/compile/execute/rustc.rs b/collector/src/compile/execute/rustc.rs index 2c5df059d..0d967e7bf 100644 --- a/collector/src/compile/execute/rustc.rs +++ b/collector/src/compile/execute/rustc.rs @@ -1,11 +1,7 @@ //! Performance collection for rust-lang/rust compilation. //! -//! This benchmarks a x.py build --stage 0 compiler/rustc invocation on the +//! This benchmarks a `x.py build compiler/rustc` invocation on the //! latest master compiler. -//! -//! We don't run the (more typical) stage 1 library/test build because there's -//! no real reason for us to compile the standard library twice, and it avoids -//! having to think about how to deduplicate results. use crate::toolchain::Toolchain; use crate::utils::git::get_rustc_perf_commit; @@ -167,37 +163,7 @@ async fn record( } fn checkout(artifact: &ArtifactId) -> anyhow::Result<()> { - if Path::new("rust").exists() { - let mut status = Command::new("git") - .current_dir("rust") - .arg("fetch") - .arg("origin") - .arg(match artifact { - ArtifactId::Commit(c) => c.sha.as_str(), - ArtifactId::Tag(id) => id.as_str(), - }) - .status() - .context("git fetch origin")?; - - if !status.success() { - log::warn!( - "git fetch origin {} failed, this will likely break the build", - artifact - ); - } - - // Regardless, we fetch the default branch. Upstream Rust started using `git merge-base` - // recently, which (reasonably) finds the wrong base if we think e.g. origin/master - // diverged thousands of commits ago. - status = Command::new("git") - .current_dir("rust") - .arg("fetch") - .arg("origin") - .arg("HEAD") - .status() - .context("git fetch origin HEAD")?; - assert!(status.success(), "git fetch successful"); - } else { + if !Path::new("rust").exists() { let status = Command::new("git") .arg("clone") .arg("https://github.com/rust-lang/rust") @@ -205,5 +171,36 @@ fn checkout(artifact: &ArtifactId) -> anyhow::Result<()> { .context("git clone")?; assert!(status.success(), "git clone successful"); } + + let mut status = Command::new("git") + .current_dir("rust") + .arg("fetch") + .arg("origin") + .arg(match artifact { + ArtifactId::Commit(c) => c.sha.as_str(), + ArtifactId::Tag(id) => id.as_str(), + }) + .status() + .context("git fetch origin")?; + + if !status.success() { + log::warn!( + "git fetch origin {} failed, this will likely break the build", + artifact + ); + } + + // Regardless, we fetch the default branch. Upstream Rust started using `git merge-base` + // recently, which (reasonably) finds the wrong base if we think e.g. origin/master + // diverged thousands of commits ago. + status = Command::new("git") + .current_dir("rust") + .arg("fetch") + .arg("origin") + .arg("HEAD") + .status() + .context("git fetch origin HEAD")?; + assert!(status.success(), "git fetch successful"); + Ok(()) }