@@ -58,6 +58,17 @@ impl fmt::Display for TestKind {
5858 }
5959}
6060
61+ fn try_run ( build : & Build , cmd : & mut Command ) {
62+ if build. flags . cmd . no_fail_fast ( ) {
63+ if !build. try_run ( cmd) {
64+ let failures = build. delayed_failures . get ( ) ;
65+ build. delayed_failures . set ( failures + 1 ) ;
66+ }
67+ } else {
68+ build. run ( cmd) ;
69+ }
70+ }
71+
6172/// Runs the `linkchecker` tool as compiled in `stage` by the `host` compiler.
6273///
6374/// This tool in `src/tools` will verify the validity of all our links in the
@@ -67,8 +78,8 @@ pub fn linkcheck(build: &Build, host: &str) {
6778 let compiler = Compiler :: new ( 0 , host) ;
6879
6980 let _time = util:: timeit ( ) ;
70- build . run ( build. tool_cmd ( & compiler, "linkchecker" )
71- . arg ( build. out . join ( host) . join ( "doc" ) ) ) ;
81+ try_run ( build , build. tool_cmd ( & compiler, "linkchecker" )
82+ . arg ( build. out . join ( host) . join ( "doc" ) ) ) ;
7283}
7384
7485/// Runs the `cargotest` tool as compiled in `stage` by the `host` compiler.
@@ -87,10 +98,10 @@ pub fn cargotest(build: &Build, stage: u32, host: &str) {
8798 let _time = util:: timeit ( ) ;
8899 let mut cmd = Command :: new ( build. tool ( & Compiler :: new ( 0 , host) , "cargotest" ) ) ;
89100 build. prepare_tool_cmd ( compiler, & mut cmd) ;
90- build . run ( cmd. arg ( & build. cargo )
91- . arg ( & out_dir)
92- . env ( "RUSTC" , build. compiler_path ( compiler) )
93- . env ( "RUSTDOC" , build. rustdoc ( compiler) ) )
101+ try_run ( build , cmd. arg ( & build. cargo )
102+ . arg ( & out_dir)
103+ . env ( "RUSTC" , build. compiler_path ( compiler) )
104+ . env ( "RUSTDOC" , build. rustdoc ( compiler) ) ) ;
94105}
95106
96107/// Runs `cargo test` for `cargo` packaged with Rust.
@@ -107,6 +118,9 @@ pub fn cargo(build: &Build, stage: u32, host: &str) {
107118
108119 let mut cargo = build. cargo ( compiler, Mode :: Tool , host, "test" ) ;
109120 cargo. arg ( "--manifest-path" ) . arg ( build. src . join ( "src/tools/cargo/Cargo.toml" ) ) ;
121+ if build. flags . cmd . no_fail_fast ( ) {
122+ cargo. arg ( "--no-fail-fast" ) ;
123+ }
110124
111125 // Don't build tests dynamically, just a pain to work with
112126 cargo. env ( "RUSTC_NO_PREFER_DYNAMIC" , "1" ) ;
@@ -115,7 +129,7 @@ pub fn cargo(build: &Build, stage: u32, host: &str) {
115129 // available.
116130 cargo. env ( "CFG_DISABLE_CROSS_TESTS" , "1" ) ;
117131
118- build . run ( cargo. env ( "PATH" , newpath) ) ;
132+ try_run ( build , cargo. env ( "PATH" , newpath) ) ;
119133}
120134
121135/// Runs the `tidy` tool as compiled in `stage` by the `host` compiler.
@@ -131,7 +145,7 @@ pub fn tidy(build: &Build, host: &str) {
131145 if !build. config . vendor {
132146 cmd. arg ( "--no-vendor" ) ;
133147 }
134- build . run ( & mut cmd) ;
148+ try_run ( build , & mut cmd) ;
135149}
136150
137151fn testdir ( build : & Build , host : & str ) -> PathBuf {
@@ -279,7 +293,7 @@ pub fn compiletest(build: &Build,
279293 }
280294
281295 let _time = util:: timeit ( ) ;
282- build . run ( & mut cmd) ;
296+ try_run ( build , & mut cmd) ;
283297}
284298
285299/// Run `rustdoc --test` for all documentation in `src/doc`.
@@ -355,7 +369,7 @@ fn markdown_test(build: &Build, compiler: &Compiler, markdown: &Path) {
355369 }
356370 cmd. arg ( "--test-args" ) . arg ( test_args) ;
357371
358- build . run ( & mut cmd) ;
372+ try_run ( build , & mut cmd) ;
359373}
360374
361375/// Run all unit tests plus documentation tests for an entire crate DAG defined
@@ -406,6 +420,9 @@ pub fn krate(build: &Build,
406420 cargo. arg ( "--manifest-path" )
407421 . arg ( build. src . join ( path) . join ( "Cargo.toml" ) )
408422 . arg ( "--features" ) . arg ( features) ;
423+ if test_kind. subcommand ( ) == "test" && build. flags . cmd . no_fail_fast ( ) {
424+ cargo. arg ( "--no-fail-fast" ) ;
425+ }
409426
410427 match krate {
411428 Some ( krate) => {
@@ -465,7 +482,7 @@ pub fn krate(build: &Build,
465482 krate_remote ( build, & compiler, target, mode) ;
466483 } else {
467484 cargo. args ( & build. flags . cmd . test_args ( ) ) ;
468- build . run ( & mut cargo) ;
485+ try_run ( build , & mut cargo) ;
469486 }
470487}
471488
@@ -486,7 +503,7 @@ fn krate_emscripten(build: &Build,
486503 if build. config . quiet_tests {
487504 cmd. arg ( "--quiet" ) ;
488505 }
489- build . run ( & mut cmd) ;
506+ try_run ( build , & mut cmd) ;
490507 }
491508}
492509
@@ -508,7 +525,7 @@ fn krate_remote(build: &Build,
508525 cmd. arg ( "--quiet" ) ;
509526 }
510527 cmd. args ( & build. flags . cmd . test_args ( ) ) ;
511- build . run ( & mut cmd) ;
528+ try_run ( build , & mut cmd) ;
512529 }
513530}
514531
@@ -624,6 +641,9 @@ pub fn bootstrap(build: &Build) {
624641 . current_dir ( build. src . join ( "src/bootstrap" ) )
625642 . env ( "CARGO_TARGET_DIR" , build. out . join ( "bootstrap" ) )
626643 . env ( "RUSTC" , & build. rustc ) ;
644+ if build. flags . cmd . no_fail_fast ( ) {
645+ cmd. arg ( "--no-fail-fast" ) ;
646+ }
627647 cmd. arg ( "--" ) . args ( & build. flags . cmd . test_args ( ) ) ;
628- build . run ( & mut cmd) ;
648+ try_run ( build , & mut cmd) ;
629649}
0 commit comments