Skip to content

Commit 3b59758

Browse files
Inline rust_sysroot dependency
This moves the sysroot and git installation code into this project to make it easier to modify and change.
1 parent 5fbb0c1 commit 3b59758

File tree

11 files changed

+375
-220
lines changed

11 files changed

+375
-220
lines changed

Cargo.lock

+2-78
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

collector/Cargo.toml

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@ lazy_static = "1"
1919
semver = "0.9"
2020
reqwest = "0.9"
2121
futures = "0.1"
22+
xz2 = "0.1.3"
23+
tar = "0.4"
2224

2325
[dependencies.rustup]
2426
git = "https://github.com/rust-lang-nursery/rustup.rs.git"
2527
optional = false
2628

27-
[dependencies.rust_sysroot]
28-
git = "https://github.com/Mark-Simulacrum/bisect-rust.git"
29-
optional = false
30-
3129
[[bin]]
3230
name = "collector"
3331
path = "src/bin/rustc-perf-collector/main.rs"

collector/src/bin/rustc-perf-collector/execute.rs

+3-15
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,15 @@ use std::str;
1212

1313
use tempfile::TempDir;
1414

15-
use collector::{Benchmark as CollectedBenchmark, BenchmarkState, Patch, Run, Stat};
15+
use collector::{
16+
command_output, Benchmark as CollectedBenchmark, BenchmarkState, Patch, Run, Stat,
17+
};
1618

1719
use failure::{err_msg, Error, ResultExt};
1820
use serde_json;
1921

2022
use crate::{BuildKind, Compiler, RunKind};
2123

22-
fn command_output(cmd: &mut Command) -> Result<process::Output, Error> {
23-
log::trace!("running: {:?}", cmd);
24-
let output = cmd.output()?;
25-
if !output.status.success() {
26-
bail!(
27-
"expected success, got {}\n\nstderr={}\n\n stdout={}",
28-
output.status,
29-
String::from_utf8_lossy(&output.stderr),
30-
String::from_utf8_lossy(&output.stdout)
31-
);
32-
}
33-
Ok(output)
34-
}
35-
3624
fn touch_all(path: &Path) -> Result<(), Error> {
3725
let mut cmd = Command::new("bash");
3826
cmd.current_dir(path)

collector/src/bin/rustc-perf-collector/main.rs

+21-39
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ use failure::{Error, ResultExt, SyncFailure};
1212
use futures::stream::Stream;
1313
use futures::sync::mpsc::{unbounded as unbounded_channel, UnboundedReceiver, UnboundedSender};
1414
use log::{debug, error, info, warn};
15-
use rust_sysroot::git::Commit as GitCommit;
16-
use rust_sysroot::sysroot::Sysroot;
1715
use std::collections::BTreeMap;
1816
use std::collections::HashSet;
1917
use std::env;
@@ -27,8 +25,10 @@ use std::thread::{self, JoinHandle};
2725

2826
mod execute;
2927
mod outrepo;
28+
mod sysroot;
3029

3130
use crate::execute::{Benchmark, Profiler};
31+
use crate::sysroot::Sysroot;
3232

3333
#[derive(Debug, Copy, Clone)]
3434
pub struct Compiler<'a> {
@@ -199,7 +199,7 @@ fn send_home(d: &collected::Request) {
199199

200200
fn bench_commit(
201201
repo: Option<&outrepo::Repo>,
202-
commit: &GitCommit,
202+
commit: &Commit,
203203
triple: &str,
204204
build_kinds: &[BuildKind],
205205
run_kinds: &[RunKind],
@@ -215,10 +215,7 @@ fn bench_commit(
215215

216216
if call_home {
217217
send_home(&collected::Request::BenchmarkCommit {
218-
commit: Commit {
219-
sha: commit.sha.clone(),
220-
date: Date(commit.date),
221-
},
218+
commit: commit.clone(),
222219
benchmarks: benchmarks.iter().map(|b| b.name.clone()).collect(),
223220
});
224221
}
@@ -231,10 +228,7 @@ fn bench_commit(
231228
if call_home {
232229
send_home(&collected::Request::BenchmarkDone {
233230
benchmark: benchmark.name.clone(),
234-
commit: Commit {
235-
sha: commit.sha.clone(),
236-
date: Date(commit.date),
237-
},
231+
commit: commit.clone(),
238232
});
239233
}
240234
results.insert(benchmark.name.clone(), result.clone());
@@ -261,10 +255,7 @@ fn bench_commit(
261255
if call_home {
262256
send_home(&collected::Request::BenchmarkDone {
263257
benchmark: benchmark.name.clone(),
264-
commit: Commit {
265-
sha: commit.sha.clone(),
266-
date: Date(commit.date),
267-
},
258+
commit: commit.clone(),
268259
});
269260
}
270261

@@ -273,10 +264,7 @@ fn bench_commit(
273264
}
274265

275266
CommitData {
276-
commit: Commit {
277-
sha: commit.sha.clone(),
278-
date: Date(commit.date),
279-
},
267+
commit: commit.clone(),
280268
triple: triple.to_string(),
281269
benchmarks: results,
282270
}
@@ -416,9 +404,7 @@ fn main_result() -> Result<i32, Error> {
416404
let get_out_repo =
417405
|allow_new_dir| outrepo::Repo::open(get_out_dir(), allow_new_dir, use_remote);
418406

419-
let get_commits = || {
420-
rust_sysroot::get_commits(rust_sysroot::EPOCH_COMMIT, "master").map_err(SyncFailure::new)
421-
};
407+
let get_commits = || collector::git::get_rust_commits();
422408

423409
let ret = match matches.subcommand() {
424410
("bench_commit", Some(sub_m)) => {
@@ -429,15 +415,13 @@ fn main_result() -> Result<i32, Error> {
429415
.cloned()
430416
.unwrap_or_else(|| {
431417
warn!("utilizing fake commit!");
432-
rust_sysroot::git::Commit {
418+
Commit {
433419
sha: commit.to_string(),
434-
date: Date::ymd_hms(2000, 01, 01, 0, 0, 0).0,
435-
summary: String::new(),
420+
date: Date::ymd_hms(2000, 01, 01, 0, 0, 0),
436421
}
437422
});
438423
let out_repo = get_out_repo(false)?;
439-
let sysroot = Sysroot::install(&commit, "x86_64-unknown-linux-gnu", false, false)
440-
.map_err(SyncFailure::new)?;
424+
let sysroot = Sysroot::install(&commit.sha, commit.date.0, "x86_64-unknown-linux-gnu")?;
441425
let build_kinds = &[BuildKind::Check, BuildKind::Debug, BuildKind::Opt];
442426
let run_kinds = RunKind::all();
443427
out_repo.success(&bench_commit(
@@ -469,11 +453,10 @@ fn main_result() -> Result<i32, Error> {
469453
// arbitrary identifier, not a commit SHA. But that's ok for local
470454
// runs, because `commit` is only used when producing the output
471455
// files, not for interacting with a repo.
472-
let commit = GitCommit {
456+
let commit = Commit {
473457
sha: id.to_string(),
474458
// Drop the nanoseconds; we don't want that level of precision.
475-
date: Utc::now().with_nanosecond(0).unwrap(),
476-
summary: String::new(),
459+
date: Date(Utc::now().with_nanosecond(0).unwrap()),
477460
};
478461
let rustc_path = PathBuf::from(rustc).canonicalize()?;
479462
let cargo_path = PathBuf::from(cargo).canonicalize()?;
@@ -502,10 +485,9 @@ fn main_result() -> Result<i32, Error> {
502485
("bench_published", Some(sub_m)) => {
503486
let id = sub_m.value_of("ID").unwrap();
504487
let repo = get_out_repo(false)?;
505-
let commit = rust_sysroot::git::Commit {
488+
let commit = Commit {
506489
sha: String::from("<none>"),
507-
date: Date::ymd_hms(2010, 01, 01, 0, 0, 0).0,
508-
summary: String::new(),
490+
date: Date::ymd_hms(2010, 01, 01, 0, 0, 0),
509491
};
510492
let cfg = rustup::Cfg::from_env(Arc::new(|_| {})).map_err(SyncFailure::new)?;
511493
let toolchain = rustup::Toolchain::from(&cfg, id)
@@ -574,13 +556,13 @@ fn main_result() -> Result<i32, Error> {
574556
.cloned()
575557
.unwrap_or_else(|| {
576558
warn!("utilizing fake commit!");
577-
rust_sysroot::git::Commit {
559+
Commit {
578560
sha: commit.to_string(),
579-
date: Date::ymd_hms(2000, 01, 01, 0, 0, 0).0,
580-
summary: String::new(),
561+
date: Date::ymd_hms(2000, 01, 01, 0, 0, 0),
581562
}
582563
});
583-
if let Ok(sysroot) = Sysroot::install(&commit, "x86_64-unknown-linux-gnu", false, false)
564+
if let Ok(sysroot) =
565+
Sysroot::install(&commit.sha, commit.date.0, "x86_64-unknown-linux-gnu")
584566
{
585567
let result = out_repo.success(&bench_commit(
586568
Some(&out_repo),
@@ -674,8 +656,8 @@ fn main_result() -> Result<i32, Error> {
674656

675657
("test_benchmarks", Some(_)) => {
676658
if let Some(commit) = get_commits()?.last() {
677-
let sysroot = Sysroot::install(commit, "x86_64-unknown-linux-gnu", false, false)
678-
.map_err(SyncFailure::new)?;
659+
let sysroot =
660+
Sysroot::install(&commit.sha, commit.date.0, "x86_64-unknown-linux-gnu")?;
679661
// filter out servo benchmarks as they simply take too long
680662
bench_commit(
681663
None,

0 commit comments

Comments
 (0)