diff options
| author | Jakub Beránek <berykubik@gmail.com> | 2025-07-22 13:45:33 +0200 |
|---|---|---|
| committer | Jakub Beránek <berykubik@gmail.com> | 2025-08-01 15:44:53 +0200 |
| commit | 7a2c4d312276bec98e4182099d0f8b8b09d55fa3 (patch) | |
| tree | 18470e6f5217c0944ef91ad9b252d2518ad59328 | |
| parent | 91d40d270d66baa374169be662c403993f5a6591 (diff) | |
| download | rust-7a2c4d312276bec98e4182099d0f8b8b09d55fa3.tar.gz rust-7a2c4d312276bec98e4182099d0f8b8b09d55fa3.zip | |
Add step metadata and a simple test for codegen backends
| -rw-r--r-- | src/bootstrap/src/core/build_steps/compile.rs | 7 | ||||
| -rw-r--r-- | src/bootstrap/src/core/builder/tests.rs | 20 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 488217549d9..2c54a31ecbe 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1705,6 +1705,13 @@ impl Step for CodegenBackend { let codegen_backend = codegen_backend.to_str().unwrap(); t!(stamp.add_stamp(codegen_backend).write()); } + + fn metadata(&self) -> Option<StepMetadata> { + Some( + StepMetadata::build(&format!("rustc_codegen_{}", self.backend), self.target) + .built_by(self.compiler), + ) + } } /// Creates the `codegen-backends` folder for a compiler that's about to be diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index 26158abf4bd..8d458c74cf5 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -720,6 +720,26 @@ mod snapshot { } #[test] + fn build_compiler_codegen_backend() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx + .config("build") + .args(&["--set", "rust.codegen-backends=['llvm', 'cranelift']"]) + .render_steps(), @r" + [build] llvm <host> + [build] rustc 0 <host> -> rustc 1 <host> + [build] rustc 0 <host> -> rustc_codegen_cranelift 1 <host> + [build] rustc 1 <host> -> std 1 <host> + [build] rustc 1 <host> -> std 1 <host> + [build] rustc 1 <host> -> rustc 2 <host> + [build] rustc 1 <host> -> rustc_codegen_cranelift 2 <host> + [build] rustdoc 1 <host> + " + ); + } + + #[test] fn build_compiler_tools() { let ctx = TestCtx::new(); insta::assert_snapshot!( |
