@@ -2101,6 +2101,25 @@ impl Step for CrateLibrustc {
21012101 }
21022102}
21032103
2104+ // Given a `cargo test` subcommand, pass it the appropriate test flags given a `builder`.
2105+ fn cargo_test_args ( cargo : & mut Command , libtest_args : & [ & str ] , _crates : & [ & str ] , builder : & Builder < ' _ > ) {
2106+ if !builder. fail_fast {
2107+ cargo. arg ( "--no-fail-fast" ) ;
2108+ }
2109+ match builder. doc_tests {
2110+ DocTests :: Only => {
2111+ cargo. arg ( "--doc" ) ;
2112+ }
2113+ DocTests :: No => {
2114+ cargo. args ( & [ "--lib" , "--bins" , "--examples" , "--tests" , "--benches" ] ) ;
2115+ }
2116+ DocTests :: Yes => { }
2117+ }
2118+
2119+ cargo. arg ( "--" ) . args ( & builder. config . cmd . test_args ( ) ) . args ( libtest_args) ;
2120+ add_flags_and_try_run_tests ( builder, cargo) ;
2121+ }
2122+
21042123#[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
21052124pub struct Crate {
21062125 pub compiler : Compiler ,
@@ -2564,24 +2583,9 @@ impl Step for Bootstrap {
25642583 // https://github.com/rust-lang/rust/issues/49215
25652584 cmd. env ( "RUSTFLAGS" , flags) ;
25662585 }
2567- if !builder. fail_fast {
2568- cmd. arg ( "--no-fail-fast" ) ;
2569- }
2570- match builder. doc_tests {
2571- DocTests :: Only => {
2572- cmd. arg ( "--doc" ) ;
2573- }
2574- DocTests :: No => {
2575- cmd. args ( & [ "--lib" , "--bins" , "--examples" , "--tests" , "--benches" ] ) ;
2576- }
2577- DocTests :: Yes => { }
2578- }
2579-
2580- cmd. arg ( "--" ) . args ( & builder. config . cmd . test_args ( ) ) ;
25812586 // rustbuild tests are racy on directory creation so just run them one at a time.
25822587 // Since there's not many this shouldn't be a problem.
2583- cmd. arg ( "--test-threads=1" ) ;
2584- add_flags_and_try_run_tests ( builder, & mut cmd) ;
2588+ cargo_test_args ( & mut cmd, & [ "--test-threads=1" ] , & [ ] , builder) ;
25852589 }
25862590
25872591 fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
0 commit comments