@@ -1305,6 +1305,48 @@ macro_rules! test_definitions {
13051305 } ;
13061306}
13071307
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+
13081350default_test ! ( Ui { path: "tests/ui" , mode: "ui" , suite: "ui" } ) ;
13091351
13101352default_test ! ( RunPassValgrind {
@@ -1349,14 +1391,31 @@ host_test!(RunMakeFullDeps {
13491391
13501392default_test ! ( Assembly { path: "tests/assembly" , mode: "assembly" , suite: "assembly" } ) ;
13511393
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.
13521399#[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash ) ]
13531400pub struct Coverage {
13541401 pub compiler : Compiler ,
13551402 pub target : TargetSelection ,
13561403}
13571404
13581405impl Coverage {
1406+ const PATH : & ' static str = "tests/coverage" ;
13591407 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+ }
13601419}
13611420
13621421impl Step for Coverage {
0 commit comments