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
This commit is contained in:
bors 2023-11-29 17:41:27 +00:00
commit b10cfcd65f
4 changed files with 12 additions and 2 deletions

View File

@ -1827,6 +1827,10 @@ fn run(self, builder: &Builder<'_>) {
cmd.arg("--json"); cmd.arg("--json");
if builder.config.rust_debug_assertions_std {
cmd.arg("--with-debug-assertions");
};
let mut llvm_components_passed = false; let mut llvm_components_passed = false;
let mut copts_passed = false; let mut copts_passed = false;
if builder.config.llvm_enabled() { if builder.config.llvm_enabled() {

View File

@ -242,6 +242,9 @@ pub struct Config {
/// Run ignored tests /// Run ignored tests
pub run_ignored: bool, pub run_ignored: bool,
/// Whether to run tests with `ignore-debug` header
pub with_debug_assertions: bool,
/// Only run tests that match these filters /// Only run tests that match these filters
pub filters: Vec<String>, pub filters: Vec<String>,

View File

@ -190,8 +190,8 @@ macro_rules! condition {
} }
condition! { condition! {
name: "debug", name: "debug",
condition: cfg!(debug_assertions), condition: config.with_debug_assertions,
message: "when building with debug assertions", message: "when running tests with `ignore-debug` header",
} }
condition! { condition! {
name: config.debugger.as_ref().map(|d| d.to_str()), name: config.debugger.as_ref().map(|d| d.to_str()),

View File

@ -81,6 +81,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
) )
.optopt("", "run", "whether to execute run-* tests", "auto | always | never") .optopt("", "run", "whether to execute run-* tests", "auto | always | never")
.optflag("", "ignored", "run tests marked as ignored") .optflag("", "ignored", "run tests marked as ignored")
.optflag("", "with-debug-assertions", "whether to run tests with `ignore-debug` header")
.optmulti("", "skip", "skip tests matching SUBSTRING. Can be passed multiple times", "SUBSTRING") .optmulti("", "skip", "skip tests matching SUBSTRING. Can be passed multiple times", "SUBSTRING")
.optflag("", "exact", "filters match exactly") .optflag("", "exact", "filters match exactly")
.optopt( .optopt(
@ -203,6 +204,7 @@ fn make_absolute(path: PathBuf) -> PathBuf {
let src_base = opt_path(matches, "src-base"); let src_base = opt_path(matches, "src-base");
let run_ignored = matches.opt_present("ignored"); let run_ignored = matches.opt_present("ignored");
let with_debug_assertions = matches.opt_present("with-debug-assertions");
let mode = matches.opt_str("mode").unwrap().parse().expect("invalid mode"); let mode = matches.opt_str("mode").unwrap().parse().expect("invalid mode");
let has_tidy = if mode == Mode::Rustdoc { let has_tidy = if mode == Mode::Rustdoc {
Command::new("tidy") Command::new("tidy")
@ -238,6 +240,7 @@ fn make_absolute(path: PathBuf) -> PathBuf {
suite: matches.opt_str("suite").unwrap(), suite: matches.opt_str("suite").unwrap(),
debugger: None, debugger: None,
run_ignored, run_ignored,
with_debug_assertions,
filters: matches.free.clone(), filters: matches.free.clone(),
skip: matches.opt_strs("skip"), skip: matches.opt_strs("skip"),
filter_exact: matches.opt_present("exact"), filter_exact: matches.opt_present("exact"),