summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx60
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";