Skip to content

Commit ef1308c

Browse files
committed
Handle RUST_TEST_NOCAPTURE in compiletest and set add if to run env
closes #17829
1 parent 5be210c commit ef1308c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/compiletest/compiletest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
267267
logfile: config.logfile.clone(),
268268
run_tests: true,
269269
run_benchmarks: true,
270-
nocapture: false,
270+
nocapture: env::var("RUST_TEST_NOCAPTURE").is_ok(),
271271
color: test::AutoColor,
272272
}
273273
}

src/compiletest/header.rs

+12
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
use std::env;
12+
1113
use common::Config;
1214
use common;
1315
use util;
@@ -125,6 +127,16 @@ pub fn load_props(testfile: &Path) -> TestProps {
125127
true
126128
});
127129

130+
for key in vec!["RUST_TEST_NOCAPTURE", "RUST_TEST_TASKS"] {
131+
match env::var(key) {
132+
Ok(val) =>
133+
if exec_env.iter().find(|&&(ref x, _)| *x == key.to_string()).is_none() {
134+
exec_env.push((key.to_string(), val))
135+
},
136+
Err(..) => {}
137+
}
138+
}
139+
128140
TestProps {
129141
error_patterns: error_patterns,
130142
compile_flags: compile_flags,

0 commit comments

Comments
 (0)