diff options
author | Brad King <brad.king@kitware.com> | 2009-03-11 17:31:40 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-03-11 17:31:40 (GMT) |
commit | 589b4265a60f1d9778cf37e4e87a0fcb399e48d8 (patch) | |
tree | 5e526a74bb17c4ca34532648cf98f6d61fcced6d | |
parent | 5bc17136a36f837970d2d6fa83ce0bf84157b321 (diff) | |
download | CMake-589b4265a60f1d9778cf37e4e87a0fcb399e48d8.zip CMake-589b4265a60f1d9778cf37e4e87a0fcb399e48d8.tar.gz CMake-589b4265a60f1d9778cf37e4e87a0fcb399e48d8.tar.bz2 |
BUG: Do not produce empty coverage log files
This moves the filtering of source files to before the production of
coverage log files in order to avoid producing a CoverageLog-*.xml file
for 100 filtered-out files. The change greatly reduces the number of
submitted coverage files when using label filters.
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 59c91ec..cd04680 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -464,18 +464,20 @@ int cmCTestCoverageHandler::ProcessHandler() << cont.TotalCoverage.size() << std::endl); cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); } - if ( cnt % 100 == 0 ) + + const std::string fullFileName = fileIterator->first; + bool shouldIDoCoverage + = this->ShouldIDoCoverage(fullFileName.c_str(), + sourceDir.c_str(), binaryDir.c_str()); + if ( !shouldIDoCoverage ) { - this->EndCoverageLogFile(covLogFile, logFileCount); - logFileCount ++; - if ( !this->StartCoverageLogFile(covLogFile, logFileCount) ) - { - return -1; - } + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + ".NoDartCoverage found, so skip coverage check for: " + << fullFileName.c_str() + << std::endl); + continue; } - const std::string fullFileName = fileIterator->first; - const std::string fileName - = cmSystemTools::GetFilenameName(fullFileName.c_str()); + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Process file: " << fullFileName << std::endl); @@ -486,18 +488,18 @@ int cmCTestCoverageHandler::ProcessHandler() continue; } - bool shouldIDoCoverage - = this->ShouldIDoCoverage(fullFileName.c_str(), - sourceDir.c_str(), binaryDir.c_str()); - if ( !shouldIDoCoverage ) + if ( ++cnt % 100 == 0 ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - ".NoDartCoverage found, so skip coverage check for: " - << fullFileName.c_str() - << std::endl); - continue; + this->EndCoverageLogFile(covLogFile, logFileCount); + logFileCount ++; + if ( !this->StartCoverageLogFile(covLogFile, logFileCount) ) + { + return -1; + } } + const std::string fileName + = cmSystemTools::GetFilenameName(fullFileName.c_str()); std::string shortFileName = this->CTest->GetShortPathToFile(fullFileName.c_str()); const cmCTestCoverageHandlerContainer::SingleFileCoverageVector& fcov @@ -582,7 +584,6 @@ int cmCTestCoverageHandler::ProcessHandler() covSumFile << (cmet) << "</CoverageMetric>\n"; this->WriteXMLLabels(covSumFile, shortFileName); covSumFile << "\t</File>" << std::endl; - cnt ++; } this->EndCoverageLogFile(covLogFile, logFileCount); |