summaryrefslogtreecommitdiffstats
path: root/Source/CTest
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CTest')
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx19
-rw-r--r--Source/CTest/cmCTestCoverageHandler.h1
2 files changed, 20 insertions, 0 deletions
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index ee9a169..fe4e2bf 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -162,6 +162,24 @@ void cmCTestCoverageHandler::Initialize()
this->LabelFilter.clear();
}
+//----------------------------------------------------------------------------
+void cmCTestCoverageHandler::CleanCoverageLogFiles(std::ostream& log)
+{
+ std::string logGlob = this->CTest->GetCTestConfiguration("BuildDirectory");
+ logGlob += "/Testing/";
+ logGlob += this->CTest->GetCurrentTag();
+ logGlob += "/CoverageLog*";
+ cmsys::Glob gl;
+ gl.FindFiles(logGlob.c_str());
+ std::vector<std::string> const& files = gl.GetFiles();
+ for(std::vector<std::string>::const_iterator fi = files.begin();
+ fi != files.end(); ++fi)
+ {
+ log << "Removing old coverage log: " << *fi << "\n";
+ cmSystemTools::RemoveFile(fi->c_str());
+ }
+}
+
//----------------------------------------------------------------------
bool cmCTestCoverageHandler::StartCoverageLogFile(
cmGeneratedFileStream& covLogFile, int logFileCount)
@@ -342,6 +360,7 @@ int cmCTestCoverageHandler::ProcessHandler()
}
ofs << "Performing coverage: " << elapsed_time_start << std::endl;
+ this->CleanCoverageLogFiles(ofs);
cmSystemTools::ConvertToUnixSlashes(sourceDir);
cmSystemTools::ConvertToUnixSlashes(binaryDir);
diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h
index c58b6ab..e8b18d6 100644
--- a/Source/CTest/cmCTestCoverageHandler.h
+++ b/Source/CTest/cmCTestCoverageHandler.h
@@ -56,6 +56,7 @@ public:
private:
bool ShouldIDoCoverage(const char* file, const char* srcDir,
const char* binDir);
+ void CleanCoverageLogFiles(std::ostream& log);
bool StartCoverageLogFile(cmGeneratedFileStream& ostr, int logFileCount);
void EndCoverageLogFile(cmGeneratedFileStream& ostr, int logFileCount);