Merge topic 'fix-coverage-py'
deee7c42
CTest: Fix Python coverage.py off-by-one error in results88b3dcb1
CTest: Improve Python coverage.py source file search algorithm
This commit is contained in:
commit
574f096b9a
|
@ -33,10 +33,13 @@ 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)
|
||||
{
|
||||
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
|
||||
|
@ -44,8 +47,11 @@ protected:
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue