mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
Auto merge of #44680 - infinity0:master, r=Mark-Simulacrum
rustbuild: with --no-fail-fast, report the specific commands that failed I'm not sure this is the most elegant way of doing it, I'm still a bit of a rust noob. I tried `Vec<Command>` and keeping `Cell` instead of `RefCell` but couldn't fight my way past the borrow errors, this was the first arrangement that I could make work.
This commit is contained in:
commit
06bb0e01be
@ -68,8 +68,8 @@ impl fmt::Display for TestKind {
|
||||
fn try_run_expecting(build: &Build, cmd: &mut Command, expect: BuildExpectation) {
|
||||
if !build.fail_fast {
|
||||
if !build.try_run(cmd, expect) {
|
||||
let failures = build.delayed_failures.get();
|
||||
build.delayed_failures.set(failures + 1);
|
||||
let mut failures = build.delayed_failures.borrow_mut();
|
||||
failures.push(format!("{:?}", cmd));
|
||||
}
|
||||
} else {
|
||||
build.run_expecting(cmd, expect);
|
||||
@ -83,8 +83,8 @@ fn try_run(build: &Build, cmd: &mut Command) {
|
||||
fn try_run_quiet(build: &Build, cmd: &mut Command) {
|
||||
if !build.fail_fast {
|
||||
if !build.try_run_quiet(cmd) {
|
||||
let failures = build.delayed_failures.get();
|
||||
build.delayed_failures.set(failures + 1);
|
||||
let mut failures = build.delayed_failures.borrow_mut();
|
||||
failures.push(format!("{:?}", cmd));
|
||||
}
|
||||
} else {
|
||||
build.run_quiet(cmd);
|
||||
|
@ -134,13 +134,13 @@ extern crate toml;
|
||||
#[cfg(unix)]
|
||||
extern crate libc;
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::{HashSet, HashMap};
|
||||
use std::env;
|
||||
use std::fs::{self, File};
|
||||
use std::io::Read;
|
||||
use std::path::{PathBuf, Path};
|
||||
use std::process::Command;
|
||||
use std::process::{self, Command};
|
||||
use std::slice;
|
||||
|
||||
use build_helper::{run_silent, run_suppressed, try_run_silent, try_run_suppressed, output, mtime,
|
||||
@ -247,7 +247,7 @@ pub struct Build {
|
||||
crates: HashMap<Interned<String>, Crate>,
|
||||
is_sudo: bool,
|
||||
ci_env: CiEnv,
|
||||
delayed_failures: Cell<usize>,
|
||||
delayed_failures: RefCell<Vec<String>>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -329,7 +329,7 @@ impl Build {
|
||||
lldb_python_dir: None,
|
||||
is_sudo,
|
||||
ci_env: CiEnv::current(),
|
||||
delayed_failures: Cell::new(0),
|
||||
delayed_failures: RefCell::new(Vec::new()),
|
||||
}
|
||||
}
|
||||
|
||||
@ -368,6 +368,16 @@ impl Build {
|
||||
metadata::build(self);
|
||||
|
||||
builder::Builder::run(&self);
|
||||
|
||||
// Check for postponed failures from `test --no-fail-fast`.
|
||||
let failures = self.delayed_failures.borrow();
|
||||
if failures.len() > 0 {
|
||||
println!("\n{} command(s) did not execute successfully:\n", failures.len());
|
||||
for failure in failures.iter() {
|
||||
println!(" - {}\n", failure);
|
||||
}
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/// Clear out `dir` if `input` is newer.
|
||||
|
Loading…
Reference in New Issue
Block a user