diff options
author | Joseph Snyder <joe.snyder@kitware.com> | 2015-11-18 18:01:22 (GMT) |
---|---|---|
committer | Joseph Snyder <joe.snyder@kitware.com> | 2016-02-25 18:01:37 (GMT) |
commit | bc29ed542bbe8ff6b0bc178a7940a166680e002e (patch) | |
tree | 66494f5d8efc40866b1462c961b977669fd013d3 /Source/CTest/cmCTestCoverageHandler.cxx | |
parent | f8af218ea148baafcfc3db6ea5ba7389f5ea7206 (diff) | |
download | CMake-bc29ed542bbe8ff6b0bc178a7940a166680e002e.zip CMake-bc29ed542bbe8ff6b0bc178a7940a166680e002e.tar.gz CMake-bc29ed542bbe8ff6b0bc178a7940a166680e002e.tar.bz2 |
CTest: Make coverage file selection more specific.
When performing some other testing, the globs for Blanket.js and Delphi
code coverage are picking up unintended files. Change the query for the
Delphi coverage to follow the naming convention, and check the second line
of the found JSON files for certain text before parsing them as coverage files.
Diffstat (limited to 'Source/CTest/cmCTestCoverageHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 2c2cd48..fd62696 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -983,7 +983,7 @@ int cmCTestCoverageHandler::HandleDelphiCoverage( std::string BinDir = this->CTest->GetBinaryDir(); - std::string coverageFile = BinDir+ "/*.html"; + std::string coverageFile = BinDir+ "/*(*.pas).html"; g.FindFiles(coverageFile); @@ -1017,9 +1017,25 @@ int cmCTestCoverageHandler::HandleBlanketJSCoverage( std::string coverageFile = SourceDir+ "/*.json"; cmsys::Glob g; std::vector<std::string> files; + std::vector<std::string> blanketFiles; g.FindFiles(coverageFile); files=g.GetFiles(); - if (!files.empty()) + // Ensure that the JSON files found are the result of the + // Blanket.js output. Check for the "node-jscoverage" + // string on the second line + std::string line; + for(unsigned int fileEntry=0;fileEntry<files.size();fileEntry++) + { + cmsys::ifstream in(files[fileEntry].c_str()); + cmSystemTools::GetLineFromStream(in, line); + cmSystemTools::GetLineFromStream(in, line); + if (line.find("node-jscoverage") != line.npos) + { + blanketFiles.push_back(files[fileEntry]); + } + } + // Take all files with the node-jscoverage string and parse those + if (!blanketFiles.empty()) { cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found BlanketJS output JSON, Performing Coverage" << std::endl, |