Skip to content

Commit b10cfcd

Browse files
committed
Auto merge of #118132 - onur-ozkan:stdlib-assertion-status-to-compiletest, r=wesleywiser
utilize stdlib debug assertion status in compiletest Implemented a new flag `--with-debug-assertions` on compiletest to pass the stdlib debug assertion status from bootstrap. Resolves #115171
2 parents abe34e9 + 0b2fd39 commit b10cfcd

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

src/bootstrap/src/core/build_steps/test.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1827,6 +1827,10 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
18271827

18281828
cmd.arg("--json");
18291829

1830+
if builder.config.rust_debug_assertions_std {
1831+
cmd.arg("--with-debug-assertions");
1832+
};
1833+
18301834
let mut llvm_components_passed = false;
18311835
let mut copts_passed = false;
18321836
if builder.config.llvm_enabled() {

src/tools/compiletest/src/common.rs

+3
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@ pub struct Config {
242242
/// Run ignored tests
243243
pub run_ignored: bool,
244244

245+
/// Whether to run tests with `ignore-debug` header
246+
pub with_debug_assertions: bool,
247+
245248
/// Only run tests that match these filters
246249
pub filters: Vec<String>,
247250

src/tools/compiletest/src/header/cfg.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ pub(super) fn parse_cfg_name_directive<'a>(
190190
}
191191
condition! {
192192
name: "debug",
193-
condition: cfg!(debug_assertions),
194-
message: "when building with debug assertions",
193+
condition: config.with_debug_assertions,
194+
message: "when running tests with `ignore-debug` header",
195195
}
196196
condition! {
197197
name: config.debugger.as_ref().map(|d| d.to_str()),

src/tools/compiletest/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
8181
)
8282
.optopt("", "run", "whether to execute run-* tests", "auto | always | never")
8383
.optflag("", "ignored", "run tests marked as ignored")
84+
.optflag("", "with-debug-assertions", "whether to run tests with `ignore-debug` header")
8485
.optmulti("", "skip", "skip tests matching SUBSTRING. Can be passed multiple times", "SUBSTRING")
8586
.optflag("", "exact", "filters match exactly")
8687
.optopt(
@@ -203,6 +204,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
203204

204205
let src_base = opt_path(matches, "src-base");
205206
let run_ignored = matches.opt_present("ignored");
207+
let with_debug_assertions = matches.opt_present("with-debug-assertions");
206208
let mode = matches.opt_str("mode").unwrap().parse().expect("invalid mode");
207209
let has_tidy = if mode == Mode::Rustdoc {
208210
Command::new("tidy")
@@ -238,6 +240,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
238240
suite: matches.opt_str("suite").unwrap(),
239241
debugger: None,
240242
run_ignored,
243+
with_debug_assertions,
241244
filters: matches.free.clone(),
242245
skip: matches.opt_strs("skip"),
243246
filter_exact: matches.opt_present("exact"),

0 commit comments

Comments
 (0)