Skip to content

Commit 6a637a0

Browse files
committed
parse configure args for debug assertions and use them in the test env
this way opt-dist respects debug-assertions on alt builds, so that bootstrap runs the correct set of tests in stage0 post optimization tests.
1 parent 8882ec5 commit 6a637a0

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

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

+13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use anyhow::Context;
22
use camino::{Utf8Path, Utf8PathBuf};
33
use clap::Parser;
4+
use environment::TestConfig;
45
use log::LevelFilter;
56
use utils::io;
67

@@ -148,6 +149,11 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
148149

149150
let is_aarch64 = target_triple.starts_with("aarch64");
150151

152+
// Parse the optional build components that impact the test environment.
153+
let rust_configure_args = std::env::var("RUST_CONFIGURE_ARGS")
154+
.expect("RUST_CONFIGURE_ARGS environment variable missing");
155+
let test_config = TestConfig::from_configure_args(&rust_configure_args);
156+
151157
let checkout_dir = Utf8PathBuf::from("/checkout");
152158
let env = EnvironmentBuilder::default()
153159
.host_tuple(target_triple)
@@ -160,6 +166,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
160166
// FIXME: Enable bolt for aarch64 once it's fixed upstream. Broken as of December 2024.
161167
.use_bolt(!is_aarch64)
162168
.skipped_tests(vec![])
169+
.test_config(test_config)
163170
.build()?;
164171

165172
(env, shared.build_args)
@@ -168,6 +175,11 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
168175
let target_triple =
169176
std::env::var("PGO_HOST").expect("PGO_HOST environment variable missing");
170177

178+
// Parse the optional build components that impact the test environment.
179+
let rust_configure_args = std::env::var("RUST_CONFIGURE_ARGS")
180+
.expect("RUST_CONFIGURE_ARGS environment variable missing");
181+
let test_config = TestConfig::from_configure_args(&rust_configure_args);
182+
171183
let checkout_dir: Utf8PathBuf = std::env::current_dir()?.try_into()?;
172184
let env = EnvironmentBuilder::default()
173185
.host_tuple(target_triple)
@@ -179,6 +191,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
179191
.shared_llvm(false)
180192
.use_bolt(false)
181193
.skipped_tests(vec![])
194+
.test_config(test_config)
182195
.build()?;
183196

184197
(env, shared.build_args)

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ change-id = 115898
7272
[rust]
7373
channel = "{channel}"
7474
verbose-tests = true
75+
debug-assertions = {debug_assertions}
7576
7677
[build]
7778
rustc = "{rustc}"
@@ -83,7 +84,8 @@ llvm-config = "{llvm_config}"
8384
"#,
8485
rustc = rustc_path.to_string().replace('\\', "/"),
8586
cargo = cargo_path.to_string().replace('\\', "/"),
86-
llvm_config = llvm_config.to_string().replace('\\', "/")
87+
llvm_config = llvm_config.to_string().replace('\\', "/"),
88+
debug_assertions = env.test_config().enable_debug_assertions,
8789
);
8890
log::info!("Using following `bootstrap.toml` for running tests:\n{config_content}");
8991

0 commit comments

Comments
 (0)