@@ -41,16 +41,31 @@ const ADB_TEST_DIR: &str = "/data/tmp/work";
41
41
/// The two modes of the test runner; tests or benchmarks.
42
42
#[ derive( Debug , PartialEq , Eq , Hash , Copy , Clone , PartialOrd , Ord ) ]
43
43
pub enum TestKind {
44
+ /// Run `cargo bless`
45
+ Bless ,
44
46
/// Run `cargo test`
45
47
Test ,
46
48
/// Run `cargo bench`
47
49
Bench ,
48
50
}
49
51
52
+ impl From < Kind > for TestKind {
53
+ fn from ( kind : Kind ) -> Self {
54
+ match kind {
55
+ Kind :: Test => TestKind :: Test ,
56
+ Kind :: Bless => TestKind :: Bless ,
57
+ Kind :: Bench => TestKind :: Bench ,
58
+ _ => panic ! ( "unexpected kind in crate: {:?}" , kind)
59
+ }
60
+ }
61
+ }
62
+
50
63
impl TestKind {
51
64
// Return the cargo subcommand for this test kind
52
65
fn subcommand ( self ) -> & ' static str {
53
66
match self {
67
+ // bless and test are both `test` for folder names and cargo subcommands
68
+ TestKind :: Bless |
54
69
TestKind :: Test => "test" ,
55
70
TestKind :: Bench => "bench" ,
56
71
}
@@ -60,6 +75,7 @@ impl TestKind {
60
75
impl fmt:: Display for TestKind {
61
76
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
62
77
f. write_str ( match * self {
78
+ TestKind :: Bless => "Testing (bless)" ,
63
79
TestKind :: Test => "Testing" ,
64
80
TestKind :: Bench => "Benchmarking" ,
65
81
} )
@@ -951,6 +967,10 @@ impl Step for Compiletest {
951
967
cmd. arg ( "--host" ) . arg ( & * compiler. host ) ;
952
968
cmd. arg ( "--llvm-filecheck" ) . arg ( builder. llvm_filecheck ( builder. config . build ) ) ;
953
969
970
+ if builder. kind == Kind :: Bless {
971
+ cmd. arg ( "--bless" ) ;
972
+ }
973
+
954
974
if let Some ( ref nodejs) = builder. config . nodejs {
955
975
cmd. arg ( "--nodejs" ) . arg ( nodejs) ;
956
976
}
@@ -1342,13 +1362,7 @@ impl Step for CrateLibrustc {
1342
1362
1343
1363
for krate in builder. in_tree_crates ( "rustc-main" ) {
1344
1364
if run. path . ends_with ( & krate. path ) {
1345
- let test_kind = if builder. kind == Kind :: Test {
1346
- TestKind :: Test
1347
- } else if builder. kind == Kind :: Bench {
1348
- TestKind :: Bench
1349
- } else {
1350
- panic ! ( "unexpected builder.kind in crate: {:?}" , builder. kind) ;
1351
- } ;
1365
+ let test_kind = builder. kind . into ( ) ;
1352
1366
1353
1367
builder. ensure ( CrateLibrustc {
1354
1368
compiler,
@@ -1394,13 +1408,7 @@ impl Step for CrateNotDefault {
1394
1408
let builder = run. builder ;
1395
1409
let compiler = builder. compiler ( builder. top_stage , run. host ) ;
1396
1410
1397
- let test_kind = if builder. kind == Kind :: Test {
1398
- TestKind :: Test
1399
- } else if builder. kind == Kind :: Bench {
1400
- TestKind :: Bench
1401
- } else {
1402
- panic ! ( "unexpected builder.kind in crate: {:?}" , builder. kind) ;
1403
- } ;
1411
+ let test_kind = builder. kind . into ( ) ;
1404
1412
1405
1413
builder. ensure ( CrateNotDefault {
1406
1414
compiler,
@@ -1461,13 +1469,7 @@ impl Step for Crate {
1461
1469
let compiler = builder. compiler ( builder. top_stage , run. host ) ;
1462
1470
1463
1471
let make = |mode : Mode , krate : & CargoCrate | {
1464
- let test_kind = if builder. kind == Kind :: Test {
1465
- TestKind :: Test
1466
- } else if builder. kind == Kind :: Bench {
1467
- TestKind :: Bench
1468
- } else {
1469
- panic ! ( "unexpected builder.kind in crate: {:?}" , builder. kind) ;
1470
- } ;
1472
+ let test_kind = builder. kind . into ( ) ;
1471
1473
1472
1474
builder. ensure ( Crate {
1473
1475
compiler,
@@ -1625,13 +1627,7 @@ impl Step for CrateRustdoc {
1625
1627
fn make_run ( run : RunConfig ) {
1626
1628
let builder = run. builder ;
1627
1629
1628
- let test_kind = if builder. kind == Kind :: Test {
1629
- TestKind :: Test
1630
- } else if builder. kind == Kind :: Bench {
1631
- TestKind :: Bench
1632
- } else {
1633
- panic ! ( "unexpected builder.kind in crate: {:?}" , builder. kind) ;
1634
- } ;
1630
+ let test_kind = builder. kind . into ( ) ;
1635
1631
1636
1632
builder. ensure ( CrateRustdoc {
1637
1633
host : run. host ,
0 commit comments