[Cmake-commits] [cmake-commits] hoffman committed cmCTestBatchTestHandler.cxx 1.5.2.1 1.5.2.2 cmCTestBuildAndTestHandler.cxx 1.26.2.1 1.26.2.2 cmCTestCoverageHandler.cxx 1.72.2.2 1.72.2.3 cmCTestMultiProcessHandler.cxx 1.25.2.3 1.25.2.4 cmCTestRunTest.cxx 1.22.2.2 1.22.2.3
cmake-commits at cmake.org
cmake-commits at cmake.org
Wed Oct 28 12:15:43 EDT 2009
Update of /cvsroot/CMake/CMake/Source/CTest
In directory public:/mounts/ram/cvs-serv18987/Source/CTest
Modified Files:
Tag: CMake-2-8
cmCTestBatchTestHandler.cxx cmCTestBuildAndTestHandler.cxx
cmCTestCoverageHandler.cxx cmCTestMultiProcessHandler.cxx
cmCTestRunTest.cxx
Log Message:
RC 4 merge
Index: cmCTestMultiProcessHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestMultiProcessHandler.cxx,v
retrieving revision 1.25.2.3
retrieving revision 1.25.2.4
diff -C 2 -d -r1.25.2.3 -r1.25.2.4
*** cmCTestMultiProcessHandler.cxx 9 Oct 2009 20:11:27 -0000 1.25.2.3
--- cmCTestMultiProcessHandler.cxx 28 Oct 2009 16:15:41 -0000 1.25.2.4
***************
*** 82,85 ****
--- 82,89 ----
testRun->SetIndex(test);
testRun->SetTestProperties(this->Properties[test]);
+
+ std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
+ cmSystemTools::ChangeDirectory(this->Properties[test]->Directory.c_str());
+
if(testRun->StartTest(this->Total))
{
***************
*** 93,96 ****
--- 97,101 ----
this->Failed->push_back(this->Properties[test]->Name);
}
+ cmSystemTools::ChangeDirectory(current_dir.c_str());
}
***************
*** 340,343 ****
--- 345,351 ----
count++;
cmCTestTestHandler::cmCTestTestProperties& p = *it->second;
+ //push working dir
+ std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
+ cmSystemTools::ChangeDirectory(p.Directory.c_str());
cmCTestRunTest testRun(this->TestHandler);
***************
*** 361,364 ****
--- 369,374 ----
cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
cmCTestLog(this->CTest, HANDLER_OUTPUT, p.Name.c_str() << std::endl);
+ //pop working dir
+ cmSystemTools::ChangeDirectory(current_dir.c_str());
}
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl << "Total Tests: "
Index: cmCTestCoverageHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestCoverageHandler.cxx,v
retrieving revision 1.72.2.2
retrieving revision 1.72.2.3
diff -C 2 -d -r1.72.2.2 -r1.72.2.3
*** cmCTestCoverageHandler.cxx 9 Oct 2009 20:11:26 -0000 1.72.2.2
--- cmCTestCoverageHandler.cxx 28 Oct 2009 16:15:41 -0000 1.72.2.3
***************
*** 678,681 ****
--- 678,699 ----
//----------------------------------------------------------------------
+ bool IsFileInDir(const std::string &infile, const std::string &indir)
+ {
+ std::string file = cmSystemTools::CollapseFullPath(infile.c_str());
+ std::string dir = cmSystemTools::CollapseFullPath(indir.c_str());
+
+ if (
+ file.size() > dir.size() &&
+ (fnc(file.substr(0, dir.size())) == fnc(dir)) &&
+ file[dir.size()] == '/'
+ )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ //----------------------------------------------------------------------
int cmCTestCoverageHandler::HandleGCovCoverage(
cmCTestCoverageHandlerContainer* cont)
***************
*** 736,749 ****
--- 754,778 ----
cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
int file_count = 0;
+
// make sure output from gcov is in English!
cmSystemTools::PutEnv("LC_ALL=POSIX");
+
+ // files is a list of *.da and *.gcda files with coverage data in them.
+ // These are binary files that you give as input to gcov so that it will
+ // give us text output we can analyze to summarize coverage.
+ //
for ( it = files.begin(); it != files.end(); ++ it )
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush);
+
+ // Call gcov to get coverage data for this *.gcda file:
+ //
std::string fileDir = cmSystemTools::GetFilenamePath(it->c_str());
std::string command = "\"" + gcovCommand + "\" -l -o \"" + fileDir
+ "\" \"" + *it + "\"";
+
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str()
<< std::endl);
+
std::string output = "";
std::string errors = "";
***************
*** 778,793 ****
<< "--------------------------------------------------------------"
<< std::endl);
std::vector<cmStdString> lines;
std::vector<cmStdString>::iterator line;
-
- // Globals for storing current source file and current gcov file;
cmSystemTools::Split(output.c_str(), lines);
for ( line = lines.begin(); line != lines.end(); ++line)
{
std::string sourceFile;
std::string gcovFile;
cmCTestLog(this->CTest, DEBUG, "Line: [" << line->c_str() << "]"
<< std::endl);
if ( line->size() == 0 )
{
--- 807,824 ----
<< "--------------------------------------------------------------"
<< std::endl);
+
std::vector<cmStdString> lines;
std::vector<cmStdString>::iterator line;
cmSystemTools::Split(output.c_str(), lines);
+
for ( line = lines.begin(); line != lines.end(); ++line)
{
std::string sourceFile;
std::string gcovFile;
+
cmCTestLog(this->CTest, DEBUG, "Line: [" << line->c_str() << "]"
<< std::endl);
+
if ( line->size() == 0 )
{
***************
*** 796,810 ****
else if ( st1re1.find(line->c_str()) )
{
! if ( gcovStyle != 0 )
{
- if ( gcovStyle != 1 )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
- << std::endl);
- cont->Error ++;
- break;
- }
gcovStyle = 1;
}
actualSourceFile = "";
--- 827,841 ----
else if ( st1re1.find(line->c_str()) )
{
! if ( gcovStyle == 0 )
{
gcovStyle = 1;
}
+ if ( gcovStyle != 1 )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e1"
+ << std::endl);
+ cont->Error ++;
+ break;
+ }
actualSourceFile = "";
***************
*** 813,827 ****
else if ( st1re2.find(line->c_str() ) )
{
! if ( gcovStyle != 0 )
{
- if ( gcovStyle != 1 )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
- << std::endl);
- cont->Error ++;
- break;
- }
gcovStyle = 1;
}
gcovFile = st1re2.match(1);
--- 844,858 ----
else if ( st1re2.find(line->c_str() ) )
{
! if ( gcovStyle == 0 )
{
gcovStyle = 1;
}
+ if ( gcovStyle != 1 )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e2"
+ << std::endl);
+ cont->Error ++;
+ break;
+ }
gcovFile = st1re2.match(1);
***************
*** 829,843 ****
else if ( st2re1.find(line->c_str() ) )
{
! if ( gcovStyle != 0 )
{
- if ( gcovStyle != 2 )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
- << std::endl);
- cont->Error ++;
- break;
- }
gcovStyle = 2;
}
actualSourceFile = "";
--- 860,874 ----
else if ( st2re1.find(line->c_str() ) )
{
! if ( gcovStyle == 0 )
{
gcovStyle = 2;
}
+ if ( gcovStyle != 2 )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e3"
+ << std::endl);
+ cont->Error ++;
+ break;
+ }
actualSourceFile = "";
***************
*** 846,874 ****
else if ( st2re2.find(line->c_str() ) )
{
! if ( gcovStyle != 0 )
{
- if ( gcovStyle != 2 )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
- << std::endl);
- cont->Error ++;
- break;
- }
gcovStyle = 2;
}
}
else if ( st2re3.find(line->c_str() ) )
{
! if ( gcovStyle != 0 )
{
- if ( gcovStyle != 2 )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
- << std::endl);
- cont->Error ++;
- break;
- }
gcovStyle = 2;
}
gcovFile = st2re3.match(2);
--- 877,905 ----
else if ( st2re2.find(line->c_str() ) )
{
! if ( gcovStyle == 0 )
{
gcovStyle = 2;
}
+ if ( gcovStyle != 2 )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e4"
+ << std::endl);
+ cont->Error ++;
+ break;
+ }
}
else if ( st2re3.find(line->c_str() ) )
{
! if ( gcovStyle == 0 )
{
gcovStyle = 2;
}
+ if ( gcovStyle != 2 )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e5"
+ << std::endl);
+ cont->Error ++;
+ break;
+ }
gcovFile = st2re3.match(2);
***************
*** 876,890 ****
else if ( st2re4.find(line->c_str() ) )
{
! if ( gcovStyle != 0 )
{
- if ( gcovStyle != 2 )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
- << std::endl);
- cont->Error ++;
- break;
- }
gcovStyle = 2;
}
cmCTestLog(this->CTest, WARNING, "Warning: " << st2re4.match(1)
--- 907,921 ----
else if ( st2re4.find(line->c_str() ) )
{
! if ( gcovStyle == 0 )
{
gcovStyle = 2;
}
+ if ( gcovStyle != 2 )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e6"
+ << std::endl);
+ cont->Error ++;
+ break;
+ }
cmCTestLog(this->CTest, WARNING, "Warning: " << st2re4.match(1)
***************
*** 893,907 ****
else if ( st2re5.find(line->c_str() ) )
{
! if ( gcovStyle != 0 )
{
- if ( gcovStyle != 2 )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
- << std::endl);
- cont->Error ++;
- break;
- }
gcovStyle = 2;
}
cmCTestLog(this->CTest, WARNING, "Warning: Cannot open file: "
--- 924,938 ----
else if ( st2re5.find(line->c_str() ) )
{
! if ( gcovStyle == 0 )
{
gcovStyle = 2;
}
+ if ( gcovStyle != 2 )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e7"
+ << std::endl);
+ cont->Error ++;
+ break;
+ }
cmCTestLog(this->CTest, WARNING, "Warning: Cannot open file: "
***************
*** 910,924 ****
else if ( st2re6.find(line->c_str() ) )
{
! if ( gcovStyle != 0 )
{
- if ( gcovStyle != 2 )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
- << std::endl);
- cont->Error ++;
- break;
- }
gcovStyle = 2;
}
cmCTestLog(this->CTest, WARNING, "Warning: File: " << st2re6.match(1)
--- 941,955 ----
else if ( st2re6.find(line->c_str() ) )
{
! if ( gcovStyle == 0 )
{
gcovStyle = 2;
}
+ if ( gcovStyle != 2 )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e8"
+ << std::endl);
+ cont->Error ++;
+ break;
+ }
cmCTestLog(this->CTest, WARNING, "Warning: File: " << st2re6.match(1)
***************
*** 928,941 ****
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
! "Unknown line: [" << line->c_str() << "]" << std::endl);
cont->Error ++;
//abort();
}
! if ( !gcovFile.empty() && actualSourceFile.size() )
{
! cmCTestCoverageHandlerContainer::SingleFileCoverageVector* vec
! = &cont->TotalCoverage[actualSourceFile];
! cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in file: "
<< gcovFile << std::endl);
std::ifstream ifile(gcovFile.c_str());
if ( ! ifile )
--- 959,980 ----
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
! "Unknown gcov output line: [" << line->c_str() << "]" << std::endl);
cont->Error ++;
//abort();
}
!
!
! // If the last line of gcov output gave us a valid value for gcovFile,
! // and we have an actualSourceFile, then insert a (or add to existing)
! // SingleFileCoverageVector for actualSourceFile:
! //
! if ( !gcovFile.empty() && !actualSourceFile.empty() )
{
! cmCTestCoverageHandlerContainer::SingleFileCoverageVector& vec
! = cont->TotalCoverage[actualSourceFile];
!
! cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in gcovFile: "
<< gcovFile << std::endl);
+
std::ifstream ifile(gcovFile.c_str());
if ( ! ifile )
***************
*** 970,1008 ****
std::string prefix = nl.substr(0, 12);
int cov = atoi(prefix.c_str());
// Read the line number starting at the 10th character of the gcov
// output line
std::string lineNumber = nl.substr(10, 5);
int lineIdx = atoi(lineNumber.c_str())-1;
if ( lineIdx >= 0 )
{
! while ( vec->size() <=
! static_cast<size_t>(lineIdx) )
{
! vec->push_back(-1);
}
// Initially all entries are -1 (not used). If we get coverage
// information, increment it to 0 first.
! if ( (*vec)[lineIdx] < 0 )
{
if ( cov > 0 || prefix.find("#") != prefix.npos )
{
! (*vec)[lineIdx] = 0;
}
}
! (*vec)[lineIdx] += cov;
}
}
}
actualSourceFile = "";
}
if ( !sourceFile.empty() && actualSourceFile.empty() )
{
gcovFile = "";
! // Is it in the source dir?
! if ( sourceFile.size() > cont->SourceDir.size() &&
! (fnc(sourceFile.substr(0, cont->SourceDir.size())) ==
! fnc(cont->SourceDir)) &&
! sourceFile[cont->SourceDir.size()] == '/' )
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced s: "
--- 1009,1051 ----
std::string prefix = nl.substr(0, 12);
int cov = atoi(prefix.c_str());
+
// Read the line number starting at the 10th character of the gcov
// output line
std::string lineNumber = nl.substr(10, 5);
+
int lineIdx = atoi(lineNumber.c_str())-1;
if ( lineIdx >= 0 )
{
! while ( vec.size() <= static_cast<size_t>(lineIdx) )
{
! vec.push_back(-1);
}
+
// Initially all entries are -1 (not used). If we get coverage
// information, increment it to 0 first.
! if ( vec[lineIdx] < 0 )
{
if ( cov > 0 || prefix.find("#") != prefix.npos )
{
! vec[lineIdx] = 0;
}
}
!
! vec[lineIdx] += cov;
}
}
}
+
actualSourceFile = "";
}
+
+
if ( !sourceFile.empty() && actualSourceFile.empty() )
{
gcovFile = "";
! // Is it in the source dir or the binary dir?
! //
! if ( IsFileInDir(sourceFile, cont->SourceDir) )
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced s: "
***************
*** 1013,1022 ****
= cmSystemTools::CollapseFullPath(sourceFile.c_str());
}
!
! // Binary dir?
! if ( sourceFile.size() > cont->BinaryDir.size() &&
! (fnc(sourceFile.substr(0, cont->BinaryDir.size())) ==
! fnc(cont->BinaryDir)) &&
! sourceFile[cont->BinaryDir.size()] == '/' )
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced b: "
--- 1056,1060 ----
= cmSystemTools::CollapseFullPath(sourceFile.c_str());
}
! else if ( IsFileInDir(sourceFile, cont->BinaryDir) )
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced b: "
***************
*** 1030,1034 ****
if ( actualSourceFile.empty() )
{
! if ( missingFiles.find(actualSourceFile) == missingFiles.end() )
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
--- 1068,1072 ----
if ( actualSourceFile.empty() )
{
! if ( missingFiles.find(sourceFile) == missingFiles.end() )
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
***************
*** 1049,1058 ****
<< " in source dir: " << cont->SourceDir.c_str()
<< " or binary dir: " << cont->BinaryDir.c_str() << std::endl;
! missingFiles.insert(actualSourceFile);
}
}
}
}
! file_count ++;
if ( file_count % 50 == 0 )
{
--- 1087,1099 ----
<< " in source dir: " << cont->SourceDir.c_str()
<< " or binary dir: " << cont->BinaryDir.c_str() << std::endl;
!
! missingFiles.insert(sourceFile);
}
}
}
}
!
! file_count++;
!
if ( file_count % 50 == 0 )
{
***************
*** 1062,1065 ****
--- 1103,1107 ----
}
}
+
cmSystemTools::ChangeDirectory(currentDirectory.c_str());
return file_count;
Index: cmCTestBuildAndTestHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestBuildAndTestHandler.cxx,v
retrieving revision 1.26.2.1
retrieving revision 1.26.2.2
diff -C 2 -d -r1.26.2.1 -r1.26.2.2
*** cmCTestBuildAndTestHandler.cxx 1 Oct 2009 21:21:12 -0000 1.26.2.1
--- cmCTestBuildAndTestHandler.cxx 28 Oct 2009 16:15:40 -0000 1.26.2.2
***************
*** 252,256 ****
{
double remainingTime = 0;
! if (this->Timeout)
{
remainingTime = this->Timeout - cmSystemTools::GetTime() + clock_start;
--- 252,256 ----
{
double remainingTime = 0;
! if (this->Timeout > 0)
{
remainingTime = this->Timeout - cmSystemTools::GetTime() + clock_start;
***************
*** 377,381 ****
// how much time is remaining
double remainingTime = 0;
! if (this->Timeout)
{
remainingTime = this->Timeout - cmSystemTools::GetTime() + clock_start;
--- 377,381 ----
// how much time is remaining
double remainingTime = 0;
! if (this->Timeout > 0)
{
remainingTime = this->Timeout - cmSystemTools::GetTime() + clock_start;
Index: cmCTestRunTest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestRunTest.cxx,v
retrieving revision 1.22.2.2
retrieving revision 1.22.2.3
diff -C 2 -d -r1.22.2.2 -r1.22.2.3
*** cmCTestRunTest.cxx 9 Oct 2009 20:11:27 -0000 1.22.2.2
--- cmCTestRunTest.cxx 28 Oct 2009 16:15:41 -0000 1.22.2.3
***************
*** 302,306 ****
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(2*getNumWidth(total) + 8)
<< "Start "
! << std::setw(getNumWidth(total))
<< this->TestProperties->Index << ": "
<< this->TestProperties->Name << std::endl);
--- 302,306 ----
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(2*getNumWidth(total) + 8)
<< "Start "
! << std::setw(getNumWidth(this->TestHandler->GetMaxIndex()))
<< this->TestProperties->Index << ": "
<< this->TestProperties->Name << std::endl);
***************
*** 420,428 ****
// determine how much time we have
double timeout = this->CTest->GetRemainingTimeAllowed() - 120;
! if (this->CTest->GetTimeOut() && this->CTest->GetTimeOut() < timeout)
{
timeout = this->CTest->GetTimeOut();
}
! if (testTimeOut
&& testTimeOut < this->CTest->GetRemainingTimeAllowed())
{
--- 420,428 ----
// determine how much time we have
double timeout = this->CTest->GetRemainingTimeAllowed() - 120;
! if (this->CTest->GetTimeOut() > 0 && this->CTest->GetTimeOut() < timeout)
{
timeout = this->CTest->GetTimeOut();
}
! if (testTimeOut > 0
&& testTimeOut < this->CTest->GetRemainingTimeAllowed())
{
Index: cmCTestBatchTestHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestBatchTestHandler.cxx,v
retrieving revision 1.5.2.1
retrieving revision 1.5.2.2
diff -C 2 -d -r1.5.2.1 -r1.5.2.2
*** cmCTestBatchTestHandler.cxx 1 Oct 2009 21:21:12 -0000 1.5.2.1
--- cmCTestBatchTestHandler.cxx 28 Oct 2009 16:15:39 -0000 1.5.2.2
***************
*** 26,30 ****
{
this->WriteBatchScript();
! //this->SubmitBatchScript();
}
--- 26,30 ----
{
this->WriteBatchScript();
! this->SubmitBatchScript();
}
***************
*** 129,137 ****
args.push_back("-o");
args.push_back(this->CTest->GetBinaryDir()
! + "/Testing/CTestBatchOutput.txt");
sbatch.SetCommand("sbatch");
sbatch.SetCommandArguments(args);
! if(sbatch.StartProcess())
{
//success condition
--- 129,137 ----
args.push_back("-o");
args.push_back(this->CTest->GetBinaryDir()
! + "/Testing/CTestBatch.txt");
sbatch.SetCommand("sbatch");
sbatch.SetCommandArguments(args);
! /*if(sbatch.StartProcess())
{
//success condition
***************
*** 140,143 ****
{
//fail condition
! }
}
--- 140,143 ----
{
//fail condition
! }*/
}
More information about the Cmake-commits
mailing list