Skip to content

Commit 632f06d

Browse files
authored
Rollup merge of #90031 - durin42:allow-llvm-tests, r=Mark-Simulacrum
config: add the option to enable LLVM tests I'm working on some LLVM patches in concert with a Rust patch, and it's helping me quite a bit to have this as an option. It doesn't seem that hard, so I figured I'd formalize it in x.py and send it upstream.
2 parents a980587 + f2a234e commit 632f06d

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

config.toml.example

+6
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ changelog-seen = 2
6868
# Indicates whether the LLVM assertions are enabled or not
6969
#assertions = false
7070

71+
# Indicates whether the LLVM testsuite is enabled in the build or not. Does
72+
# not execute the tests as part of the build as part of x.py build et al,
73+
# just makes it possible to do `ninja check-llvm` in the staged LLVM build
74+
# directory when doing LLVM development as part of Rust development.
75+
#tests = false
76+
7177
# Indicates whether the LLVM plugin is enabled or not
7278
#plugins = false
7379

src/bootstrap/config.rs

+5
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ pub struct Config {
9090
// llvm codegen options
9191
pub llvm_skip_rebuild: bool,
9292
pub llvm_assertions: bool,
93+
pub llvm_tests: bool,
9394
pub llvm_plugins: bool,
9495
pub llvm_optimize: bool,
9596
pub llvm_thin_lto: bool,
@@ -422,6 +423,7 @@ struct Llvm {
422423
thin_lto: Option<bool>,
423424
release_debuginfo: Option<bool>,
424425
assertions: Option<bool>,
426+
tests: Option<bool>,
425427
plugins: Option<bool>,
426428
ccache: Option<StringOrBool>,
427429
version_check: Option<bool>,
@@ -715,6 +717,7 @@ impl Config {
715717
// Store off these values as options because if they're not provided
716718
// we'll infer default values for them later
717719
let mut llvm_assertions = None;
720+
let mut llvm_tests = None;
718721
let mut llvm_plugins = None;
719722
let mut debug = None;
720723
let mut debug_assertions = None;
@@ -740,6 +743,7 @@ impl Config {
740743
}
741744
set(&mut config.ninja_in_file, llvm.ninja);
742745
llvm_assertions = llvm.assertions;
746+
llvm_tests = llvm.tests;
743747
llvm_plugins = llvm.plugins;
744748
llvm_skip_rebuild = llvm_skip_rebuild.or(llvm.skip_rebuild);
745749
set(&mut config.llvm_optimize, llvm.optimize);
@@ -991,6 +995,7 @@ impl Config {
991995

992996
config.llvm_skip_rebuild = llvm_skip_rebuild.unwrap_or(false);
993997
config.llvm_assertions = llvm_assertions.unwrap_or(false);
998+
config.llvm_tests = llvm_tests.unwrap_or(false);
994999
config.llvm_plugins = llvm_plugins.unwrap_or(false);
9951000
config.rust_optimize = optimize.unwrap_or(true);
9961001

src/bootstrap/native.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ impl Step for Llvm {
170170

171171
let assertions = if builder.config.llvm_assertions { "ON" } else { "OFF" };
172172
let plugins = if builder.config.llvm_plugins { "ON" } else { "OFF" };
173+
let enable_tests = if builder.config.llvm_tests { "ON" } else { "OFF" };
173174

174175
cfg.out_dir(&out_dir)
175176
.profile(profile)
@@ -180,7 +181,7 @@ impl Step for Llvm {
180181
.define("LLVM_INCLUDE_EXAMPLES", "OFF")
181182
.define("LLVM_INCLUDE_DOCS", "OFF")
182183
.define("LLVM_INCLUDE_BENCHMARKS", "OFF")
183-
.define("LLVM_INCLUDE_TESTS", "OFF")
184+
.define("LLVM_INCLUDE_TESTS", enable_tests)
184185
.define("LLVM_ENABLE_TERMINFO", "OFF")
185186
.define("LLVM_ENABLE_LIBEDIT", "OFF")
186187
.define("LLVM_ENABLE_BINDINGS", "OFF")

0 commit comments

Comments
 (0)