@@ -2108,6 +2108,25 @@ impl Step for CrateLibrustc {
2108
2108
}
2109
2109
}
2110
2110
2111
+ // Given a `cargo test` subcommand, pass it the appropriate test flags given a `builder`.
2112
+ fn cargo_test_args ( cargo : & mut Command , libtest_args : & [ & str ] , _crates : & [ & str ] , builder : & Builder < ' _ > ) {
2113
+ if !builder. fail_fast {
2114
+ cargo. arg ( "--no-fail-fast" ) ;
2115
+ }
2116
+ match builder. doc_tests {
2117
+ DocTests :: Only => {
2118
+ cargo. arg ( "--doc" ) ;
2119
+ }
2120
+ DocTests :: No => {
2121
+ cargo. args ( & [ "--lib" , "--bins" , "--examples" , "--tests" , "--benches" ] ) ;
2122
+ }
2123
+ DocTests :: Yes => { }
2124
+ }
2125
+
2126
+ cargo. arg ( "--" ) . args ( & builder. config . cmd . test_args ( ) ) . args ( libtest_args) ;
2127
+ add_flags_and_try_run_tests ( builder, cargo) ;
2128
+ }
2129
+
2111
2130
#[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
2112
2131
pub struct Crate {
2113
2132
pub compiler : Compiler ,
@@ -2560,24 +2579,9 @@ impl Step for Bootstrap {
2560
2579
// https://github.com/rust-lang/rust/issues/49215
2561
2580
cmd. env ( "RUSTFLAGS" , flags) ;
2562
2581
}
2563
- if !builder. fail_fast {
2564
- cmd. arg ( "--no-fail-fast" ) ;
2565
- }
2566
- match builder. doc_tests {
2567
- DocTests :: Only => {
2568
- cmd. arg ( "--doc" ) ;
2569
- }
2570
- DocTests :: No => {
2571
- cmd. args ( & [ "--lib" , "--bins" , "--examples" , "--tests" , "--benches" ] ) ;
2572
- }
2573
- DocTests :: Yes => { }
2574
- }
2575
-
2576
- cmd. arg ( "--" ) . args ( & builder. config . cmd . test_args ( ) ) ;
2577
2582
// rustbuild tests are racy on directory creation so just run them one at a time.
2578
2583
// Since there's not many this shouldn't be a problem.
2579
- cmd. arg ( "--test-threads=1" ) ;
2580
- add_flags_and_try_run_tests ( builder, & mut cmd) ;
2584
+ cargo_test_args ( & mut cmd, & [ "--test-threads=1" ] , & [ ] , builder) ;
2581
2585
}
2582
2586
2583
2587
fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
0 commit comments