|
1 | 1 | //! Performance collection for rust-lang/rust compilation.
|
2 | 2 | //!
|
3 |
| -//! This benchmarks a x.py build --stage 0 compiler/rustc invocation on the |
| 3 | +//! This benchmarks a `x.py build compiler/rustc` invocation on the |
4 | 4 | //! latest master compiler.
|
5 |
| -//! |
6 |
| -//! We don't run the (more typical) stage 1 library/test build because there's |
7 |
| -//! no real reason for us to compile the standard library twice, and it avoids |
8 |
| -//! having to think about how to deduplicate results. |
9 | 5 |
|
10 | 6 | use crate::toolchain::Toolchain;
|
11 | 7 | use crate::utils::git::get_rustc_perf_commit;
|
@@ -167,43 +163,44 @@ async fn record(
|
167 | 163 | }
|
168 | 164 |
|
169 | 165 | fn checkout(artifact: &ArtifactId) -> anyhow::Result<()> {
|
170 |
| - if Path::new("rust").exists() { |
171 |
| - let mut status = Command::new("git") |
172 |
| - .current_dir("rust") |
173 |
| - .arg("fetch") |
174 |
| - .arg("origin") |
175 |
| - .arg(match artifact { |
176 |
| - ArtifactId::Commit(c) => c.sha.as_str(), |
177 |
| - ArtifactId::Tag(id) => id.as_str(), |
178 |
| - }) |
179 |
| - .status() |
180 |
| - .context("git fetch origin")?; |
181 |
| - |
182 |
| - if !status.success() { |
183 |
| - log::warn!( |
184 |
| - "git fetch origin {} failed, this will likely break the build", |
185 |
| - artifact |
186 |
| - ); |
187 |
| - } |
188 |
| - |
189 |
| - // Regardless, we fetch the default branch. Upstream Rust started using `git merge-base` |
190 |
| - // recently, which (reasonably) finds the wrong base if we think e.g. origin/master |
191 |
| - // diverged thousands of commits ago. |
192 |
| - status = Command::new("git") |
193 |
| - .current_dir("rust") |
194 |
| - .arg("fetch") |
195 |
| - .arg("origin") |
196 |
| - .arg("HEAD") |
197 |
| - .status() |
198 |
| - .context("git fetch origin HEAD")?; |
199 |
| - assert!(status.success(), "git fetch successful"); |
200 |
| - } else { |
| 166 | + if !Path::new("rust").exists() { |
201 | 167 | let status = Command::new("git")
|
202 | 168 | .arg("clone")
|
203 | 169 | .arg("https://github.com/rust-lang/rust")
|
204 | 170 | .status()
|
205 | 171 | .context("git clone")?;
|
206 | 172 | assert!(status.success(), "git clone successful");
|
207 | 173 | }
|
| 174 | + |
| 175 | + let mut status = Command::new("git") |
| 176 | + .current_dir("rust") |
| 177 | + .arg("fetch") |
| 178 | + .arg("origin") |
| 179 | + .arg(match artifact { |
| 180 | + ArtifactId::Commit(c) => c.sha.as_str(), |
| 181 | + ArtifactId::Tag(id) => id.as_str(), |
| 182 | + }) |
| 183 | + .status() |
| 184 | + .context("git fetch origin")?; |
| 185 | + |
| 186 | + if !status.success() { |
| 187 | + log::warn!( |
| 188 | + "git fetch origin {} failed, this will likely break the build", |
| 189 | + artifact |
| 190 | + ); |
| 191 | + } |
| 192 | + |
| 193 | + // Regardless, we fetch the default branch. Upstream Rust started using `git merge-base` |
| 194 | + // recently, which (reasonably) finds the wrong base if we think e.g. origin/master |
| 195 | + // diverged thousands of commits ago. |
| 196 | + status = Command::new("git") |
| 197 | + .current_dir("rust") |
| 198 | + .arg("fetch") |
| 199 | + .arg("origin") |
| 200 | + .arg("HEAD") |
| 201 | + .status() |
| 202 | + .context("git fetch origin HEAD")?; |
| 203 | + assert!(status.success(), "git fetch successful"); |
| 204 | + |
208 | 205 | Ok(())
|
209 | 206 | }
|
0 commit comments