diff options
author | Brad King <brad.king@kitware.com> | 2015-11-23 18:47:25 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-11-23 18:47:25 (GMT) |
commit | ed08d1d48969994e9cd4f4ff9d3815c644bfcc8d (patch) | |
tree | e7918e686708b423f14db3e9e0f3aabc137ddba6 /Source | |
parent | dbef2244f97e266896f71729d0de5eeb80c1c5f9 (diff) | |
parent | 32268810d9f1cf40d20bfb287be30db582696043 (diff) | |
download | CMake-ed08d1d48969994e9cd4f4ff9d3815c644bfcc8d.zip CMake-ed08d1d48969994e9cd4f4ff9d3815c644bfcc8d.tar.gz CMake-ed08d1d48969994e9cd4f4ff9d3815c644bfcc8d.tar.bz2 |
Merge topic 'expand_cobertura_search'
32268810 CTest: Expand directories for Cobertura search
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 6027502..2c2cd48 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -820,11 +820,26 @@ int cmCTestCoverageHandler::HandleCoberturaCoverage( { cmParseCoberturaCoverage cov(*cont, this->CTest); - // Assume the coverage.xml is in the source directory - std::string coverageXMLFile = this->CTest->GetBinaryDir() + "/coverage.xml"; + // Assume the coverage.xml is in the binary directory + // check for the COBERTURADIR environment variable, + // if it doesn't exist or is empty, assume the + // binary directory is used. + std::string coverageXMLFile; + const char* covDir = cmSystemTools::GetEnv("COBERTURADIR"); + if(covDir && strlen(covDir) != 0) + { + coverageXMLFile = std::string(covDir); + } + else + { + coverageXMLFile = this->CTest->GetBinaryDir(); + } + // build the find file string with the directory from above + coverageXMLFile += "/coverage.xml"; if(cmSystemTools::FileExists(coverageXMLFile.c_str())) { + // If file exists, parse it cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Parsing Cobertura XML file: " << coverageXMLFile << std::endl, this->Quiet); @@ -833,7 +848,7 @@ int cmCTestCoverageHandler::HandleCoberturaCoverage( else { cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Cannot find Cobertura XML file: " << coverageXMLFile + " Cannot find Cobertura XML file: " << coverageXMLFile << std::endl, this->Quiet); } return static_cast<int>(cont->TotalCoverage.size()); |