@@ -31,6 +31,7 @@ use crate::{CLang, DocTests, GitRepo, Mode, PathSet, envify};
31
31
32
32
const ADB_TEST_DIR : & str = "/data/local/tmp/work" ;
33
33
34
+ /// Runs `cargo test` on various internal tools used by bootstrap.
34
35
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
35
36
pub struct CrateBootstrap {
36
37
path : PathBuf ,
@@ -43,13 +44,21 @@ impl Step for CrateBootstrap {
43
44
const DEFAULT : bool = true ;
44
45
45
46
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.
46
51
run. path ( "src/tools/jsondoclint" )
47
52
. path ( "src/tools/suggest-tests" )
48
53
. 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.
49
56
. alias ( "tidyselftest" )
50
57
}
51
58
52
59
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).
53
62
for path in run. paths {
54
63
let path = path. assert_single_path ( ) . path . clone ( ) ;
55
64
run. builder . ensure ( CrateBootstrap { host : run. target , path } ) ;
@@ -60,6 +69,8 @@ impl Step for CrateBootstrap {
60
69
let bootstrap_host = builder. config . build ;
61
70
let compiler = builder. compiler ( 0 , bootstrap_host) ;
62
71
let mut path = self . path . to_str ( ) . unwrap ( ) ;
72
+
73
+ // Map alias `tidyselftest` back to the actual crate path of tidy.
63
74
if path == "tidyselftest" {
64
75
path = "src/tools/tidy" ;
65
76
}
@@ -212,6 +223,9 @@ impl Step for HtmlCheck {
212
223
}
213
224
}
214
225
226
+ /// Builds cargo and then runs the `src/tools/cargotest` tool, which checks out
227
+ /// some representative crate repositories and runs `cargo test` on them, in
228
+ /// order to test cargo.
215
229
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
216
230
pub struct Cargotest {
217
231
stage : u32 ,
@@ -257,6 +271,7 @@ impl Step for Cargotest {
257
271
}
258
272
}
259
273
274
+ /// Runs `cargo test` for cargo itself.
260
275
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
261
276
pub struct Cargo {
262
277
stage : u32 ,
@@ -385,6 +400,7 @@ impl Step for RustAnalyzer {
385
400
}
386
401
}
387
402
403
+ /// Runs `cargo test` for rustfmt.
388
404
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
389
405
pub struct Rustfmt {
390
406
stage : u32 ,
@@ -589,6 +605,8 @@ impl Step for Miri {
589
605
}
590
606
}
591
607
608
+ /// Runs `cargo miri test` to demonstrate that `src/tools/miri/cargo-miri`
609
+ /// works and that libtest works under miri.
592
610
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
593
611
pub struct CargoMiri {
594
612
target : TargetSelection ,
@@ -1020,6 +1038,10 @@ impl Step for RustdocGUI {
1020
1038
}
1021
1039
}
1022
1040
1041
+ /// Runs `src/tools/tidy` and `cargo fmt --check` to detect various style
1042
+ /// problems in the repository.
1043
+ ///
1044
+ /// (To run the tidy tool's internal tests, use the alias "tidyselftest" instead.)
1023
1045
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
1024
1046
pub struct Tidy ;
1025
1047
@@ -1230,6 +1252,8 @@ impl Step for RunMakeSupport {
1230
1252
}
1231
1253
}
1232
1254
1255
+ /// Runs `cargo test` on the `src/tools/run-make-support` crate.
1256
+ /// That crate is used by run-make tests.
1233
1257
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
1234
1258
pub struct CrateRunMakeSupport {
1235
1259
host : TargetSelection ,
@@ -2466,6 +2490,10 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
2466
2490
}
2467
2491
}
2468
2492
2493
+ /// Runs `cargo test` for the compiler crates in `compiler/`.
2494
+ ///
2495
+ /// (This step does not test `rustc_codegen_cranelift` or `rustc_codegen_gcc`,
2496
+ /// which have their own separate test steps.)
2469
2497
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
2470
2498
pub struct CrateLibrustc {
2471
2499
compiler : Compiler ,
@@ -2494,6 +2522,7 @@ impl Step for CrateLibrustc {
2494
2522
fn run ( self , builder : & Builder < ' _ > ) {
2495
2523
builder. ensure ( compile:: Std :: new ( self . compiler , self . target ) ) ;
2496
2524
2525
+ // To actually run the tests, delegate to a copy of the `Crate` step.
2497
2526
builder. ensure ( Crate {
2498
2527
compiler : self . compiler ,
2499
2528
target : self . target ,
@@ -2619,6 +2648,13 @@ fn prepare_cargo_test(
2619
2648
cargo
2620
2649
}
2621
2650
2651
+ /// Runs `cargo test` for standard library crates.
2652
+ ///
2653
+ /// (Also used internally to run `cargo test` for compiler crates.)
2654
+ ///
2655
+ /// FIXME(Zalathar): Try to split this into two separate steps: a user-visible
2656
+ /// step for testing standard library crates, and an internal step used for both
2657
+ /// library crates and compiler crates.
2622
2658
#[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
2623
2659
pub struct Crate {
2624
2660
pub compiler : Compiler ,
@@ -3552,6 +3588,10 @@ impl Step for CodegenGCC {
3552
3588
}
3553
3589
}
3554
3590
3591
+ /// Test step that does two things:
3592
+ /// - Runs `cargo test` for the `src/etc/test-float-parse` tool.
3593
+ /// - Invokes the `test-float-parse` tool to test the standard library's
3594
+ /// float parsing routines.
3555
3595
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
3556
3596
pub struct TestFloatParse {
3557
3597
path : PathBuf ,
@@ -3625,6 +3665,9 @@ impl Step for TestFloatParse {
3625
3665
}
3626
3666
}
3627
3667
3668
+ /// Runs the tool `src/tools/collect-license-metadata` in `ONLY_CHECK=1` mode,
3669
+ /// which verifies that `license-metadata.json` is up-to-date and therefore
3670
+ /// running the tool normally would not update anything.
3628
3671
#[ derive( Debug , PartialOrd , Ord , Clone , Hash , PartialEq , Eq ) ]
3629
3672
pub struct CollectLicenseMetadata ;
3630
3673
0 commit comments