summaryrefslogtreecommitdiffstats
path: root/Source/CTest
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-11-08 22:59:20 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-11-08 22:59:20 (GMT)
commit34e78344516f1ddc8951ab3087fa8c6263021087 (patch)
tree295feffcc108b2ad97348ebc777b2565d5fae5d8 /Source/CTest
parenteccc4779e44baeb0bdec8b0a83901bcbbf3ff7b8 (diff)
downloadCMake-34e78344516f1ddc8951ab3087fa8c6263021087.zip
CMake-34e78344516f1ddc8951ab3087fa8c6263021087.tar.gz
CMake-34e78344516f1ddc8951ab3087fa8c6263021087.tar.bz2
ENH: Add support for output reguilar expression
Diffstat (limited to 'Source/CTest')
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx56
-rw-r--r--Source/CTest/cmCTestTestHandler.h2
2 files changed, 57 insertions, 1 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;
};