@@ -58,6 +58,28 @@ impl fmt::Display for TestKind {
58
58
}
59
59
}
60
60
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
+
72
+ fn try_run_quiet ( build : & Build , cmd : & mut Command ) {
73
+ if build. flags . cmd . no_fail_fast ( ) {
74
+ if !build. try_run_quiet ( cmd) {
75
+ let failures = build. delayed_failures . get ( ) ;
76
+ build. delayed_failures . set ( failures + 1 ) ;
77
+ }
78
+ } else {
79
+ build. run_quiet ( cmd) ;
80
+ }
81
+ }
82
+
61
83
/// Runs the `linkchecker` tool as compiled in `stage` by the `host` compiler.
62
84
///
63
85
/// This tool in `src/tools` will verify the validity of all our links in the
@@ -67,8 +89,8 @@ pub fn linkcheck(build: &Build, host: &str) {
67
89
let compiler = Compiler :: new ( 0 , host) ;
68
90
69
91
let _time = util:: timeit ( ) ;
70
- build . run ( build. tool_cmd ( & compiler, "linkchecker" )
71
- . arg ( build. out . join ( host) . join ( "doc" ) ) ) ;
92
+ try_run ( build , build. tool_cmd ( & compiler, "linkchecker" )
93
+ . arg ( build. out . join ( host) . join ( "doc" ) ) ) ;
72
94
}
73
95
74
96
/// Runs the `cargotest` tool as compiled in `stage` by the `host` compiler.
@@ -87,10 +109,10 @@ pub fn cargotest(build: &Build, stage: u32, host: &str) {
87
109
let _time = util:: timeit ( ) ;
88
110
let mut cmd = Command :: new ( build. tool ( & Compiler :: new ( 0 , host) , "cargotest" ) ) ;
89
111
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) ) )
112
+ try_run ( build , cmd. arg ( & build. cargo )
113
+ . arg ( & out_dir)
114
+ . env ( "RUSTC" , build. compiler_path ( compiler) )
115
+ . env ( "RUSTDOC" , build. rustdoc ( compiler) ) ) ;
94
116
}
95
117
96
118
/// Runs `cargo test` for `cargo` packaged with Rust.
@@ -107,6 +129,9 @@ pub fn cargo(build: &Build, stage: u32, host: &str) {
107
129
108
130
let mut cargo = build. cargo ( compiler, Mode :: Tool , host, "test" ) ;
109
131
cargo. arg ( "--manifest-path" ) . arg ( build. src . join ( "src/tools/cargo/Cargo.toml" ) ) ;
132
+ if build. flags . cmd . no_fail_fast ( ) {
133
+ cargo. arg ( "--no-fail-fast" ) ;
134
+ }
110
135
111
136
// Don't build tests dynamically, just a pain to work with
112
137
cargo. env ( "RUSTC_NO_PREFER_DYNAMIC" , "1" ) ;
@@ -115,7 +140,7 @@ pub fn cargo(build: &Build, stage: u32, host: &str) {
115
140
// available.
116
141
cargo. env ( "CFG_DISABLE_CROSS_TESTS" , "1" ) ;
117
142
118
- build . run ( cargo. env ( "PATH" , newpath) ) ;
143
+ try_run ( build , cargo. env ( "PATH" , newpath) ) ;
119
144
}
120
145
121
146
/// Runs the `tidy` tool as compiled in `stage` by the `host` compiler.
@@ -135,7 +160,7 @@ pub fn tidy(build: &Build, host: &str) {
135
160
if build. config . quiet_tests {
136
161
cmd. arg ( "--quiet" ) ;
137
162
}
138
- build . run ( & mut cmd) ;
163
+ try_run ( build , & mut cmd) ;
139
164
}
140
165
141
166
fn testdir ( build : & Build , host : & str ) -> PathBuf {
@@ -286,7 +311,7 @@ pub fn compiletest(build: &Build,
286
311
build. ci_env . force_coloring_in_ci ( & mut cmd) ;
287
312
288
313
let _time = util:: timeit ( ) ;
289
- build . run ( & mut cmd) ;
314
+ try_run ( build , & mut cmd) ;
290
315
}
291
316
292
317
/// Run `rustdoc --test` for all documentation in `src/doc`.
@@ -362,9 +387,9 @@ fn markdown_test(build: &Build, compiler: &Compiler, markdown: &Path) {
362
387
cmd. arg ( "--test-args" ) . arg ( test_args) ;
363
388
364
389
if build. config . quiet_tests {
365
- build . run_quiet ( & mut cmd) ;
390
+ try_run_quiet ( build , & mut cmd) ;
366
391
} else {
367
- build . run ( & mut cmd) ;
392
+ try_run ( build , & mut cmd) ;
368
393
}
369
394
}
370
395
@@ -419,6 +444,9 @@ pub fn krate(build: &Build,
419
444
cargo. arg ( "--manifest-path" )
420
445
. arg ( build. src . join ( path) . join ( "Cargo.toml" ) )
421
446
. arg ( "--features" ) . arg ( features) ;
447
+ if test_kind. subcommand ( ) == "test" && build. flags . cmd . no_fail_fast ( ) {
448
+ cargo. arg ( "--no-fail-fast" ) ;
449
+ }
422
450
423
451
match krate {
424
452
Some ( krate) => {
@@ -478,7 +506,7 @@ pub fn krate(build: &Build,
478
506
krate_remote ( build, & compiler, target, mode) ;
479
507
} else {
480
508
cargo. args ( & build. flags . cmd . test_args ( ) ) ;
481
- build . run ( & mut cargo) ;
509
+ try_run ( build , & mut cargo) ;
482
510
}
483
511
}
484
512
@@ -499,7 +527,7 @@ fn krate_emscripten(build: &Build,
499
527
if build. config . quiet_tests {
500
528
cmd. arg ( "--quiet" ) ;
501
529
}
502
- build . run ( & mut cmd) ;
530
+ try_run ( build , & mut cmd) ;
503
531
}
504
532
}
505
533
@@ -521,7 +549,7 @@ fn krate_remote(build: &Build,
521
549
cmd. arg ( "--quiet" ) ;
522
550
}
523
551
cmd. args ( & build. flags . cmd . test_args ( ) ) ;
524
- build . run ( & mut cmd) ;
552
+ try_run ( build , & mut cmd) ;
525
553
}
526
554
}
527
555
@@ -637,6 +665,9 @@ pub fn bootstrap(build: &Build) {
637
665
. current_dir ( build. src . join ( "src/bootstrap" ) )
638
666
. env ( "CARGO_TARGET_DIR" , build. out . join ( "bootstrap" ) )
639
667
. env ( "RUSTC" , & build. rustc ) ;
668
+ if build. flags . cmd . no_fail_fast ( ) {
669
+ cmd. arg ( "--no-fail-fast" ) ;
670
+ }
640
671
cmd. arg ( "--" ) . args ( & build. flags . cmd . test_args ( ) ) ;
641
- build . run ( & mut cmd) ;
672
+ try_run ( build , & mut cmd) ;
642
673
}
0 commit comments