@@ -27,6 +27,7 @@ use crate::core::config::flags::Subcommand;
2727use crate :: core:: config:: TargetSelection ;
2828use crate :: utils;
2929use crate :: utils:: cache:: { Interned , INTERNER } ;
30+ use crate :: utils:: dylib:: shared_lib_name;
3031use crate :: utils:: exec:: BootstrapCommand ;
3132use crate :: utils:: helpers:: {
3233 self , add_link_lib_path, add_rustdoc_cargo_linker_args, dylib_path, dylib_path_var,
@@ -1344,6 +1345,53 @@ macro_rules! coverage_test_alias {
13441345 } ;
13451346}
13461347
1348+ #[ derive( Debug , Copy , Clone , Hash , PartialEq , Eq , Ord , PartialOrd ) ]
1349+ pub struct RunMakeSupport {
1350+ pub compiler : Compiler ,
1351+ pub target : TargetSelection ,
1352+ }
1353+
1354+ impl Step for RunMakeSupport {
1355+ type Output = PathBuf ;
1356+ const DEFAULT : bool = true ;
1357+
1358+ fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
1359+ run. never ( )
1360+ }
1361+
1362+ fn make_run ( run : RunConfig < ' _ > ) {
1363+ let compiler = run. builder . compiler ( run. builder . top_stage , run. build_triple ( ) ) ;
1364+ run. builder . ensure ( RunMakeSupport { compiler, target : run. target } ) ;
1365+ }
1366+
1367+ fn run ( self , builder : & Builder < ' _ > ) -> PathBuf {
1368+ builder. ensure ( compile:: Std :: new ( self . compiler , self . target ) ) ;
1369+
1370+ let cargo = tool:: prepare_tool_cargo (
1371+ builder,
1372+ self . compiler ,
1373+ Mode :: ToolStd ,
1374+ self . target ,
1375+ "build" ,
1376+ "src/tools/run-make-support" ,
1377+ SourceType :: InTree ,
1378+ & [ ] ,
1379+ ) ;
1380+
1381+ let mut cargo = Command :: from ( cargo) ;
1382+ cargo. env ( "RUSTFLAGS" , "-C prefer-dynamic" ) ;
1383+ builder. run ( & mut cargo) ;
1384+
1385+ let lib_name = shared_lib_name ( "run_make_support" , & self . target . to_string ( ) ) ;
1386+ let lib = builder. tools_dir ( self . compiler ) . join ( & lib_name) ;
1387+
1388+ let cargo_out =
1389+ builder. cargo_out ( self . compiler , Mode :: ToolStd , self . target ) . join ( & lib_name) ;
1390+ builder. copy ( & cargo_out, & lib) ;
1391+ lib
1392+ }
1393+ }
1394+
13471395default_test ! ( Ui { path: "tests/ui" , mode: "ui" , suite: "ui" } ) ;
13481396
13491397default_test ! ( RunPassValgrind {
@@ -1378,7 +1426,40 @@ host_test!(RustdocJson { path: "tests/rustdoc-json", mode: "rustdoc-json", suite
13781426
13791427host_test ! ( Pretty { path: "tests/pretty" , mode: "pretty" , suite: "pretty" } ) ;
13801428
1381- default_test ! ( RunMake { path: "tests/run-make" , mode: "run-make" , suite: "run-make" } ) ;
1429+ // Special-handling is needed for `run-make`, so don't use `default_test` for defining `RunMake`
1430+ // tests.
1431+ #[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash ) ]
1432+ pub struct RunMake {
1433+ pub compiler : Compiler ,
1434+ pub target : TargetSelection ,
1435+ }
1436+
1437+ impl Step for RunMake {
1438+ type Output = ( ) ;
1439+ const DEFAULT : bool = true ;
1440+ const ONLY_HOSTS : bool = false ;
1441+
1442+ fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
1443+ run. suite_path ( "tests/run-make" )
1444+ }
1445+
1446+ fn make_run ( run : RunConfig < ' _ > ) {
1447+ let compiler = run. builder . compiler ( run. builder . top_stage , run. build_triple ( ) ) ;
1448+ run. builder . ensure ( RunMakeSupport { compiler, target : run. target } ) ;
1449+ run. builder . ensure ( RunMake { compiler, target : run. target } ) ;
1450+ }
1451+
1452+ fn run ( self , builder : & Builder < ' _ > ) {
1453+ builder. ensure ( Compiletest {
1454+ compiler : self . compiler ,
1455+ target : self . target ,
1456+ mode : "run-make" ,
1457+ suite : "run-make" ,
1458+ path : "tests/run-make" ,
1459+ compare_mode : None ,
1460+ } ) ;
1461+ }
1462+ }
13821463
13831464host_test ! ( RunMakeFullDeps {
13841465 path: "tests/run-make-fulldeps" ,
0 commit comments