Skip to content
/ rust Public
forked from rust-lang/rust

Commit 62a104d

Browse files
committed
opt-dist: add a flag for running tests
when using `opt-dist local` user probably won't need to run tests (for various reasons). currently the only way to disable them is to set `TRY_DIST_BUILD=1`, which is not obvious and can be bad for non-CI envronments (as I guess)
1 parent 79a272c commit 62a104d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

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

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub struct Environment {
2525
prebuilt_rustc_perf: Option<Utf8PathBuf>,
2626
use_bolt: bool,
2727
shared_llvm: bool,
28+
run_tests: bool,
2829
}
2930

3031
impl Environment {
@@ -101,6 +102,10 @@ impl Environment {
101102
pub fn benchmark_cargo_config(&self) -> &[String] {
102103
&self.benchmark_cargo_config
103104
}
105+
106+
pub fn run_tests(&self) -> bool {
107+
self.run_tests
108+
}
104109
}
105110

106111
/// What is the extension of binary executables on this platform?

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

+9-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ enum EnvironmentCmd {
9494
/// Arguments passed to `rustc-perf --cargo-config <value>` when running benchmarks.
9595
#[arg(long)]
9696
benchmark_cargo_config: Vec<String>,
97+
98+
/// Perform tests after final build if it's not a try build
99+
#[arg(long)]
100+
run_tests: bool,
97101
},
98102
/// Perform an optimized build on Linux CI, from inside Docker.
99103
LinuxCi {
@@ -125,6 +129,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
125129
skipped_tests,
126130
benchmark_cargo_config,
127131
shared,
132+
run_tests,
128133
} => {
129134
let env = EnvironmentBuilder::default()
130135
.host_tuple(target_triple)
@@ -138,6 +143,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
138143
.use_bolt(use_bolt)
139144
.skipped_tests(skipped_tests)
140145
.benchmark_cargo_config(benchmark_cargo_config)
146+
.run_tests(run_tests)
141147
.build()?;
142148

143149
(env, shared.build_args)
@@ -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+
.run_tests(true)
163170
.build()?;
164171

165172
(env, shared.build_args)
@@ -179,6 +186,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
179186
.shared_llvm(false)
180187
.use_bolt(false)
181188
.skipped_tests(vec![])
189+
.run_tests(true)
182190
.build()?;
183191

184192
(env, shared.build_args)
@@ -344,7 +352,7 @@ fn execute_pipeline(
344352
// possible regressions.
345353
// The tests are not executed for try builds, which can be in various broken states, so we don't
346354
// want to gatekeep them with tests.
347-
if !is_try_build() {
355+
if !is_try_build() && env.run_tests() {
348356
timer.section("Run tests", |_| run_tests(env))?;
349357
}
350358

0 commit comments

Comments
 (0)