diff options
| author | Jieyou Xu <jieyouxu@outlook.com> | 2024-12-19 21:37:18 +0800 |
|---|---|---|
| committer | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2024-12-20 02:32:28 +0800 |
| commit | 42bf2af5ea1ab6e797fe2ce0abfb83e111288ded (patch) | |
| tree | 857e70bf669e6cdfeeeb04bb882ae0860ea6acf0 /src/tools | |
| parent | 3bf62ccc1055a94dfa6a72650b10a71dcf232429 (diff) | |
| download | rust-42bf2af5ea1ab6e797fe2ce0abfb83e111288ded.tar.gz rust-42bf2af5ea1ab6e797fe2ce0abfb83e111288ded.zip | |
opt-dist: propagate channel info to bootstrap
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/opt-dist/src/tests.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/tools/opt-dist/src/tests.rs b/src/tools/opt-dist/src/tests.rs index 887055798e0..06ed076a864 100644 --- a/src/tools/opt-dist/src/tests.rs +++ b/src/tools/opt-dist/src/tests.rs @@ -25,6 +25,8 @@ pub fn run_tests(env: &Environment) -> anyhow::Result<()> { let host_triple = env.host_tuple(); let version = find_dist_version(&dist_dir)?; + let channel = version_to_channel(&version); + // Extract rustc, libstd, cargo and src archives to create the optimized sysroot let rustc_dir = extract_dist_dir(&format!("rustc-{version}-{host_triple}"))?.join("rustc"); let libstd_dir = extract_dist_dir(&format!("rust-std-{version}-{host_triple}"))? @@ -61,9 +63,13 @@ pub fn run_tests(env: &Environment) -> anyhow::Result<()> { assert!(llvm_config.is_file()); let config_content = format!( - r#"profile = "user" + r#" +profile = "user" change-id = 115898 +[rust] +channel = "{channel}" + [build] rustc = "{rustc}" cargo = "{cargo}" @@ -116,3 +122,13 @@ fn find_dist_version(directory: &Utf8Path) -> anyhow::Result<String> { archive.strip_prefix("reproducible-artifacts-").unwrap().split_once('-').unwrap(); Ok(version.to_string()) } + +/// Roughly convert a version string (`nightly`, `beta`, or `1.XY.Z`) to channel string (`nightly`, +/// `beta` or `stable`). +fn version_to_channel(version_str: &str) -> &'static str { + match version_str { + "nightly" => "nightly", + "beta" => "beta", + _ => "stable", + } +} |
