@@ -27,44 +27,6 @@ use crate::{envify, CLang, DocTests, GitRepo, Mode};
2727
2828const ADB_TEST_DIR : & str = "/data/local/tmp/work" ;
2929
30- /// The two modes of the test runner; tests or benchmarks.
31- #[ derive( Debug , PartialEq , Eq , Hash , Copy , Clone , PartialOrd , Ord ) ]
32- pub enum TestKind {
33- /// Run `cargo test`.
34- Test ,
35- /// Run `cargo bench`.
36- Bench ,
37- }
38-
39- impl From < Kind > for TestKind {
40- fn from ( kind : Kind ) -> Self {
41- match kind {
42- Kind :: Test => TestKind :: Test ,
43- Kind :: Bench => TestKind :: Bench ,
44- _ => panic ! ( "unexpected kind in crate: {:?}" , kind) ,
45- }
46- }
47- }
48-
49- impl TestKind {
50- // Return the cargo subcommand for this test kind
51- fn subcommand ( self ) -> & ' static str {
52- match self {
53- TestKind :: Test => "test" ,
54- TestKind :: Bench => "bench" ,
55- }
56- }
57- }
58-
59- impl Into < Kind > for TestKind {
60- fn into ( self ) -> Kind {
61- match self {
62- TestKind :: Test => Kind :: Test ,
63- TestKind :: Bench => Kind :: Bench ,
64- }
65- }
66- }
67-
6830fn try_run ( builder : & Builder < ' _ > , cmd : & mut Command ) -> bool {
6931 if !builder. fail_fast {
7032 if !builder. try_run ( cmd) {
@@ -2111,7 +2073,6 @@ impl Step for RustcGuide {
21112073pub struct CrateLibrustc {
21122074 compiler : Compiler ,
21132075 target : TargetSelection ,
2114- test_kind : TestKind ,
21152076 crates : Vec < Interned < String > > ,
21162077}
21172078
@@ -2133,17 +2094,15 @@ impl Step for CrateLibrustc {
21332094 . iter ( )
21342095 . map ( |p| builder. crate_paths [ & p. assert_single_path ( ) . path ] . clone ( ) )
21352096 . collect ( ) ;
2136- let test_kind = builder. kind . into ( ) ;
21372097
2138- builder. ensure ( CrateLibrustc { compiler, target : run. target , test_kind , crates } ) ;
2098+ builder. ensure ( CrateLibrustc { compiler, target : run. target , crates } ) ;
21392099 }
21402100
21412101 fn run ( self , builder : & Builder < ' _ > ) {
21422102 builder. ensure ( Crate {
21432103 compiler : self . compiler ,
21442104 target : self . target ,
21452105 mode : Mode :: Rustc ,
2146- test_kind : self . test_kind ,
21472106 crates : self . crates ,
21482107 } ) ;
21492108 }
@@ -2154,7 +2113,6 @@ pub struct Crate {
21542113 pub compiler : Compiler ,
21552114 pub target : TargetSelection ,
21562115 pub mode : Mode ,
2157- pub test_kind : TestKind ,
21582116 pub crates : Vec < Interned < String > > ,
21592117}
21602118
@@ -2170,14 +2128,13 @@ impl Step for Crate {
21702128 let builder = run. builder ;
21712129 let host = run. build_triple ( ) ;
21722130 let compiler = builder. compiler_for ( builder. top_stage , host, host) ;
2173- let test_kind = builder. kind . into ( ) ;
21742131 let crates = run
21752132 . paths
21762133 . iter ( )
21772134 . map ( |p| builder. crate_paths [ & p. assert_single_path ( ) . path ] . clone ( ) )
21782135 . collect ( ) ;
21792136
2180- builder. ensure ( Crate { compiler, target : run. target , mode : Mode :: Std , test_kind , crates } ) ;
2137+ builder. ensure ( Crate { compiler, target : run. target , mode : Mode :: Std , crates } ) ;
21812138 }
21822139
21832140 /// Runs all unit tests plus documentation tests for a given crate defined
@@ -2192,7 +2149,6 @@ impl Step for Crate {
21922149 let compiler = self . compiler ;
21932150 let target = self . target ;
21942151 let mode = self . mode ;
2195- let test_kind = self . test_kind ;
21962152
21972153 builder. ensure ( compile:: Std :: new ( compiler, target) ) ;
21982154 builder. ensure ( RemoteCopyLibs { compiler, target } ) ;
@@ -2204,7 +2160,7 @@ impl Step for Crate {
22042160 let compiler = builder. compiler_for ( compiler. stage , compiler. host , target) ;
22052161
22062162 let mut cargo =
2207- builder. cargo ( compiler, mode, SourceType :: InTree , target, test_kind . subcommand ( ) ) ;
2163+ builder. cargo ( compiler, mode, SourceType :: InTree , target, builder . kind . as_str ( ) ) ;
22082164 match mode {
22092165 Mode :: Std => {
22102166 compile:: std_cargo ( builder, target, compiler. stage , & mut cargo) ;
@@ -2220,7 +2176,7 @@ impl Step for Crate {
22202176 // Pass in some standard flags then iterate over the graph we've discovered
22212177 // in `cargo metadata` with the maps above and figure out what `-p`
22222178 // arguments need to get passed.
2223- if test_kind . subcommand ( ) == "test" && !builder. fail_fast {
2179+ if builder . kind == Kind :: Test && !builder. fail_fast {
22242180 cargo. arg ( "--no-fail-fast" ) ;
22252181 }
22262182 match builder. doc_tests {
@@ -2270,7 +2226,7 @@ impl Step for Crate {
22702226 }
22712227
22722228 let _guard = builder. msg (
2273- test_kind ,
2229+ builder . kind ,
22742230 compiler. stage ,
22752231 crate_description ( & self . crates ) ,
22762232 compiler. host ,
@@ -2285,7 +2241,6 @@ impl Step for Crate {
22852241#[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash ) ]
22862242pub struct CrateRustdoc {
22872243 host : TargetSelection ,
2288- test_kind : TestKind ,
22892244}
22902245
22912246impl Step for CrateRustdoc {
@@ -2300,13 +2255,10 @@ impl Step for CrateRustdoc {
23002255 fn make_run ( run : RunConfig < ' _ > ) {
23012256 let builder = run. builder ;
23022257
2303- let test_kind = builder. kind . into ( ) ;
2304-
2305- builder. ensure ( CrateRustdoc { host : run. target , test_kind } ) ;
2258+ builder. ensure ( CrateRustdoc { host : run. target } ) ;
23062259 }
23072260
23082261 fn run ( self , builder : & Builder < ' _ > ) {
2309- let test_kind = self . test_kind ;
23102262 let target = self . host ;
23112263
23122264 let compiler = if builder. download_rustc ( ) {
@@ -2325,12 +2277,12 @@ impl Step for CrateRustdoc {
23252277 compiler,
23262278 Mode :: ToolRustc ,
23272279 target,
2328- test_kind . subcommand ( ) ,
2280+ builder . kind . as_str ( ) ,
23292281 "src/tools/rustdoc" ,
23302282 SourceType :: InTree ,
23312283 & [ ] ,
23322284 ) ;
2333- if test_kind . subcommand ( ) == "test" && !builder. fail_fast {
2285+ if builder . kind == Kind :: Test && !builder. fail_fast {
23342286 cargo. arg ( "--no-fail-fast" ) ;
23352287 }
23362288 match builder. doc_tests {
@@ -2391,7 +2343,7 @@ impl Step for CrateRustdoc {
23912343 cargo. arg ( "--quiet" ) ;
23922344 }
23932345
2394- let _guard = builder. msg ( test_kind , compiler. stage , "rustdoc" , compiler. host , target) ;
2346+ let _guard = builder. msg ( builder . kind , compiler. stage , "rustdoc" , compiler. host , target) ;
23952347
23962348 let _time = util:: timeit ( & builder) ;
23972349
@@ -2402,7 +2354,6 @@ impl Step for CrateRustdoc {
24022354#[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash ) ]
24032355pub struct CrateRustdocJsonTypes {
24042356 host : TargetSelection ,
2405- test_kind : TestKind ,
24062357}
24072358
24082359impl Step for CrateRustdocJsonTypes {
@@ -2417,13 +2368,10 @@ impl Step for CrateRustdocJsonTypes {
24172368 fn make_run ( run : RunConfig < ' _ > ) {
24182369 let builder = run. builder ;
24192370
2420- let test_kind = builder. kind . into ( ) ;
2421-
2422- builder. ensure ( CrateRustdocJsonTypes { host : run. target , test_kind } ) ;
2371+ builder. ensure ( CrateRustdocJsonTypes { host : run. target } ) ;
24232372 }
24242373
24252374 fn run ( self , builder : & Builder < ' _ > ) {
2426- let test_kind = self . test_kind ;
24272375 let target = self . host ;
24282376
24292377 // Use the previous stage compiler to reuse the artifacts that are
@@ -2438,12 +2386,12 @@ impl Step for CrateRustdocJsonTypes {
24382386 compiler,
24392387 Mode :: ToolRustc ,
24402388 target,
2441- test_kind . subcommand ( ) ,
2389+ builder . kind . as_str ( ) ,
24422390 "src/rustdoc-json-types" ,
24432391 SourceType :: InTree ,
24442392 & [ ] ,
24452393 ) ;
2446- if test_kind . subcommand ( ) == "test" && !builder. fail_fast {
2394+ if builder . kind == Kind :: Test && !builder. fail_fast {
24472395 cargo. arg ( "--no-fail-fast" ) ;
24482396 }
24492397
@@ -2457,7 +2405,7 @@ impl Step for CrateRustdocJsonTypes {
24572405 }
24582406
24592407 let _guard =
2460- builder. msg ( test_kind , compiler. stage , "rustdoc-json-types" , compiler. host , target) ;
2408+ builder. msg ( builder . kind , compiler. stage , "rustdoc-json-types" , compiler. host , target) ;
24612409 let _time = util:: timeit ( & builder) ;
24622410
24632411 add_flags_and_try_run_tests ( builder, & mut cargo. into ( ) ) ;
0 commit comments