Merge topic 'fix-coverage-py'

deee7c42 CTest: Fix Python coverage.py off-by-one error in results
88b3dcb1 CTest: Improve Python coverage.py source file search algorithm
This commit is contained in:
Brad King 2014-05-28 12:34:38 -04:00 committed by CMake Topic Stage
commit 574f096b9a
1 changed files with 15 additions and 9 deletions

View File

@ -33,19 +33,25 @@ protected:
<< atts[tagCount+1] << std::endl);
this->CurFileName = this->Coverage.SourceDir + "/" +
atts[tagCount+1];
FileLinesType& curFileLines =
this->Coverage.TotalCoverage[this->CurFileName];
cmsys::ifstream fin(this->CurFileName.c_str());
if(!fin)
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Python Coverage: Error opening " << this->CurFileName
<< std::endl);
this->Coverage.Error++;
break;
this->CurFileName = this->Coverage.BinaryDir + "/" +
atts[tagCount+1];
fin.open(this->CurFileName.c_str());
if (!fin)
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Python Coverage: Error opening " << this->CurFileName
<< std::endl);
this->Coverage.Error++;
break;
}
}
std::string line;
FileLinesType& curFileLines =
this->Coverage.TotalCoverage[this->CurFileName];
curFileLines.push_back(-1);
while(cmSystemTools::GetLineFromStream(fin, line))
{
@ -73,11 +79,11 @@ protected:
curNumber = atoi(atts[tagCount+1]);
}
if(curHits > -1 && curNumber > -1)
if(curHits > -1 && curNumber > 0)
{
FileLinesType& curFileLines =
this->Coverage.TotalCoverage[this->CurFileName];
curFileLines[curNumber] = curHits;
curFileLines[curNumber-1] = curHits;
break;
}
++tagCount;