diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2012-05-02 17:23:01 -0400 |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2012-05-02 17:23:01 -0400 |
commit | 0a169e628bb222fec7deead87f6ebe8fa77c7805 (patch) | |
tree | 67d154f43523d51abb56480f5e6ff76de305bbae /Source/CTest/cmParseCacheCoverage.cxx | |
parent | a7abf5e090379a77f50ce2285ac4c1c99159d9d2 (diff) | |
download | cmake-0a169e628bb222fec7deead87f6ebe8fa77c7805.tar.gz |
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.
Diffstat (limited to 'Source/CTest/cmParseCacheCoverage.cxx')
-rw-r--r-- | Source/CTest/cmParseCacheCoverage.cxx | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx index fb85810089..e4b0a88976 100644 --- a/Source/CTest/cmParseCacheCoverage.cxx +++ b/Source/CTest/cmParseCacheCoverage.cxx @@ -44,9 +44,45 @@ bool cmParseCacheCoverage::LoadCoverageData(const char* d) } } } + // now remove files wht no actual coverage... + this->RemoveUnCoveredFiles(); 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, std::string const& line) { |