Skip to content

Commit 9ac6c2a

Browse files
lqdKobzol
authored andcommitted
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 8069e25 commit 9ac6c2a

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

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

Lines changed: 13 additions & 0 deletions
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

@@ -158,6 +159,11 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
158159

159160
let is_aarch64 = target_triple.starts_with("aarch64");
160161

162+
// Parse the optional build components that impact the test environment.
163+
let rust_configure_args = std::env::var("RUST_CONFIGURE_ARGS")
164+
.expect("RUST_CONFIGURE_ARGS environment variable missing");
165+
let test_config = TestConfig::from_configure_args(&rust_configure_args);
166+
161167
let checkout_dir = Utf8PathBuf::from("/checkout");
162168
let env = EnvironmentBuilder::default()
163169
.host_tuple(target_triple)
@@ -172,6 +178,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
172178
.skipped_tests(vec![])
173179
.run_tests(true)
174180
.fast_try_build(is_fast_try_build)
181+
.test_config(test_config)
175182
.build()?;
176183

177184
(env, shared.build_args)
@@ -180,6 +187,11 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
180187
let target_triple =
181188
std::env::var("PGO_HOST").expect("PGO_HOST environment variable missing");
182189

190+
// Parse the optional build components that impact the test environment.
191+
let rust_configure_args = std::env::var("RUST_CONFIGURE_ARGS")
192+
.expect("RUST_CONFIGURE_ARGS environment variable missing");
193+
let test_config = TestConfig::from_configure_args(&rust_configure_args);
194+
183195
let checkout_dir: Utf8PathBuf = std::env::current_dir()?.try_into()?;
184196
let env = EnvironmentBuilder::default()
185197
.host_tuple(target_triple)
@@ -193,6 +205,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
193205
.skipped_tests(vec![])
194206
.run_tests(true)
195207
.fast_try_build(is_fast_try_build)
208+
.test_config(test_config)
196209
.build()?;
197210

198211
(env, shared.build_args)

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

Lines changed: 3 additions & 1 deletion
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)