diff options
author | Brad King <brad.king@kitware.com> | 2009-03-11 16:03:47 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-03-11 16:03:47 (GMT) |
commit | f3e713ba653c1b435c6308474d07eeaffcc9620f (patch) | |
tree | d295d9fbc7d6c24b3df3d83dffe4739877cc4745 /Source/CTest | |
parent | b4997c3020164d47ff805a9931f8eb497d205183 (diff) | |
download | CMake-f3e713ba653c1b435c6308474d07eeaffcc9620f.zip CMake-f3e713ba653c1b435c6308474d07eeaffcc9620f.tar.gz CMake-f3e713ba653c1b435c6308474d07eeaffcc9620f.tar.bz2 |
BUG: Avoid duplicate CTest coverage submission
This teaches ctest_coverage() to remove any existing CoverageLog-*.xml
when it creates new coverage results. Otherwise the next ctest_submit()
may submit old coverage log files which unnecessarily.
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 19 | ||||
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.h | 1 |
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); |