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