From ef1308c407c34d91d176f1de6c0f86ecbea615f4 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Sun, 15 Feb 2015 15:30:09 +0100 Subject: [PATCH] Handle RUST_TEST_NOCAPTURE in compiletest and set add if to run env closes #17829 --- src/compiletest/compiletest.rs | 2 +- src/compiletest/header.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 385f1b9e791..d43fe242c65 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -267,7 +267,7 @@ pub fn test_opts(config: &Config) -> test::TestOpts { logfile: config.logfile.clone(), run_tests: true, run_benchmarks: true, - nocapture: false, + nocapture: env::var("RUST_TEST_NOCAPTURE").is_ok(), color: test::AutoColor, } } diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index c2539679643..fceac9716b1 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::env; + use common::Config; use common; use util; @@ -125,6 +127,16 @@ pub fn load_props(testfile: &Path) -> TestProps { true }); + for key in vec!["RUST_TEST_NOCAPTURE", "RUST_TEST_TASKS"] { + match env::var(key) { + Ok(val) => + if exec_env.iter().find(|&&(ref x, _)| *x == key.to_string()).is_none() { + exec_env.push((key.to_string(), val)) + }, + Err(..) => {} + } + } + TestProps { error_patterns: error_patterns, compile_flags: compile_flags,