diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2012-05-02 21:23:01 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2012-05-02 21:23:01 (GMT) |
commit | 0a169e628bb222fec7deead87f6ebe8fa77c7805 (patch) | |
tree | 67d154f43523d51abb56480f5e6ff76de305bbae /Source/CTest | |
parent | a7abf5e090379a77f50ce2285ac4c1c99159d9d2 (diff) | |
download | CMake-0a169e628bb222fec7deead87f6ebe8fa77c7805.zip CMake-0a169e628bb222fec7deead87f6ebe8fa77c7805.tar.gz CMake-0a169e628bb222fec7deead87f6ebe8fa77c7805.tar.bz2 |
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')
-rw-r--r-- | Source/CTest/cmParseCacheCoverage.cxx | 36 | ||||
-rw-r--r-- | Source/CTest/cmParseCacheCoverage.h | 2 |
2 files changed, 38 insertions, 0 deletions
diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx index fb85810..e4b0a88 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) { diff --git a/Source/CTest/cmParseCacheCoverage.h b/Source/CTest/cmParseCacheCoverage.h index f377567..114eb92 100644 --- a/Source/CTest/cmParseCacheCoverage.h +++ b/Source/CTest/cmParseCacheCoverage.h @@ -29,6 +29,8 @@ public: protected: // implement virtual from parent bool LoadCoverageData(const char* dir); + // remove files with no coverage + void RemoveUnCoveredFiles(); // Read a single mcov file bool ReadCMCovFile(const char* f); // split a string based on , |