@@ -2731,6 +2731,68 @@ impl Step for Crate {
27312731 }
27322732}
27332733
2734+ /// Test compiler-builtins via its testcrate.
2735+ #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
2736+ pub struct CompilerBuiltins {
2737+ compiler : Compiler ,
2738+ target : TargetSelection ,
2739+ mode : Mode ,
2740+ }
2741+
2742+ impl Step for CompilerBuiltins {
2743+ type Output = ( ) ;
2744+ const DEFAULT : bool = true ;
2745+
2746+ fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
2747+ run. paths ( & [ "library/compiler-builtins" , "library/compiler-builtins/compiler-builtins" ] )
2748+ }
2749+
2750+ fn make_run ( run : RunConfig < ' _ > ) {
2751+ let builder = run. builder ;
2752+ let host = run. build_triple ( ) ;
2753+ let compiler = builder. compiler_for ( builder. top_stage , host, host) ;
2754+
2755+ builder. ensure ( CompilerBuiltins { compiler, target : run. target , mode : Mode :: Std } ) ;
2756+ }
2757+
2758+ fn run ( self , builder : & Builder < ' _ > ) -> Self :: Output {
2759+ let compiler = self . compiler ;
2760+ let target = self . target ;
2761+ let mode = self . mode ;
2762+
2763+ builder. ensure ( compile:: Std :: new ( compiler, compiler. host ) . force_recompile ( true ) ) ;
2764+ let compiler = builder. compiler_for ( compiler. stage , compiler. host , target) ;
2765+
2766+ // Also prepare a sysroot for the target.
2767+ if !builder. config . is_host_target ( target) {
2768+ builder. ensure ( compile:: Std :: new ( compiler, target) . force_recompile ( true ) ) ;
2769+ builder. ensure ( RemoteCopyLibs { compiler, target } ) ;
2770+ }
2771+
2772+ let make_cargo = |f : fn ( & mut builder:: Cargo ) -> & mut builder:: Cargo | {
2773+ let mut c = builder:: Cargo :: new (
2774+ builder,
2775+ compiler,
2776+ mode,
2777+ SourceType :: InTree ,
2778+ target,
2779+ Kind :: Test ,
2780+ ) ;
2781+ f ( & mut c) ;
2782+ c
2783+ } ;
2784+
2785+ // Most tests are in the builtins-test crate.
2786+ let crates = [ "compiler-builtins" . to_string ( ) , "builtins-test" . to_string ( ) ] ;
2787+ let cargo = make_cargo ( |c| c) ;
2788+ run_cargo_test ( cargo, & [ ] , & crates, "compiler-buitlins" , target, builder) ;
2789+ let cargo = make_cargo ( |c| c. arg ( "--release" ) ) ;
2790+ run_cargo_test ( cargo, & [ ] , & crates, "compiler-buitlins --release" , target, builder) ;
2791+ let cargo = make_cargo ( |c| c. arg ( "--features=c" ) ) ;
2792+ run_cargo_test ( cargo, & [ ] , & crates, "compiler-buitlins --features c" , target, builder) ;
2793+ }
2794+ }
2795+
27342796/// Rustdoc is special in various ways, which is why this step is different from `Crate`.
27352797#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
27362798pub struct CrateRustdoc {
0 commit comments