summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorJames Johnston <johnstonj.public@codenest.com>2015-08-08 04:28:38 (GMT)
committerJames Johnston <johnstonj.public@codenest.com>2015-08-08 04:28:38 (GMT)
commitb28b07db47b181718643399bd2aedc3e6d1b29c4 (patch)
tree65795ab33805025f3099c28e66a679544f6d01bb /Source
parent3cefadbff07d68c5a6846835ea87cc35eae55a0b (diff)
downloadCMake-b28b07db47b181718643399bd2aedc3e6d1b29c4.zip
CMake-b28b07db47b181718643399bd2aedc3e6d1b29c4.tar.gz
CMake-b28b07db47b181718643399bd2aedc3e6d1b29c4.tar.bz2
cmCTestCoverageHandle: Improve error handling.
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx33
-rw-r--r--Source/CTest/cmCTestCoverageHandler.h2
2 files changed, 28 insertions, 7 deletions
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 6369e17..65599e0 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -1474,7 +1474,12 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
<< std::endl, this->Quiet);
std::vector<std::string> files;
- this->FindLCovFiles(files);
+ if (!this->FindLCovFiles(files))
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Error while finding LCov files.\n");
+ return 0;
+ }
std::vector<std::string>::iterator it;
if (files.empty())
@@ -1745,18 +1750,28 @@ void cmCTestCoverageHandler::FindGCovFiles(std::vector<std::string>& files)
}
//----------------------------------------------------------------------------
-void cmCTestCoverageHandler::FindLCovFiles(std::vector<std::string>& files)
+bool cmCTestCoverageHandler::FindLCovFiles(std::vector<std::string>& files)
{
cmsys::Glob gl;
gl.RecurseOff(); // No need of recurse if -prof_dir${BUILD_DIR} flag is
// used while compiling.
gl.RecurseThroughSymlinksOff();
std::string prevBinaryDir;
- cmSystemTools::ChangeDirectory(
- this->CTest->GetCTestConfiguration("BuildDirectory"));
+ std::string buildDir = this->CTest->GetCTestConfiguration("BuildDirectory");
+ if (cmSystemTools::ChangeDirectory(buildDir))
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Error changing directory to " << buildDir << std::endl);
+ return false;
+ }
// Run profmerge to merge all *.dyn files into dpi files
- cmSystemTools::RunSingleCommand("profmerge");
+ if (!cmSystemTools::RunSingleCommand("profmerge"))
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Error while running profmerge.\n");
+ return false;
+ }
prevBinaryDir = cmSystemTools::GetCurrentWorkingDirectory().c_str();
@@ -1766,10 +1781,16 @@ void cmCTestCoverageHandler::FindLCovFiles(std::vector<std::string>& files)
daGlob += "/*.dpi";
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" looking for dpi files in: " << daGlob << std::endl, this->Quiet);
- gl.FindFiles(daGlob);
+ if (!gl.FindFiles(daGlob))
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Error while finding files matching " << daGlob << std::endl);
+ return false;
+ }
files.insert(files.end(), gl.GetFiles().begin(), gl.GetFiles().end());
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Now searching in: " << daGlob << std::endl, this->Quiet);
+ return true;
}
//----------------------------------------------------------------------
diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h
index 2ca123a..7102d1e 100644
--- a/Source/CTest/cmCTestCoverageHandler.h
+++ b/Source/CTest/cmCTestCoverageHandler.h
@@ -75,7 +75,7 @@ private:
//! Handle coverage using Intel's LCov
int HandleLCovCoverage(cmCTestCoverageHandlerContainer* cont);
- void FindLCovFiles(std::vector<std::string>& files);
+ bool FindLCovFiles(std::vector<std::string>& files);
//! Handle coverage using xdebug php coverage
int HandlePHPCoverage(cmCTestCoverageHandlerContainer* cont);