summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestRunTest.cxx
diff options
context:
space:
mode:
authorZach Mullen <zach.mullen@kitware.com>2009-08-27 14:37:30 (GMT)
committerZach Mullen <zach.mullen@kitware.com>2009-08-27 14:37:30 (GMT)
commit177edc5ed1bed7306a122129dfcaf13d898f83ef (patch)
tree43db43d2af66aec0f021ad5e8e7d9067d46088ce /Source/CTest/cmCTestRunTest.cxx
parentfdc0d9777cf548b44d8cfa43502efb26a6247e9b (diff)
downloadCMake-177edc5ed1bed7306a122129dfcaf13d898f83ef.zip
CMake-177edc5ed1bed7306a122129dfcaf13d898f83ef.tar.gz
CMake-177edc5ed1bed7306a122129dfcaf13d898f83ef.tar.bz2
Fixed ctest -N segfault issue. Further refactored ctest. Enabled failover for ctest
Diffstat (limited to 'Source/CTest/cmCTestRunTest.cxx')
-rw-r--r--Source/CTest/cmCTestRunTest.cxx210
1 files changed, 98 insertions, 112 deletions
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index d444249..7b42a3d 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -67,120 +67,118 @@ bool cmCTestRunTest::EndTest()
bool passed = true;
int res = this->TestProcess->GetProcessStatus();
int retVal = this->TestProcess->GetExitValue();
- if ( !this->CTest->GetShowOnly() )
+
+ std::vector<std::pair<cmsys::RegularExpression,
+ std::string> >::iterator passIt;
+ bool forceFail = false;
+ if ( this->TestProperties->RequiredRegularExpressions.size() > 0 )
{
- std::vector<std::pair<cmsys::RegularExpression,
- std::string> >::iterator passIt;
- bool forceFail = false;
- if ( this->TestProperties->RequiredRegularExpressions.size() > 0 )
+ bool found = false;
+ for ( passIt = this->TestProperties->RequiredRegularExpressions.begin();
+ passIt != this->TestProperties->RequiredRegularExpressions.end();
+ ++ passIt )
{
- bool found = false;
- for ( passIt = this->TestProperties->RequiredRegularExpressions.begin();
- passIt != this->TestProperties->RequiredRegularExpressions.end();
- ++ passIt )
- {
- if ( passIt->first.find(this->ProcessOutput.c_str()) )
- {
- found = true;
- reason = "Required regular expression found.";
- }
- }
- if ( !found )
- {
- reason = "Required regular expression not found.";
- forceFail = true;
- }
- reason += "Regex=[";
- for ( passIt = this->TestProperties->RequiredRegularExpressions.begin();
- passIt != this->TestProperties->RequiredRegularExpressions.end();
- ++ passIt )
+ if ( passIt->first.find(this->ProcessOutput.c_str()) )
{
- reason += passIt->second;
- reason += "\n";
+ found = true;
+ reason = "Required regular expression found.";
}
- reason += "]";
}
- if ( this->TestProperties->ErrorRegularExpressions.size() > 0 )
+ if ( !found )
+ {
+ reason = "Required regular expression not found.";
+ forceFail = true;
+ }
+ reason += "Regex=[";
+ for ( passIt = this->TestProperties->RequiredRegularExpressions.begin();
+ passIt != this->TestProperties->RequiredRegularExpressions.end();
+ ++ passIt )
{
- for ( passIt = this->TestProperties->ErrorRegularExpressions.begin();
- passIt != this->TestProperties->ErrorRegularExpressions.end();
- ++ passIt )
- {
- if ( passIt->first.find(this->ProcessOutput.c_str()) )
- {
- reason = "Error regular expression found in output.";
- reason += " Regex=[";
- reason += passIt->second;
- reason += "]";
- forceFail = true;
- }
- }
+ reason += passIt->second;
+ reason += "\n";
}
- if (res == cmsysProcess_State_Exited)
+ reason += "]";
+ }
+ if ( this->TestProperties->ErrorRegularExpressions.size() > 0 )
+ {
+ for ( passIt = this->TestProperties->ErrorRegularExpressions.begin();
+ passIt != this->TestProperties->ErrorRegularExpressions.end();
+ ++ passIt )
{
- bool success =
- !forceFail && (retVal == 0 ||
- this->TestProperties->RequiredRegularExpressions.size());
- if((success && !this->TestProperties->WillFail)
- || (!success && this->TestProperties->WillFail))
+ if ( passIt->first.find(this->ProcessOutput.c_str()) )
{
- this->TestResult.Status = cmCTestTestHandler::COMPLETED;
- cmCTestLog(this->CTest, HANDLER_OUTPUT, " Passed " );
- }
- else
- {
- this->TestResult.Status = cmCTestTestHandler::FAILED;
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Failed " << reason );
+ reason = "Error regular expression found in output.";
+ reason += " Regex=[";
+ reason += passIt->second;
+ reason += "]";
+ forceFail = true;
}
}
- else if ( res == cmsysProcess_State_Expired )
+ }
+ if (res == cmsysProcess_State_Exited)
+ {
+ bool success =
+ !forceFail && (retVal == 0 ||
+ this->TestProperties->RequiredRegularExpressions.size());
+ if((success && !this->TestProperties->WillFail)
+ || (!success && this->TestProperties->WillFail))
{
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Timeout");
- this->TestResult.Status = cmCTestTestHandler::TIMEOUT;
+ this->TestResult.Status = cmCTestTestHandler::COMPLETED;
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, " Passed " );
}
- else if ( res == cmsysProcess_State_Exception )
+ else
{
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Exception: ");
- switch ( retVal )
- {
- case cmsysProcess_Exception_Fault:
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "SegFault");
- this->TestResult.Status = cmCTestTestHandler::SEGFAULT;
- break;
- case cmsysProcess_Exception_Illegal:
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "Illegal");
- this->TestResult.Status = cmCTestTestHandler::ILLEGAL;
- break;
- case cmsysProcess_Exception_Interrupt:
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "Interrupt");
- this->TestResult.Status = cmCTestTestHandler::INTERRUPT;
- break;
- case cmsysProcess_Exception_Numerical:
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "Numerical");
- this->TestResult.Status = cmCTestTestHandler::NUMERICAL;
- break;
- default:
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "Other");
- this->TestResult.Status = cmCTestTestHandler::OTHER_FAULT;
- }
+ this->TestResult.Status = cmCTestTestHandler::FAILED;
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Failed " << reason );
}
- else // if ( res == cmsysProcess_State_Error )
+ }
+ else if ( res == cmsysProcess_State_Expired )
+ {
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Timeout");
+ this->TestResult.Status = cmCTestTestHandler::TIMEOUT;
+ }
+ else if ( res == cmsysProcess_State_Exception )
+ {
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Exception: ");
+ switch ( retVal )
{
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Bad command " << res );
- this->TestResult.Status = cmCTestTestHandler::BAD_COMMAND;
+ case cmsysProcess_Exception_Fault:
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "SegFault");
+ this->TestResult.Status = cmCTestTestHandler::SEGFAULT;
+ break;
+ case cmsysProcess_Exception_Illegal:
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "Illegal");
+ this->TestResult.Status = cmCTestTestHandler::ILLEGAL;
+ break;
+ case cmsysProcess_Exception_Interrupt:
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "Interrupt");
+ this->TestResult.Status = cmCTestTestHandler::INTERRUPT;
+ break;
+ case cmsysProcess_Exception_Numerical:
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "Numerical");
+ this->TestResult.Status = cmCTestTestHandler::NUMERICAL;
+ break;
+ default:
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "Other");
+ this->TestResult.Status = cmCTestTestHandler::OTHER_FAULT;
}
+ }
+ else // if ( res == cmsysProcess_State_Error )
+ {
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Bad command " << res );
+ this->TestResult.Status = cmCTestTestHandler::BAD_COMMAND;
+ }
- passed = this->TestResult.Status == cmCTestTestHandler::COMPLETED;
+ passed = this->TestResult.Status == cmCTestTestHandler::COMPLETED;
- char buf[1024];
- sprintf(buf, "%6.2f sec", this->TestProcess->GetTotalTime());
- cmCTestLog(this->CTest, HANDLER_OUTPUT, buf << "\n" );
- if ( this->TestHandler->LogFile )
- {
- *this->TestHandler->LogFile << "Test time = " << buf << std::endl;
- }
- this->DartProcessing();
- }
+ char buf[1024];
+ sprintf(buf, "%6.2f sec", this->TestProcess->GetTotalTime());
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, buf << "\n" );
+ if ( this->TestHandler->LogFile )
+ {
+ *this->TestHandler->LogFile << "Test time = " << buf << std::endl;
+ }
+ this->DartProcessing();
// if this is doing MemCheck then all the output needs to be put into
// Output since that is what is parsed by cmCTestMemCheckHandler
if(!this->TestHandler->MemCheck)
@@ -303,14 +301,10 @@ bool cmCTestRunTest::StartTest()
this->StartTime = this->CTest->CurrentTime();
- if ( !this->CTest->GetShowOnly() )
- {
- return this->CreateProcess(this->ActualCommand,
- this->TestProperties->Args,
- this->TestProperties->Timeout,
- &this->TestProperties->Environment);
- }
- return true;
+ return this->CreateProcess(this->ActualCommand,
+ this->TestProperties->Args,
+ this->TestProperties->Timeout,
+ &this->TestProperties->Environment);
}
//----------------------------------------------------------------------
@@ -449,15 +443,7 @@ void cmCTestRunTest::WriteLogOutputTop()
*this->TestHandler->LogFile
<< this->ProcessOutput.c_str() << "<end of output>" << std::endl;
- if ( this->CTest->GetShowOnly() )
- {
- cmCTestLog(this->CTest, HANDLER_OUTPUT, outname.c_str() << std::endl);
- }
- else
- {
- cmCTestLog(this->CTest, HANDLER_OUTPUT, outname.c_str());
- }
-
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, outname.c_str());
cmCTestLog(this->CTest, DEBUG, "Testing "
<< this->TestProperties->Name.c_str() << " ... ");
}