Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 33 additions & 36 deletions collector/src/compile/execute/rustc.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -167,43 +163,44 @@ 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")
.status()
.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(())
}
Loading