about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-09-18 23:46:15 +0000
committerbors <bors@rust-lang.org>2017-09-18 23:46:15 +0000
commit06bb0e01be7e6774caff3dccf7e60a8f321cc586 (patch)
tree35a7a028ee2c15d7738d668eb93f2a2d47c46e31 /src
parent0701b37d97d08da7074ece7a7dcb4449498f4bfa (diff)
parent8f25497d78dd2b8e52e2b845f145ed215ae5048e (diff)
downloadrust-06bb0e01be7e6774caff3dccf7e60a8f321cc586.tar.gz
rust-06bb0e01be7e6774caff3dccf7e60a8f321cc586.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/check.rs8
-rw-r--r--src/bootstrap/lib.rs18
2 files changed, 18 insertions, 8 deletions
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
index 95ac2be5423..25266fc538f 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -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);
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 6bca17c8ba8..06c7c4c2faf 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -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.