@@ -42,6 +42,7 @@ mod compiler_crate_tests;
4242mod compiletest_self_tests;
4343mod compiletest_suites;
4444mod devtool_tests;
45+ mod dist_tool_tests;
4546mod doc_tool_tests;
4647mod miri_tests;
4748mod rustdoc_tests;
@@ -63,80 +64,14 @@ pub(crate) use compiletest_suites::{
6364 RustdocJSStd , RustdocJson , RustdocUi , Ui , UiFullDeps ,
6465} ;
6566pub ( crate ) use devtool_tests:: { Cargo , Clippy , RustAnalyzer , Rustfmt } ;
67+ pub ( crate ) use dist_tool_tests:: { CollectLicenseMetadata , Distcheck , RustInstaller } ;
6668pub ( crate ) use doc_tool_tests:: { HtmlCheck , Linkcheck } ;
6769pub ( crate ) use miri_tests:: { CargoMiri , Miri } ;
6870pub ( crate ) use rustdoc_tests:: { CrateRustdoc , CrateRustdocJsonTypes , RustdocTheme } ;
6971pub ( crate ) use std_tests:: TestFloatParse ;
7072pub ( crate ) use test_helpers:: Crate ;
7173pub ( crate ) use tidy:: Tidy ;
7274
73- #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
74- pub struct Distcheck ;
75-
76- impl Step for Distcheck {
77- type Output = ( ) ;
78-
79- fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
80- run. alias ( "distcheck" )
81- }
82-
83- fn make_run ( run : RunConfig < ' _ > ) {
84- run. builder . ensure ( Distcheck ) ;
85- }
86-
87- /// Runs "distcheck", a 'make check' from a tarball
88- fn run ( self , builder : & Builder < ' _ > ) {
89- builder. info ( "Distcheck" ) ;
90- let dir = builder. tempdir ( ) . join ( "distcheck" ) ;
91- let _ = fs:: remove_dir_all ( & dir) ;
92- t ! ( fs:: create_dir_all( & dir) ) ;
93-
94- // Guarantee that these are built before we begin running.
95- builder. ensure ( dist:: PlainSourceTarball ) ;
96- builder. ensure ( dist:: Src ) ;
97-
98- command ( "tar" )
99- . arg ( "-xf" )
100- . arg ( builder. ensure ( dist:: PlainSourceTarball ) . tarball ( ) )
101- . arg ( "--strip-components=1" )
102- . current_dir ( & dir)
103- . run ( builder) ;
104- command ( "./configure" )
105- . args ( & builder. config . configure_args )
106- . arg ( "--enable-vendor" )
107- . current_dir ( & dir)
108- . run ( builder) ;
109- command ( helpers:: make ( & builder. config . build . triple ) )
110- . arg ( "check" )
111- . current_dir ( & dir)
112- . run ( builder) ;
113-
114- // Now make sure that rust-src has all of libstd's dependencies
115- builder. info ( "Distcheck rust-src" ) ;
116- let dir = builder. tempdir ( ) . join ( "distcheck-src" ) ;
117- let _ = fs:: remove_dir_all ( & dir) ;
118- t ! ( fs:: create_dir_all( & dir) ) ;
119-
120- command ( "tar" )
121- . arg ( "-xf" )
122- . arg ( builder. ensure ( dist:: Src ) . tarball ( ) )
123- . arg ( "--strip-components=1" )
124- . current_dir ( & dir)
125- . run ( builder) ;
126-
127- let toml = dir. join ( "rust-src/lib/rustlib/src/rust/library/std/Cargo.toml" ) ;
128- command ( & builder. initial_cargo )
129- // Will read the libstd Cargo.toml
130- // which uses the unstable `public-dependency` feature.
131- . env ( "RUSTC_BOOTSTRAP" , "1" )
132- . arg ( "generate-lockfile" )
133- . arg ( "--manifest-path" )
134- . arg ( & toml)
135- . current_dir ( & dir)
136- . run ( builder) ;
137- }
138- }
139-
14075#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
14176pub struct TierCheck {
14277 pub compiler : Compiler ,
@@ -209,8 +144,8 @@ impl Step for LintDocs {
209144 } ) ;
210145 }
211146
212- /// Tests that the lint examples in the rustc book generate the correct
213- /// lints and have the expected format.
147+ /// Tests that the lint examples in the rustc book generate the correct lints and have the
148+ /// expected format.
214149 fn run ( self , builder : & Builder < ' _ > ) {
215150 builder. ensure ( crate :: core:: build_steps:: doc:: RustcBook {
216151 compiler : self . compiler ,
@@ -219,98 +154,3 @@ impl Step for LintDocs {
219154 } ) ;
220155 }
221156}
222-
223- #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
224- pub struct RustInstaller ;
225-
226- impl Step for RustInstaller {
227- type Output = ( ) ;
228- const ONLY_HOSTS : bool = true ;
229- const DEFAULT : bool = true ;
230-
231- /// Ensure the version placeholder replacement tool builds
232- fn run ( self , builder : & Builder < ' _ > ) {
233- let bootstrap_host = builder. config . build ;
234- let compiler = builder. compiler ( 0 , bootstrap_host) ;
235- let cargo = tool:: prepare_tool_cargo (
236- builder,
237- compiler,
238- Mode :: ToolBootstrap ,
239- bootstrap_host,
240- Kind :: Test ,
241- "src/tools/rust-installer" ,
242- SourceType :: InTree ,
243- & [ ] ,
244- ) ;
245-
246- let _guard = builder. msg (
247- Kind :: Test ,
248- compiler. stage ,
249- "rust-installer" ,
250- bootstrap_host,
251- bootstrap_host,
252- ) ;
253- run_cargo_test ( cargo, & [ ] , & [ ] , "installer" , None , bootstrap_host, builder) ;
254-
255- // We currently don't support running the test.sh script outside linux(?) environments.
256- // Eventually this should likely migrate to #[test]s in rust-installer proper rather than a
257- // set of scripts, which will likely allow dropping this if.
258- if bootstrap_host != "x86_64-unknown-linux-gnu" {
259- return ;
260- }
261-
262- let mut cmd = command ( builder. src . join ( "src/tools/rust-installer/test.sh" ) ) ;
263- let tmpdir = builder. test_out ( compiler. host ) . join ( "rust-installer" ) ;
264- let _ = std:: fs:: remove_dir_all ( & tmpdir) ;
265- let _ = std:: fs:: create_dir_all ( & tmpdir) ;
266- cmd. current_dir ( & tmpdir) ;
267- cmd. env ( "CARGO_TARGET_DIR" , tmpdir. join ( "cargo-target" ) ) ;
268- cmd. env ( "CARGO" , & builder. initial_cargo ) ;
269- cmd. env ( "RUSTC" , & builder. initial_rustc ) ;
270- cmd. env ( "TMP_DIR" , & tmpdir) ;
271- cmd. delay_failure ( ) . run ( builder) ;
272- }
273-
274- fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
275- run. path ( "src/tools/rust-installer" )
276- }
277-
278- fn make_run ( run : RunConfig < ' _ > ) {
279- run. builder . ensure ( Self ) ;
280- }
281- }
282-
283- /// Runs the tool `src/tools/collect-license-metadata` in `ONLY_CHECK=1` mode,
284- /// which verifies that `license-metadata.json` is up-to-date and therefore
285- /// running the tool normally would not update anything.
286- #[ derive( Debug , PartialOrd , Ord , Clone , Hash , PartialEq , Eq ) ]
287- pub struct CollectLicenseMetadata ;
288-
289- impl Step for CollectLicenseMetadata {
290- type Output = PathBuf ;
291- const ONLY_HOSTS : bool = true ;
292-
293- fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
294- run. path ( "src/tools/collect-license-metadata" )
295- }
296-
297- fn make_run ( run : RunConfig < ' _ > ) {
298- run. builder . ensure ( CollectLicenseMetadata ) ;
299- }
300-
301- fn run ( self , builder : & Builder < ' _ > ) -> Self :: Output {
302- let Some ( reuse) = & builder. config . reuse else {
303- panic ! ( "REUSE is required to collect the license metadata" ) ;
304- } ;
305-
306- let dest = builder. src . join ( "license-metadata.json" ) ;
307-
308- let mut cmd = builder. tool_cmd ( Tool :: CollectLicenseMetadata ) ;
309- cmd. env ( "REUSE_EXE" , reuse) ;
310- cmd. env ( "DEST" , & dest) ;
311- cmd. env ( "ONLY_CHECK" , "1" ) ;
312- cmd. run ( builder) ;
313-
314- dest
315- }
316- }
0 commit comments