@@ -2695,3 +2695,58 @@ impl Step for LintDocs {
26952695 } ) ;
26962696 }
26972697}
2698+
2699+ #[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash ) ]
2700+ pub struct RustInstaller ;
2701+
2702+ impl Step for RustInstaller {
2703+ type Output = ( ) ;
2704+ const ONLY_HOSTS : bool = true ;
2705+ const DEFAULT : bool = true ;
2706+
2707+ /// Ensure the version placeholder replacement tool builds
2708+ fn run ( self , builder : & Builder < ' _ > ) {
2709+ builder. info ( "test rust-installer" ) ;
2710+
2711+ let bootstrap_host = builder. config . build ;
2712+ let compiler = builder. compiler ( 0 , bootstrap_host) ;
2713+ let cargo = tool:: prepare_tool_cargo (
2714+ builder,
2715+ compiler,
2716+ Mode :: ToolBootstrap ,
2717+ bootstrap_host,
2718+ "test" ,
2719+ "src/tools/rust-installer" ,
2720+ SourceType :: InTree ,
2721+ & [ ] ,
2722+ ) ;
2723+ try_run ( builder, & mut cargo. into ( ) ) ;
2724+
2725+ // We currently don't support running the test.sh script outside linux(?) environments.
2726+ // Eventually this should likely migrate to #[test]s in rust-installer proper rather than a
2727+ // set of scripts, which will likely allow dropping this if.
2728+ if bootstrap_host != "x86_64-unknown-linux-gnu" {
2729+ return ;
2730+ }
2731+
2732+ let mut cmd =
2733+ std:: process:: Command :: new ( builder. src . join ( "src/tools/rust-installer/test.sh" ) ) ;
2734+ let tmpdir = testdir ( builder, compiler. host ) . join ( "rust-installer" ) ;
2735+ let _ = std:: fs:: remove_dir_all ( & tmpdir) ;
2736+ let _ = std:: fs:: create_dir_all ( & tmpdir) ;
2737+ cmd. current_dir ( & tmpdir) ;
2738+ cmd. env ( "CARGO_TARGET_DIR" , tmpdir. join ( "cargo-target" ) ) ;
2739+ cmd. env ( "CARGO" , & builder. initial_cargo ) ;
2740+ cmd. env ( "RUSTC" , & builder. initial_rustc ) ;
2741+ cmd. env ( "TMP_DIR" , & tmpdir) ;
2742+ try_run ( builder, & mut cmd) ;
2743+ }
2744+
2745+ fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
2746+ run. path ( "src/tools/rust-installer" )
2747+ }
2748+
2749+ fn make_run ( run : RunConfig < ' _ > ) {
2750+ run. builder . ensure ( Self ) ;
2751+ }
2752+ }
0 commit comments