diff options
author | David Cole <david.cole@kitware.com> | 2008-11-26 19:38:43 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2008-11-26 19:38:43 (GMT) |
commit | ceaef94cccf10a02e1bcce29d3cfa6955acf4565 (patch) | |
tree | a0cbd04050fee7082c6e3e3ad38c73877fa6f806 /Source/CTest | |
parent | 003dbff85d58d6fc2668f2e1819b413a6357b2bc (diff) | |
download | CMake-ceaef94cccf10a02e1bcce29d3cfa6955acf4565.zip CMake-ceaef94cccf10a02e1bcce29d3cfa6955acf4565.tar.gz CMake-ceaef94cccf10a02e1bcce29d3cfa6955acf4565.tar.bz2 |
ENH: Implement feature request from issue 7885. Allow setting environment variables on a per-test basis for ctest using set_test_properties ENVIRONMENT.
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestBuildAndTestHandler.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 20 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.h | 1 |
3 files changed, 17 insertions, 6 deletions
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index cb713a6..92d8270 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -382,7 +382,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) } int runTestRes = this->CTest->RunTest(testCommand, &outs, &retval, 0, - remainingTime); + remainingTime, 0); if(runTestRes != cmsysProcess_State_Exited || retval != 0) { diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 69090d6..9a747ac 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -733,11 +733,11 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it, if ( !this->CTest->GetShowOnly() ) { res = this->CTest->RunTest(arguments, &output, &retVal, this->LogFile, - it->Timeout); + it->Timeout, &it->Environment); } - - clock_finish = cmSystemTools::GetTime(); - + + clock_finish = cmSystemTools::GetTime(); + if ( this->LogFile ) { double ttime = clock_finish - clock_start; @@ -2209,7 +2209,7 @@ bool cmCTestTestHandler::SetTestsProperties( } } if ( key == "DEPENDS" ) - { + { std::vector<std::string> lval; cmSystemTools::ExpandListArgument(val.c_str(), lval); std::vector<std::string>::iterator crit; @@ -2218,6 +2218,16 @@ bool cmCTestTestHandler::SetTestsProperties( rtit->Depends.push_back(*crit); } } + if ( key == "ENVIRONMENT" ) + { + std::vector<std::string> lval; + cmSystemTools::ExpandListArgument(val.c_str(), lval); + std::vector<std::string>::iterator crit; + for ( crit = lval.begin(); crit != lval.end(); ++ crit ) + { + rtit->Environment.push_back(*crit); + } + } if ( key == "MEASUREMENT" ) { size_t pos = val.find_first_of("="); diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index b56f817..451a477 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -90,6 +90,7 @@ public: bool WillFail; double Timeout; int Index; + std::vector<std::string> Environment; }; struct cmCTestTestResult |