diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2009-02-27 21:28:07 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2009-02-27 21:28:07 (GMT) |
commit | 3043ddf1445de03556564917e01a4f9748b04d89 (patch) | |
tree | b5ac994fd29ec7311a91fe50e3d4d02ba7fd2bba /Source/CTest | |
parent | 19d9c824a83b27cd3f875ef8370e8438cc88515c (diff) | |
download | CMake-3043ddf1445de03556564917e01a4f9748b04d89.zip CMake-3043ddf1445de03556564917e01a4f9748b04d89.tar.gz CMake-3043ddf1445de03556564917e01a4f9748b04d89.tar.bz2 |
BUG: #8611 add pass fail reasons into log file
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 60 |
1 files changed, 42 insertions, 18 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 7cd2839..a7a4c6f 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -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"; |