فهرست منبع

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.
Bill Hoffman 13 سال پیش
والد
کامیت
0a169e628b
2فایلهای تغییر یافته به همراه38 افزوده شده و 0 حذف شده
  1. 36 0
      Source/CTest/cmParseCacheCoverage.cxx
  2. 2 0
      Source/CTest/cmParseCacheCoverage.h

+ 36 - 0
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)
 {

+ 2 - 0
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 ,