BUG: #8611 add pass fail reasons into log file

This commit is contained in:
Bill Hoffman 2009-02-27 16:28:07 -05:00
parent 19d9c824a8
commit 3043ddf144
1 changed files with 42 additions and 18 deletions

View File

@ -761,24 +761,7 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it,
clock_finish = cmSystemTools::GetTime();
if ( this->LogFile )
{
double ttime = clock_finish - clock_start;
int hours = static_cast<int>(ttime / (60 * 60));
int minutes = static_cast<int>(ttime / 60) % 60;
int seconds = static_cast<int>(ttime) % 60;
char buffer[100];
sprintf(buffer, "%02d:%02d:%02d", hours, minutes, seconds);
*this->LogFile
<< "----------------------------------------------------------"
<< std::endl
<< "\"" << testname.c_str() << "\" end time: "
<< this->CTest->CurrentTime() << std::endl
<< "\"" << testname.c_str() << "\" time elapsed: "
<< buffer << std::endl
<< "----------------------------------------------------------"
<< std::endl << std::endl;
}
cres.ExecutionTime = (double)(clock_finish - clock_start);
cres.FullCommandLine = testCommand;
@ -949,6 +932,47 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it,
}
}
cres.Reason = reason;
if ( this->LogFile )
{
bool pass = true;
const char* reasonType = "Test Pass Reason";
if(cres.Status != cmCTestTestHandler::COMPLETED &&
cres.Status != cmCTestTestHandler::NOT_RUN)
{
reasonType = "Test Fail Reason";
pass = false;
}
double ttime = clock_finish - clock_start;
int hours = static_cast<int>(ttime / (60 * 60));
int minutes = static_cast<int>(ttime / 60) % 60;
int seconds = static_cast<int>(ttime) % 60;
char buffer[100];
sprintf(buffer, "%02d:%02d:%02d", hours, minutes, seconds);
*this->LogFile
<< "----------------------------------------------------------"
<< std::endl;
if(cres.Reason.size())
{
*this->LogFile << reasonType << ":\n" << cres.Reason << "\n";
}
else
{
if(pass)
{
*this->LogFile << "Test Passed.\n";
}
else
{
*this->LogFile << "Test Failed.\n";
}
}
*this->LogFile << "\"" << testname.c_str() << "\" end time: "
<< this->CTest->CurrentTime() << std::endl
<< "\"" << testname.c_str() << "\" time elapsed: "
<< buffer << std::endl
<< "----------------------------------------------------------"
<< std::endl << std::endl;
}
cres.Output = output;
cres.ReturnValue = retVal;
cres.CompletionStatus = "Completed";