Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/tools/opt-dist/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that we could also read the src/ci/channel file? But this seems good enough.

Copy link
Member Author

@jieyouxu jieyouxu Dec 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK we could (that's the initial approach considered), but the logic above doesn't read that file either, and instead derives it from the archive name of the dist artifact, which is why I wrote this hack instead...

FTR, this is what I meant by #134528 (comment), should've clarified.


// 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}"))?
Expand Down Expand Up @@ -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}"
Expand Down Expand Up @@ -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 {
Comment on lines +126 to +128
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dist version extraction above this is slightly hacky, and so is this, but oh well.

match version_str {
"nightly" => "nightly",
"beta" => "beta",
_ => "stable",
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Check `RUSTC_BOOTSTRAP`'s behavior in relation to feature stability and what rustc considers
//! itself to be (stable vs non-stable ).
//! Check the compiler's behavior when the perma-unstable env var `RUSTC_BOOTSTRAP` is set in the
//! environment in relation to feature stability and which channel rustc considers itself to be.
//!
//! `RUSTC_BOOTSTRAP` accepts:
//!
Expand Down
Loading