Skip to content

Commit 0b2fd39

Browse files
committed
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. Signed-off-by: onur-ozkan <[email protected]>
1 parent ee5ef3a commit 0b2fd39

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
@@ -1825,6 +1825,10 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
18251825

18261826
cmd.arg("--json");
18271827

1828+
if builder.config.rust_debug_assertions_std {
1829+
cmd.arg("--with-debug-assertions");
1830+
};
1831+
18281832
let mut llvm_components_passed = false;
18291833
let mut copts_passed = false;
18301834
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
@@ -196,8 +196,8 @@ pub(super) fn parse_cfg_name_directive<'a>(
196196
}
197197
condition! {
198198
name: "debug",
199-
condition: cfg!(debug_assertions),
200-
message: "when building with debug assertions",
199+
condition: config.with_debug_assertions,
200+
message: "when running tests with `ignore-debug` header",
201201
}
202202
condition! {
203203
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)