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