diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-11-08 22:59:20 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-11-08 22:59:20 (GMT) |
commit | 34e78344516f1ddc8951ab3087fa8c6263021087 (patch) | |
tree | 295feffcc108b2ad97348ebc777b2565d5fae5d8 /Source | |
parent | eccc4779e44baeb0bdec8b0a83901bcbbf3ff7b8 (diff) | |
download | CMake-34e78344516f1ddc8951ab3087fa8c6263021087.zip CMake-34e78344516f1ddc8951ab3087fa8c6263021087.tar.gz CMake-34e78344516f1ddc8951ab3087fa8c6263021087.tar.bz2 |
ENH: Add support for output reguilar expression
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 56 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.h | 2 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 31 |
3 files changed, 87 insertions, 2 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 6c9b5d8..0385cd7 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -751,7 +751,39 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed, if ( !m_CTest->GetShowOnly() ) { bool testFailed = false; - if (res == cmsysProcess_State_Exited && retVal == 0) + std::vector<cmsys::RegularExpression>::iterator passIt; + bool forceFail = false; + if ( it->m_RequiredRegularExpressions.size() > 0 ) + { + bool found = false; + for ( passIt = it->m_RequiredRegularExpressions.begin(); + passIt != it->m_RequiredRegularExpressions.end(); + ++ passIt ) + { + if ( passIt->find(output.c_str()) ) + { + found = true; + } + } + if ( !found ) + { + forceFail = true; + } + } + if ( it->m_ErrorRegularExpressions.size() > 0 ) + { + for ( passIt = it->m_ErrorRegularExpressions.begin(); + passIt != it->m_ErrorRegularExpressions.end(); + ++ passIt ) + { + if ( passIt->find(output.c_str()) ) + { + forceFail = true; + } + } + } + + if (res == cmsysProcess_State_Exited && retVal == 0 && !forceFail) { cmCTestLog(m_CTest, HANDLER_OUTPUT, " Passed"); if ( it->m_WillFail ) @@ -769,6 +801,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed, else { testFailed = true; + cres.m_Status = cmCTestTestHandler::FAILED; if ( res == cmsysProcess_State_Expired ) { @@ -809,6 +842,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed, } else { + // Force fail will also be here? cmCTestLog(m_CTest, HANDLER_OUTPUT, "***Failed"); if ( it->m_WillFail ) { @@ -1524,6 +1558,26 @@ bool cmCTestTestHandler::SetTestsProperties(const std::vector<std::string>& args { rtit->m_WillFail = cmSystemTools::IsOn(val.c_str()); } + if ( key == "ERROR_REGULAR_EXPRESSION" ) + { + 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->m_ErrorRegularExpressions.push_back(cmsys::RegularExpression(crit->c_str())); + } + } + if ( key == "REQUIRED_REGULAR_EXPRESSION" ) + { + 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->m_RequiredRegularExpressions.push_back(cmsys::RegularExpression(crit->c_str())); + } + } } } } diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 7e9043f..fc0e230 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -95,6 +95,8 @@ protected: cmStdString m_Name; cmStdString m_Directory; std::vector<std::string> m_Args; + std::vector<cmsys::RegularExpression> m_ErrorRegularExpressions; + std::vector<cmsys::RegularExpression> m_RequiredRegularExpressions; bool m_IsInBasedOnREOptions; bool m_WillFail; }; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 1aa0686..f48f760 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -184,7 +184,36 @@ void cmLocalGenerator::GenerateTestFiles() fout << "SET_TESTS_PROPERTIES(" << test->GetName() << " PROPERTIES "; for ( pit = mpit->begin(); pit != mpit->end(); ++ pit ) { - fout << " " << pit->first.c_str() << " \"" << pit->second.c_str() << "\""; + fout << " " << pit->first.c_str() << " \""; + const char* value = pit->second.c_str(); + for ( ; *value; ++ value ) + { + switch ( *value ) + { + case '\\': + case '"': + case ' ': + case '#': + case '(': + case ')': + case '$': + case '^': + fout << "\\" << *value; + break; + case '\t': + fout << "\\t"; + break; + case '\n': + fout << "\\n"; + break; + case '\r': + fout << "\\r"; + break; + default: + fout << *value; + } + } + fout << "\""; } fout << ")" << std::endl; } |