summaryrefslogtreecommitdiffstats
path: root/Source/CTest
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2009-07-27 18:17:38 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2009-07-27 18:17:38 (GMT)
commit40850e7f1fea49e863d321291585d9a1ee8e8037 (patch)
tree7657d617a9df3702225ef95504e480d4b3e09173 /Source/CTest
parent2b849a77a6e108100cae8d1ae59be2a7727a66ec (diff)
downloadCMake-40850e7f1fea49e863d321291585d9a1ee8e8037.zip
CMake-40850e7f1fea49e863d321291585d9a1ee8e8037.tar.gz
CMake-40850e7f1fea49e863d321291585d9a1ee8e8037.tar.bz2
ENH: add test times and a total time to the output of command line ctest
Diffstat (limited to 'Source/CTest')
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx31
1 files changed, 23 insertions, 8 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 9566de9..da3fd5e 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -574,12 +574,27 @@ int cmCTestTestHandler::ProcessHandler()
{
percent = 99;
}
+
if(!this->CTest->GetParallelSubprocess())
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl
<< static_cast<int>(percent + .5) << "% tests passed, "
<< failed.size() << " tests failed out of "
- << total << std::endl);
+ << total << std::endl);
+ double totalTestTime = 0;
+
+ for(cmCTestTestHandler::TestResultsVector::size_type cc = 0;
+ cc < this->TestResults.size(); cc ++ )
+ {
+ cmCTestTestResult *result = &this->TestResults[cc];
+ totalTestTime += result->ExecutionTime;
+ }
+
+ char buf[1024];
+ sprintf(buf, "%6.2f sec", totalTestTime);
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTotal CPU time = "
+ << buf << "\n" );
+
}
if (failed.size())
@@ -823,18 +838,18 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it,
if((success && !it->WillFail) || (!success && it->WillFail))
{
cres.Status = cmCTestTestHandler::COMPLETED;
- cmCTestLog(this->CTest, HANDLER_OUTPUT, " Passed" << std::endl);
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, " Passed " );
}
else
{
cres.Status = cmCTestTestHandler::FAILED;
cmCTestLog(this->CTest, HANDLER_OUTPUT,
- "***Failed " << reason << std::endl);
+ "***Failed " << reason );
}
}
else if ( res == cmsysProcess_State_Expired )
{
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Timeout" << std::endl);
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Timeout");
cres.Status = cmCTestTestHandler::TIMEOUT;
}
else if ( res == cmsysProcess_State_Exception )
@@ -862,12 +877,10 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it,
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Other");
cres.Status = cmCTestTestHandler::OTHER_FAULT;
}
- cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl);
}
else // if ( res == cmsysProcess_State_Error )
{
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Bad command " << res
- << std::endl);
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Bad command " << res );
cres.Status = cmCTestTestHandler::BAD_COMMAND;
}
@@ -879,6 +892,9 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it,
{
failed.push_back(testname);
}
+ char buf[1024];
+ sprintf(buf, "%6.2f sec", cres.ExecutionTime);
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, buf << "\n" );
if (!output.empty() && output.find("<DartMeasurement") != output.npos)
{
if (this->DartStuff.find(output.c_str()))
@@ -1541,7 +1557,6 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
this->ProcessOneTest(&(*it), passed, failed, it->Index,
static_cast<int>(this->TotalNumberOfTests));
}
-
this->EndTest = this->CTest->CurrentTime();
this->EndTestTime = static_cast<unsigned int>(cmSystemTools::GetTime());
this->ElapsedTestingTime = cmSystemTools::GetTime() - elapsed_time_start;