From 1d9802531d4b7da7448555c08c0aceb3c000aca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Thu, 2 Oct 2025 12:12:23 +0200 Subject: [PATCH 1/2] Update comment --- collector/src/compile/execute/rustc.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/collector/src/compile/execute/rustc.rs b/collector/src/compile/execute/rustc.rs index 2c5df059d..d950a97fa 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; From 633789600759d64e2a45074ed39b75b2aec56770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Thu, 2 Oct 2025 12:14:34 +0200 Subject: [PATCH 2/2] Fix checking out `rust` directory if it does not exist We need to clone it first, and then fetch the commit that we want to benchmark. --- collector/src/compile/execute/rustc.rs | 63 +++++++++++++------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/collector/src/compile/execute/rustc.rs b/collector/src/compile/execute/rustc.rs index d950a97fa..0d967e7bf 100644 --- a/collector/src/compile/execute/rustc.rs +++ b/collector/src/compile/execute/rustc.rs @@ -163,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") @@ -201,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(()) }