Skip to content
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
2 changes: 2 additions & 0 deletions src/tools/compiletest/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,8 @@ pub struct Config {
pub only_modified: bool,

pub target_cfg: LazyCell<TargetCfg>,

pub nocapture: bool,
}

impl Config {
Expand Down
15 changes: 11 additions & 4 deletions src/tools/compiletest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
)
.optflag("", "force-rerun", "rerun tests even if the inputs are unchanged")
.optflag("", "only-modified", "only run tests that result been modified")
.optflag("", "nocapture", "")
.optflag("h", "help", "show this message")
.reqopt("", "channel", "current Rust channel", "CHANNEL")
.optopt("", "edition", "default Rust edition", "EDITION");
Expand Down Expand Up @@ -304,6 +305,8 @@ pub fn parse_config(args: Vec<String>) -> Config {
force_rerun: matches.opt_present("force-rerun"),

target_cfg: LazyCell::new(),

nocapture: matches.opt_present("nocapture"),
}
}

Expand Down Expand Up @@ -496,6 +499,13 @@ fn configure_lldb(config: &Config) -> Option<Config> {
}

pub fn test_opts(config: &Config) -> test::TestOpts {
if env::var("RUST_TEST_NOCAPTURE").is_ok() {
eprintln!(
"WARNING: RUST_TEST_NOCAPTURE is no longer used. \
Use the `--nocapture` flag instead."
);
}

test::TestOpts {
exclude_should_panic: false,
filters: config.filters.clone(),
Expand All @@ -505,10 +515,7 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
logfile: config.logfile.clone(),
run_tests: true,
bench_benchmarks: true,
nocapture: match env::var("RUST_TEST_NOCAPTURE") {
Ok(val) => &val != "0",
Err(_) => false,
},
nocapture: config.nocapture,
color: config.color,
shuffle: false,
shuffle_seed: None,
Expand Down