@@ -2101,6 +2101,25 @@ impl Step for CrateLibrustc {
2101
2101
}
2102
2102
}
2103
2103
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
+
2104
2123
#[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
2105
2124
pub struct Crate {
2106
2125
pub compiler : Compiler ,
@@ -2564,24 +2583,9 @@ impl Step for Bootstrap {
2564
2583
// https://github.com/rust-lang/rust/issues/49215
2565
2584
cmd. env ( "RUSTFLAGS" , flags) ;
2566
2585
}
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 ( ) ) ;
2581
2586
// rustbuild tests are racy on directory creation so just run them one at a time.
2582
2587
// 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) ;
2585
2589
}
2586
2590
2587
2591
fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
0 commit comments