Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utilize stdlib debug assertion status in compiletest #118132

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1825,6 +1825,10 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the

cmd.arg("--json");

if builder.config.rust_debug_assertions_std {
cmd.arg("--with-debug-assertions");
};

let mut llvm_components_passed = false;
let mut copts_passed = false;
if builder.config.llvm_enabled() {
Expand Down
3 changes: 3 additions & 0 deletions src/tools/compiletest/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ pub struct Config {
/// Run ignored tests
pub run_ignored: bool,

/// Whether to run tests with `ignore-debug` header
pub with_debug_assertions: bool,

/// Only run tests that match these filters
pub filters: Vec<String>,

Expand Down
4 changes: 2 additions & 2 deletions src/tools/compiletest/src/header/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ pub(super) fn parse_cfg_name_directive<'a>(
}
condition! {
name: "debug",
condition: cfg!(debug_assertions),
message: "when building with debug assertions",
condition: config.with_debug_assertions,
message: "when running tests with `ignore-debug` header",
}
condition! {
name: config.debugger.as_ref().map(|d| d.to_str()),
Expand Down
3 changes: 3 additions & 0 deletions src/tools/compiletest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
)
.optopt("", "run", "whether to execute run-* tests", "auto | always | never")
.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")
.optflag("", "exact", "filters match exactly")
.optopt(
Expand Down Expand Up @@ -203,6 +204,7 @@ pub fn parse_config(args: Vec<String>) -> Config {

let src_base = opt_path(matches, "src-base");
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 has_tidy = if mode == Mode::Rustdoc {
Command::new("tidy")
Expand Down Expand Up @@ -238,6 +240,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
suite: matches.opt_str("suite").unwrap(),
debugger: None,
run_ignored,
with_debug_assertions,
filters: matches.free.clone(),
skip: matches.opt_strs("skip"),
filter_exact: matches.opt_present("exact"),
Expand Down
Loading