Skip to content

[Nothing to see here] Just borrowing Travis #48867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ matrix:
fast_finish: true
include:
# Images used in testing PR and try-build should be run first.
- env: IMAGE=x86_64-gnu-llvm-3.9 RUST_BACKTRACE=1
- env: IMAGE=x86_64-gnu-llvm-3.9 RUST_BACKTRACE=1 BOOTSTRAP_TIMING=true
if: type = pull_request OR branch = auto

- env: IMAGE=dist-x86_64-linux DEPLOY=1
Expand Down
32 changes: 30 additions & 2 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use std::ffi::OsString;
use std::str::FromStr;
use std::path::PathBuf;
use std::process::{Command, ExitStatus};
use std::time::{SystemTime, UNIX_EPOCH};

fn main() {
let mut args = env::args_os().skip(1).collect::<Vec<_>>();
Expand Down Expand Up @@ -104,6 +105,7 @@ fn main() {
.env(bootstrap::util::dylib_path_var(),
env::join_paths(&dylib_path).unwrap());

let mut crate_name_opt = None;
if let Some(target) = target {
// The stage0 compiler has a special sysroot distinct from what we
// actually downloaded, so we just always pass the `--sysroot` option.
Expand Down Expand Up @@ -134,6 +136,7 @@ fn main() {
.find(|a| &*a[0] == "--crate-name")
.unwrap();
let crate_name = &*crate_name[1];
crate_name_opt = crate_name.to_str();

// If we're compiling specifically the `panic_abort` crate then we pass
// the `-C panic=abort` option. Note that we do not do this for any
Expand Down Expand Up @@ -282,9 +285,26 @@ fn main() {
eprintln!("rustc command: {:?}", cmd);
}

let do_timing = crate_name_opt.is_some() &&
true; // env::var("BOOTSTRAP_TIMING") == Ok("true".to_string());
if do_timing {
let dur = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
eprintln!("(BOOTSTRAP_TIMING start stage{} {} at {:?})",
stage, crate_name_opt.unwrap(), dur);
}
let after = || {
if do_timing {
let dur = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
eprintln!("(BOOTSTRAP_TIMING finish stage{} {} at {:?})",
stage, crate_name_opt.unwrap(), dur);
}
};

// Actually run the compiler!
std::process::exit(if let Some(ref mut on_fail) = on_fail {
match cmd.status() {
let st = cmd.status();
after();
match st {
Ok(s) if s.success() => 0,
_ => {
println!("\nDid not run successfully:\n{:?}\n-------------", cmd);
Expand All @@ -293,7 +313,15 @@ fn main() {
}
}
} else {
std::process::exit(match exec_cmd(&mut cmd) {
let st =
if do_timing {
let st = cmd.status();
after();
st
} else {
exec_cmd(&mut cmd)
};
std::process::exit(match st {
Ok(s) => s.code().unwrap_or(0xfe),
Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e),
})
Expand Down