diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2023-02-28 21:19:07 -0500 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2023-03-07 08:30:08 -0500 |
| commit | ddc2d1e8063a346124633649b0d97dd6f8c33c83 (patch) | |
| tree | 281596629412807405947d28f7b9dcab42ee85b9 /src/bootstrap | |
| parent | 8d9cef4709db316c35d78d3cd1d13d970edbd57c (diff) | |
| download | rust-ddc2d1e8063a346124633649b0d97dd6f8c33c83.tar.gz rust-ddc2d1e8063a346124633649b0d97dd6f8c33c83.zip | |
Add bootstrap support for rust-installer
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/builder.rs | 1 | ||||
| -rw-r--r-- | src/bootstrap/lib.rs | 7 | ||||
| -rw-r--r-- | src/bootstrap/test.rs | 55 |
3 files changed, 57 insertions, 6 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index b33fc02f49c..786e35f6dde 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -711,6 +711,7 @@ impl<'a> Builder<'a> { test::RustdocUi, test::RustdocJson, test::HtmlCheck, + test::RustInstaller, // Run bootstrap close to the end as it's unlikely to fail test::Bootstrap, // Run run-make last, since these won't pass without make on Windows diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index f4abdf1cc57..89cf77fba7b 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -482,12 +482,7 @@ impl Build { // Make sure we update these before gathering metadata so we don't get an error about missing // Cargo.toml files. - let rust_submodules = [ - "src/tools/rust-installer", - "src/tools/cargo", - "library/backtrace", - "library/stdarch", - ]; + let rust_submodules = ["src/tools/cargo", "library/backtrace", "library/stdarch"]; for s in rust_submodules { build.update_submodule(Path::new(s)); } diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index b4f1506dc8f..f5d680df113 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -2695,3 +2695,58 @@ impl Step for LintDocs { }); } } + +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct RustInstaller; + +impl Step for RustInstaller { + type Output = (); + const ONLY_HOSTS: bool = true; + const DEFAULT: bool = true; + + /// Ensure the version placeholder replacement tool builds + fn run(self, builder: &Builder<'_>) { + builder.info("test rust-installer"); + + let bootstrap_host = builder.config.build; + let compiler = builder.compiler(0, bootstrap_host); + let cargo = tool::prepare_tool_cargo( + builder, + compiler, + Mode::ToolBootstrap, + bootstrap_host, + "test", + "src/tools/rust-installer", + SourceType::InTree, + &[], + ); + try_run(builder, &mut cargo.into()); + + // We currently don't support running the test.sh script outside linux(?) environments. + // Eventually this should likely migrate to #[test]s in rust-installer proper rather than a + // set of scripts, which will likely allow dropping this if. + if bootstrap_host != "x86_64-unknown-linux-gnu" { + return; + } + + let mut cmd = + std::process::Command::new(builder.src.join("src/tools/rust-installer/test.sh")); + let tmpdir = testdir(builder, compiler.host).join("rust-installer"); + let _ = std::fs::remove_dir_all(&tmpdir); + let _ = std::fs::create_dir_all(&tmpdir); + cmd.current_dir(&tmpdir); + cmd.env("CARGO_TARGET_DIR", tmpdir.join("cargo-target")); + cmd.env("CARGO", &builder.initial_cargo); + cmd.env("RUSTC", &builder.initial_rustc); + cmd.env("TMP_DIR", &tmpdir); + try_run(builder, &mut cmd); + } + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + run.path("src/tools/rust-installer") + } + + fn make_run(run: RunConfig<'_>) { + run.builder.ensure(Self); + } +} |
