diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2007-09-19 15:16:57 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2007-09-19 15:16:57 (GMT) |
commit | 797db515a0ff1eceb993481673fa85e601ae5f6e (patch) | |
tree | 347b5bdc59e09576afa362427505f93f69084e5c /Source/CTest | |
parent | 4710c7aef619b34486980c74bf226986550ae3b6 (diff) | |
download | CMake-797db515a0ff1eceb993481673fa85e601ae5f6e.zip CMake-797db515a0ff1eceb993481673fa85e601ae5f6e.tar.gz CMake-797db515a0ff1eceb993481673fa85e601ae5f6e.tar.bz2 |
ENH: fix failing test when valgrind is on
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 30 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.h | 4 |
2 files changed, 23 insertions, 11 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 8249352..fafbdea 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -655,11 +655,11 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it, cres.ExecutionTime = (double)(clock_finish - clock_start); cres.FullCommandLine = testCommand; - + std::string reason; if ( !this->CTest->GetShowOnly() ) { bool testFailed = false; - std::vector<cmsys::RegularExpression>::iterator passIt; + std::vector<std::pair<cmsys::RegularExpression,std::string> >::iterator passIt; bool forceFail = false; if ( it->RequiredRegularExpressions.size() > 0 ) { @@ -668,13 +668,17 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it, passIt != it->RequiredRegularExpressions.end(); ++ passIt ) { - if ( passIt->find(output.c_str()) ) + if ( passIt->first.find(output.c_str()) ) { found = true; } } if ( !found ) - { + { + reason = "Required regular expression not found."; + reason += "Regex=["; + reason += passIt->second; + reason += "]"; forceFail = true; } } @@ -684,8 +688,12 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it, passIt != it->ErrorRegularExpressions.end(); ++ passIt ) { - if ( passIt->find(output.c_str()) ) + if ( passIt->first.find(output.c_str()) ) { + reason = "Error regular expression found in output."; + reason += " Regex=["; + reason += passIt->second; + reason += "]"; forceFail = true; } } @@ -701,7 +709,7 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it, cmCTestLog(this->CTest, HANDLER_OUTPUT, " - But it should fail!"); cres.Status = cmCTestTestHandler::FAILED; testFailed = true; - } + } else { cres.Status = cmCTestTestHandler::COMPLETED; @@ -754,7 +762,7 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it, else { // Force fail will also be here? - cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Failed"); + cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Failed " << reason); if ( it->WillFail ) { cres.Status = cmCTestTestHandler::COMPLETED; @@ -1729,7 +1737,9 @@ bool cmCTestTestHandler::SetTestsProperties( for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { rtit->ErrorRegularExpressions.push_back( - cmsys::RegularExpression(crit->c_str())); + std::pair<cmsys::RegularExpression, std::string>( + cmsys::RegularExpression(crit->c_str()), + std::string(crit->c_str()))); } } if ( key == "MEASUREMENT" ) @@ -1754,7 +1764,9 @@ bool cmCTestTestHandler::SetTestsProperties( for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { rtit->RequiredRegularExpressions.push_back( - cmsys::RegularExpression(crit->c_str())); + std::pair<cmsys::RegularExpression, std::string>( + cmsys::RegularExpression(crit->c_str()), + std::string(crit->c_str()))); } } } diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 457b843..e4f0b98 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -80,8 +80,8 @@ public: cmStdString Name; cmStdString Directory; std::vector<std::string> Args; - std::vector<cmsys::RegularExpression> ErrorRegularExpressions; - std::vector<cmsys::RegularExpression> RequiredRegularExpressions; + std::vector<std::pair<cmsys::RegularExpression,std::string> > ErrorRegularExpressions; + std::vector<std::pair<cmsys::RegularExpression,std::string> > RequiredRegularExpressions; std::map<cmStdString, cmStdString> Measurements; bool IsInBasedOnREOptions; bool WillFail; |