Remove uncovered files from cache coverage data.

Cache coverage data currently contains files with 0 coverage
on each line. This change will remove those files from the coverage
sent to CDash.
This commit is contained in:
Bill Hoffman 2012-05-02 17:23:01 -04:00
parent a7abf5e090
commit 0a169e628b
2 changed files with 38 additions and 0 deletions

View File

@ -44,9 +44,45 @@ bool cmParseCacheCoverage::LoadCoverageData(const char* d)
} }
} }
} }
// now remove files wht no actual coverage...
this->RemoveUnCoveredFiles();
return true; return true;
} }
void cmParseCacheCoverage::RemoveUnCoveredFiles()
{
// loop over the coverage data computed and remove all files
// that only have -1 or 0 for the lines.
cmCTestCoverageHandlerContainer::TotalCoverageMap::iterator ci =
this->Coverage.TotalCoverage.begin();
while(ci != this->Coverage.TotalCoverage.end())
{
cmCTestCoverageHandlerContainer::SingleFileCoverageVector& v =
ci->second;
bool nothing = true;
for(cmCTestCoverageHandlerContainer::SingleFileCoverageVector::iterator i=
v.begin(); i != v.end(); ++i)
{
if(*i > 0)
{
nothing = false;
break;
}
}
if(nothing)
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"No coverage found in: " << ci->first
<< std::endl);
this->Coverage.TotalCoverage.erase(ci++);
}
else
{
++ci;
}
}
}
bool cmParseCacheCoverage::SplitString(std::vector<std::string>& args, bool cmParseCacheCoverage::SplitString(std::vector<std::string>& args,
std::string const& line) std::string const& line)
{ {

View File

@ -29,6 +29,8 @@ public:
protected: protected:
// implement virtual from parent // implement virtual from parent
bool LoadCoverageData(const char* dir); bool LoadCoverageData(const char* dir);
// remove files with no coverage
void RemoveUnCoveredFiles();
// Read a single mcov file // Read a single mcov file
bool ReadCMCovFile(const char* f); bool ReadCMCovFile(const char* f);
// split a string based on , // split a string based on ,