diff options
| author | Jakub Beránek <berykubik@gmail.com> | 2025-08-25 17:40:01 +0200 |
|---|---|---|
| committer | Jakub Beránek <berykubik@gmail.com> | 2025-08-30 15:28:41 +0200 |
| commit | 9de09ac101f5e46b7eda48261a6757dc78b25bd8 (patch) | |
| tree | 4feb7643b9f79628fdd1c1a4f47bd4ecf3cf1dec /src/bootstrap | |
| parent | d2195c483c2c0593b1b6cde7a9f4097ec9c17c10 (diff) | |
| download | rust-9de09ac101f5e46b7eda48261a6757dc78b25bd8.tar.gz rust-9de09ac101f5e46b7eda48261a6757dc78b25bd8.zip | |
Fix stage 1 compiler tests
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/src/core/build_steps/doc.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/test.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/src/core/builder/tests.rs | 42 | ||||
| -rw-r--r-- | src/bootstrap/src/core/config/config.rs | 4 |
4 files changed, 43 insertions, 7 deletions
diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs index 678fe127879..0789eefa894 100644 --- a/src/bootstrap/src/core/build_steps/doc.rs +++ b/src/bootstrap/src/core/build_steps/doc.rs @@ -1293,6 +1293,8 @@ impl Step for RustcBook { // functional sysroot. builder.std(self.build_compiler, self.target); let mut cmd = builder.tool_cmd(Tool::LintDocs); + cmd.arg("--build-rustc-stage"); + cmd.arg(self.build_compiler.stage.to_string()); cmd.arg("--src"); cmd.arg(builder.src.join("compiler")); cmd.arg("--out"); diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index ad17a557658..1786e8d17b6 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -2730,7 +2730,7 @@ impl Step for CrateLibrustc { } fn metadata(&self) -> Option<StepMetadata> { - Some(StepMetadata::test("CrateLibrustc", self.target)) + Some(StepMetadata::test("CrateLibrustc", self.target).built_by(self.build_compiler)) } } diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index 31f863f240f..f14c897cab4 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -2078,7 +2078,7 @@ mod snapshot { [test] Pretty <host> [build] rustc 1 <host> -> std 1 <host> [build] rustc 0 <host> -> std 0 <host> - [test] CrateLibrustc <host> + [test] rustc 0 <host> -> CrateLibrustc 1 <host> [build] rustc 1 <host> -> rustc 2 <host> [test] crate-bootstrap <host> src/tools/coverage-dump [test] crate-bootstrap <host> src/tools/jsondoclint @@ -2212,6 +2212,40 @@ mod snapshot { } #[test] + fn test_compiler_stage_1() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("test") + .path("compiler") + .stage(1) + .render_steps(), @r" + [build] llvm <host> + [build] rustc 0 <host> -> rustc 1 <host> + [build] rustc 0 <host> -> std 0 <host> + [build] rustdoc 0 <host> + [test] rustc 0 <host> -> CrateLibrustc 1 <host> + "); + } + + #[test] + fn test_compiler_stage_2() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("test") + .path("compiler") + .stage(2) + .render_steps(), @r" + [build] llvm <host> + [build] rustc 0 <host> -> rustc 1 <host> + [build] rustc 1 <host> -> std 1 <host> + [build] rustc 1 <host> -> rustc 2 <host> + [build] rustc 1 <host> -> std 1 <host> + [build] rustdoc 1 <host> + [test] rustc 1 <host> -> CrateLibrustc 2 <host> + "); + } + + #[test] fn test_exclude() { let ctx = TestCtx::new(); let steps = ctx.config("test").args(&["--skip", "src/tools/tidy"]).get_steps(); @@ -2228,13 +2262,15 @@ mod snapshot { let get_steps = |args: &[&str]| ctx.config("test").args(args).get_steps(); + let rustc_metadata = + || StepMetadata::test("CrateLibrustc", host).built_by(Compiler::new(0, host)); // Ensure our test is valid, and `test::Rustc` would be run without the exclude. - get_steps(&[]).assert_contains(StepMetadata::test("CrateLibrustc", host)); + get_steps(&[]).assert_contains(rustc_metadata()); let steps = get_steps(&["--skip", "compiler/rustc_data_structures"]); // Ensure tests for rustc are not skipped. - steps.assert_contains(StepMetadata::test("CrateLibrustc", host)); + steps.assert_contains(rustc_metadata()); steps.assert_contains_fuzzy(StepMetadata::build("rustc", host)); } diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 450f325f1a9..d12cc962187 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -1012,9 +1012,7 @@ impl Config { } if flags_compile_time_deps && !matches!(flags_cmd, Subcommand::Check { .. }) { - eprintln!( - "ERROR: Can't use --compile-time-deps with any subcommand other than check." - ); + eprintln!("ERROR: Can't use --compile-time-deps with any subcommand other than check."); exit!(1); } |
