@@ -27,44 +27,6 @@ use crate::{envify, CLang, DocTests, GitRepo, Mode};
27
27
28
28
const ADB_TEST_DIR : & str = "/data/local/tmp/work" ;
29
29
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
-
68
30
fn try_run ( builder : & Builder < ' _ > , cmd : & mut Command ) -> bool {
69
31
if !builder. fail_fast {
70
32
if !builder. try_run ( cmd) {
@@ -2111,7 +2073,6 @@ impl Step for RustcGuide {
2111
2073
pub struct CrateLibrustc {
2112
2074
compiler : Compiler ,
2113
2075
target : TargetSelection ,
2114
- test_kind : TestKind ,
2115
2076
crates : Vec < Interned < String > > ,
2116
2077
}
2117
2078
@@ -2133,17 +2094,15 @@ impl Step for CrateLibrustc {
2133
2094
. iter ( )
2134
2095
. map ( |p| builder. crate_paths [ & p. assert_single_path ( ) . path ] . clone ( ) )
2135
2096
. collect ( ) ;
2136
- let test_kind = builder. kind . into ( ) ;
2137
2097
2138
- builder. ensure ( CrateLibrustc { compiler, target : run. target , test_kind , crates } ) ;
2098
+ builder. ensure ( CrateLibrustc { compiler, target : run. target , crates } ) ;
2139
2099
}
2140
2100
2141
2101
fn run ( self , builder : & Builder < ' _ > ) {
2142
2102
builder. ensure ( Crate {
2143
2103
compiler : self . compiler ,
2144
2104
target : self . target ,
2145
2105
mode : Mode :: Rustc ,
2146
- test_kind : self . test_kind ,
2147
2106
crates : self . crates ,
2148
2107
} ) ;
2149
2108
}
@@ -2154,7 +2113,6 @@ pub struct Crate {
2154
2113
pub compiler : Compiler ,
2155
2114
pub target : TargetSelection ,
2156
2115
pub mode : Mode ,
2157
- pub test_kind : TestKind ,
2158
2116
pub crates : Vec < Interned < String > > ,
2159
2117
}
2160
2118
@@ -2170,14 +2128,13 @@ impl Step for Crate {
2170
2128
let builder = run. builder ;
2171
2129
let host = run. build_triple ( ) ;
2172
2130
let compiler = builder. compiler_for ( builder. top_stage , host, host) ;
2173
- let test_kind = builder. kind . into ( ) ;
2174
2131
let crates = run
2175
2132
. paths
2176
2133
. iter ( )
2177
2134
. map ( |p| builder. crate_paths [ & p. assert_single_path ( ) . path ] . clone ( ) )
2178
2135
. collect ( ) ;
2179
2136
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 } ) ;
2181
2138
}
2182
2139
2183
2140
/// Runs all unit tests plus documentation tests for a given crate defined
@@ -2192,7 +2149,6 @@ impl Step for Crate {
2192
2149
let compiler = self . compiler ;
2193
2150
let target = self . target ;
2194
2151
let mode = self . mode ;
2195
- let test_kind = self . test_kind ;
2196
2152
2197
2153
builder. ensure ( compile:: Std :: new ( compiler, target) ) ;
2198
2154
builder. ensure ( RemoteCopyLibs { compiler, target } ) ;
@@ -2204,7 +2160,7 @@ impl Step for Crate {
2204
2160
let compiler = builder. compiler_for ( compiler. stage , compiler. host , target) ;
2205
2161
2206
2162
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 ( ) ) ;
2208
2164
match mode {
2209
2165
Mode :: Std => {
2210
2166
compile:: std_cargo ( builder, target, compiler. stage , & mut cargo) ;
@@ -2220,7 +2176,7 @@ impl Step for Crate {
2220
2176
// Pass in some standard flags then iterate over the graph we've discovered
2221
2177
// in `cargo metadata` with the maps above and figure out what `-p`
2222
2178
// arguments need to get passed.
2223
- if test_kind . subcommand ( ) == "test" && !builder. fail_fast {
2179
+ if builder . kind == Kind :: Test && !builder. fail_fast {
2224
2180
cargo. arg ( "--no-fail-fast" ) ;
2225
2181
}
2226
2182
match builder. doc_tests {
@@ -2270,7 +2226,7 @@ impl Step for Crate {
2270
2226
}
2271
2227
2272
2228
let _guard = builder. msg (
2273
- test_kind ,
2229
+ builder . kind ,
2274
2230
compiler. stage ,
2275
2231
crate_description ( & self . crates ) ,
2276
2232
compiler. host ,
@@ -2285,7 +2241,6 @@ impl Step for Crate {
2285
2241
#[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash ) ]
2286
2242
pub struct CrateRustdoc {
2287
2243
host : TargetSelection ,
2288
- test_kind : TestKind ,
2289
2244
}
2290
2245
2291
2246
impl Step for CrateRustdoc {
@@ -2300,13 +2255,10 @@ impl Step for CrateRustdoc {
2300
2255
fn make_run ( run : RunConfig < ' _ > ) {
2301
2256
let builder = run. builder ;
2302
2257
2303
- let test_kind = builder. kind . into ( ) ;
2304
-
2305
- builder. ensure ( CrateRustdoc { host : run. target , test_kind } ) ;
2258
+ builder. ensure ( CrateRustdoc { host : run. target } ) ;
2306
2259
}
2307
2260
2308
2261
fn run ( self , builder : & Builder < ' _ > ) {
2309
- let test_kind = self . test_kind ;
2310
2262
let target = self . host ;
2311
2263
2312
2264
let compiler = if builder. download_rustc ( ) {
@@ -2325,12 +2277,12 @@ impl Step for CrateRustdoc {
2325
2277
compiler,
2326
2278
Mode :: ToolRustc ,
2327
2279
target,
2328
- test_kind . subcommand ( ) ,
2280
+ builder . kind . as_str ( ) ,
2329
2281
"src/tools/rustdoc" ,
2330
2282
SourceType :: InTree ,
2331
2283
& [ ] ,
2332
2284
) ;
2333
- if test_kind . subcommand ( ) == "test" && !builder. fail_fast {
2285
+ if builder . kind == Kind :: Test && !builder. fail_fast {
2334
2286
cargo. arg ( "--no-fail-fast" ) ;
2335
2287
}
2336
2288
match builder. doc_tests {
@@ -2391,7 +2343,7 @@ impl Step for CrateRustdoc {
2391
2343
cargo. arg ( "--quiet" ) ;
2392
2344
}
2393
2345
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) ;
2395
2347
2396
2348
let _time = util:: timeit ( & builder) ;
2397
2349
@@ -2402,7 +2354,6 @@ impl Step for CrateRustdoc {
2402
2354
#[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash ) ]
2403
2355
pub struct CrateRustdocJsonTypes {
2404
2356
host : TargetSelection ,
2405
- test_kind : TestKind ,
2406
2357
}
2407
2358
2408
2359
impl Step for CrateRustdocJsonTypes {
@@ -2417,13 +2368,10 @@ impl Step for CrateRustdocJsonTypes {
2417
2368
fn make_run ( run : RunConfig < ' _ > ) {
2418
2369
let builder = run. builder ;
2419
2370
2420
- let test_kind = builder. kind . into ( ) ;
2421
-
2422
- builder. ensure ( CrateRustdocJsonTypes { host : run. target , test_kind } ) ;
2371
+ builder. ensure ( CrateRustdocJsonTypes { host : run. target } ) ;
2423
2372
}
2424
2373
2425
2374
fn run ( self , builder : & Builder < ' _ > ) {
2426
- let test_kind = self . test_kind ;
2427
2375
let target = self . host ;
2428
2376
2429
2377
// Use the previous stage compiler to reuse the artifacts that are
@@ -2438,12 +2386,12 @@ impl Step for CrateRustdocJsonTypes {
2438
2386
compiler,
2439
2387
Mode :: ToolRustc ,
2440
2388
target,
2441
- test_kind . subcommand ( ) ,
2389
+ builder . kind . as_str ( ) ,
2442
2390
"src/rustdoc-json-types" ,
2443
2391
SourceType :: InTree ,
2444
2392
& [ ] ,
2445
2393
) ;
2446
- if test_kind . subcommand ( ) == "test" && !builder. fail_fast {
2394
+ if builder . kind == Kind :: Test && !builder. fail_fast {
2447
2395
cargo. arg ( "--no-fail-fast" ) ;
2448
2396
}
2449
2397
@@ -2457,7 +2405,7 @@ impl Step for CrateRustdocJsonTypes {
2457
2405
}
2458
2406
2459
2407
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) ;
2461
2409
let _time = util:: timeit ( & builder) ;
2462
2410
2463
2411
add_flags_and_try_run_tests ( builder, & mut cargo. into ( ) ) ;
0 commit comments