@@ -31,6 +31,7 @@ use crate::{CLang, DocTests, GitRepo, Mode, PathSet, envify};
3131
3232const ADB_TEST_DIR : & str = "/data/local/tmp/work" ;
3333
34+ /// Runs `cargo test` on various internal tools used by bootstrap.
3435#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
3536pub struct CrateBootstrap {
3637 path : PathBuf ,
@@ -43,13 +44,21 @@ impl Step for CrateBootstrap {
4344 const DEFAULT : bool = true ;
4445
4546 fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
47+ // This step is responsible for several different tool paths. By default
48+ // it will test all of them, but requesting specific tools on the
49+ // command-line (e.g. `./x test suggest-tests`) will test only the
50+ // specified tools.
4651 run. path ( "src/tools/jsondoclint" )
4752 . path ( "src/tools/suggest-tests" )
4853 . path ( "src/tools/replace-version-placeholder" )
54+ // We want `./x test tidy` to _run_ the tidy tool, not its tests.
55+ // So we need a separate alias to test the tidy tool itself.
4956 . alias ( "tidyselftest" )
5057 }
5158
5259 fn make_run ( run : RunConfig < ' _ > ) {
60+ // Create and ensure a separate instance of this step for each path
61+ // that was selected on the command-line (or selected by default).
5362 for path in run. paths {
5463 let path = path. assert_single_path ( ) . path . clone ( ) ;
5564 run. builder . ensure ( CrateBootstrap { host : run. target , path } ) ;
@@ -60,6 +69,8 @@ impl Step for CrateBootstrap {
6069 let bootstrap_host = builder. config . build ;
6170 let compiler = builder. compiler ( 0 , bootstrap_host) ;
6271 let mut path = self . path . to_str ( ) . unwrap ( ) ;
72+
73+ // Map alias `tidyselftest` back to the actual crate path of tidy.
6374 if path == "tidyselftest" {
6475 path = "src/tools/tidy" ;
6576 }
@@ -212,6 +223,8 @@ impl Step for HtmlCheck {
212223 }
213224}
214225
226+ /// Runs the `src/tools/cargotest` tool, which checks out some representative
227+ /// crate repositories and runs `cargo test` on them, in order to test cargo.
215228#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
216229pub struct Cargotest {
217230 stage : u32 ,
@@ -257,6 +270,7 @@ impl Step for Cargotest {
257270 }
258271}
259272
273+ /// Runs `cargo test` for cargo itself.
260274#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
261275pub struct Cargo {
262276 stage : u32 ,
@@ -385,6 +399,7 @@ impl Step for RustAnalyzer {
385399 }
386400}
387401
402+ /// Runs `cargo test` for rustfmt.
388403#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
389404pub struct Rustfmt {
390405 stage : u32 ,
@@ -589,6 +604,8 @@ impl Step for Miri {
589604 }
590605}
591606
607+ /// Runs `cargo miri test` to demonstrate that `src/tools/miri/cargo-miri`
608+ /// works and that libtest works under miri.
592609#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
593610pub struct CargoMiri {
594611 target : TargetSelection ,
@@ -1020,6 +1037,10 @@ impl Step for RustdocGUI {
10201037 }
10211038}
10221039
1040+ /// Runs `src/tools/tidy` and `cargo fmt --check` to detect various style
1041+ /// problems in the repository.
1042+ ///
1043+ /// (To run the tidy tool's internal tests, use the alias "tidyselftest" instead.)
10231044#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
10241045pub struct Tidy ;
10251046
@@ -1230,6 +1251,8 @@ impl Step for RunMakeSupport {
12301251 }
12311252}
12321253
1254+ /// Runs `cargo test` on the `src/tools/run-make-support` crate.
1255+ /// That crate is used by run-make tests.
12331256#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
12341257pub struct CrateRunMakeSupport {
12351258 host : TargetSelection ,
@@ -2466,6 +2489,10 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
24662489 }
24672490}
24682491
2492+ /// Runs `cargo test` for the compiler crates in `compiler/`.
2493+ ///
2494+ /// (This step does not test `rustc_codegen_cranelift` or `rustc_codegen_gcc`,
2495+ /// which have their own separate test steps.)
24692496#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
24702497pub struct CrateLibrustc {
24712498 compiler : Compiler ,
@@ -2494,6 +2521,7 @@ impl Step for CrateLibrustc {
24942521 fn run ( self , builder : & Builder < ' _ > ) {
24952522 builder. ensure ( compile:: Std :: new ( self . compiler , self . target ) ) ;
24962523
2524+ // To actually run the tests, delegate to a copy of the `Crate` step.
24972525 builder. ensure ( Crate {
24982526 compiler : self . compiler ,
24992527 target : self . target ,
@@ -2619,6 +2647,13 @@ fn prepare_cargo_test(
26192647 cargo
26202648}
26212649
2650+ /// Runs `cargo test` for standard library crates.
2651+ ///
2652+ /// (Also used internally to run `cargo test` for compiler crates.)
2653+ ///
2654+ /// FIXME(Zalathar): Try to split this into two separate steps: a user-visible
2655+ /// step for testing standard library crates, and an internal step used for both
2656+ /// library crates and compiler crates.
26222657#[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
26232658pub struct Crate {
26242659 pub compiler : Compiler ,
@@ -3552,6 +3587,10 @@ impl Step for CodegenGCC {
35523587 }
35533588}
35543589
3590+ /// Test step that does two things:
3591+ /// - Runs `cargo test` for the `src/etc/test-float-parse` tool.
3592+ /// - Invokes the `test-float-parse` tool to test the standard library's
3593+ /// float parsing routines.
35553594#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
35563595pub struct TestFloatParse {
35573596 path : PathBuf ,
@@ -3625,6 +3664,9 @@ impl Step for TestFloatParse {
36253664 }
36263665}
36273666
3667+ /// Runs the tool `src/tools/collect-license-metadata` in `ONLY_CHECK=1` mode,
3668+ /// which verifies that `license-metadata.json` is up-to-date and therefore
3669+ /// running the tool normally would not update anything.
36283670#[ derive( Debug , PartialOrd , Ord , Clone , Hash , PartialEq , Eq ) ]
36293671pub struct CollectLicenseMetadata ;
36303672
0 commit comments