@@ -1305,6 +1305,47 @@ macro_rules! test_definitions {
1305
1305
} ;
1306
1306
}
1307
1307
1308
+ /// Declares an alias for running the [`Coverage`] tests in only one mode.
1309
+ /// Adapted from [`test_definitions`].
1310
+ macro_rules! coverage_test_alias {
1311
+ ( $name: ident {
1312
+ alias_and_mode: $alias_and_mode: expr,
1313
+ default : $default: expr,
1314
+ only_hosts: $only_hosts: expr $( , ) ?
1315
+ } ) => {
1316
+ #[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash ) ]
1317
+ pub struct $name {
1318
+ pub compiler: Compiler ,
1319
+ pub target: TargetSelection ,
1320
+ }
1321
+
1322
+ impl $name {
1323
+ const MODE : & ' static str = $alias_and_mode;
1324
+ }
1325
+
1326
+ impl Step for $name {
1327
+ type Output = ( ) ;
1328
+ const DEFAULT : bool = $default;
1329
+ const ONLY_HOSTS : bool = $only_hosts;
1330
+
1331
+ fn should_run( run: ShouldRun <' _>) -> ShouldRun <' _> {
1332
+ run. alias( $alias_and_mode)
1333
+ }
1334
+
1335
+ fn make_run( run: RunConfig <' _>) {
1336
+ let compiler = run. builder. compiler( run. builder. top_stage, run. build_triple( ) ) ;
1337
+
1338
+ run. builder. ensure( $name { compiler, target: run. target } ) ;
1339
+ }
1340
+
1341
+ fn run( self , builder: & Builder <' _>) {
1342
+ Coverage { compiler: self . compiler, target: self . target }
1343
+ . run_unified_suite( builder, Self :: MODE )
1344
+ }
1345
+ }
1346
+ } ;
1347
+ }
1348
+
1308
1349
default_test ! ( Ui { path: "tests/ui" , mode: "ui" , suite: "ui" } ) ;
1309
1350
1310
1351
default_test ! ( RunPassValgrind {
@@ -1349,14 +1390,31 @@ host_test!(RunMakeFullDeps {
1349
1390
1350
1391
default_test ! ( Assembly { path: "tests/assembly" , mode: "assembly" , suite: "assembly" } ) ;
1351
1392
1393
+ /// Custom test step that is responsible for running the coverage tests
1394
+ /// in multiple different modes.
1395
+ ///
1396
+ /// Each individual mode also has its own alias that will run the tests in
1397
+ /// just that mode.
1352
1398
#[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash ) ]
1353
1399
pub struct Coverage {
1354
1400
pub compiler : Compiler ,
1355
1401
pub target : TargetSelection ,
1356
1402
}
1357
1403
1358
1404
impl Coverage {
1405
+ const PATH : & ' static str = "tests/coverage" ;
1359
1406
const SUITE : & ' static str = "coverage" ;
1407
+
1408
+ fn run_unified_suite ( & self , builder : & Builder < ' _ > , mode : & ' static str ) {
1409
+ builder. ensure ( Compiletest {
1410
+ compiler : self . compiler ,
1411
+ target : self . target ,
1412
+ mode,
1413
+ suite : Self :: SUITE ,
1414
+ path : Self :: PATH ,
1415
+ compare_mode : None ,
1416
+ } )
1417
+ }
1360
1418
}
1361
1419
1362
1420
impl Step for Coverage {
0 commit comments