Skip to content

Commit 42bf2af

Browse files
committed
opt-dist: propagate channel info to bootstrap
1 parent 3bf62cc commit 42bf2af

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/tools/opt-dist/src/tests.rs

+17-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ pub fn run_tests(env: &Environment) -> anyhow::Result<()> {
2525
let host_triple = env.host_tuple();
2626
let version = find_dist_version(&dist_dir)?;
2727

28+
let channel = version_to_channel(&version);
29+
2830
// Extract rustc, libstd, cargo and src archives to create the optimized sysroot
2931
let rustc_dir = extract_dist_dir(&format!("rustc-{version}-{host_triple}"))?.join("rustc");
3032
let libstd_dir = extract_dist_dir(&format!("rust-std-{version}-{host_triple}"))?
@@ -61,9 +63,13 @@ pub fn run_tests(env: &Environment) -> anyhow::Result<()> {
6163
assert!(llvm_config.is_file());
6264

6365
let config_content = format!(
64-
r#"profile = "user"
66+
r#"
67+
profile = "user"
6568
change-id = 115898
6669
70+
[rust]
71+
channel = "{channel}"
72+
6773
[build]
6874
rustc = "{rustc}"
6975
cargo = "{cargo}"
@@ -116,3 +122,13 @@ fn find_dist_version(directory: &Utf8Path) -> anyhow::Result<String> {
116122
archive.strip_prefix("reproducible-artifacts-").unwrap().split_once('-').unwrap();
117123
Ok(version.to_string())
118124
}
125+
126+
/// Roughly convert a version string (`nightly`, `beta`, or `1.XY.Z`) to channel string (`nightly`,
127+
/// `beta` or `stable`).
128+
fn version_to_channel(version_str: &str) -> &'static str {
129+
match version_str {
130+
"nightly" => "nightly",
131+
"beta" => "beta",
132+
_ => "stable",
133+
}
134+
}

0 commit comments

Comments
 (0)