diff options
author | Brad King <brad.king@kitware.com> | 2018-03-09 12:43:39 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-03-09 12:43:54 (GMT) |
commit | e11410bb0c66152c6fafb56d40c9328abaa7a1ab (patch) | |
tree | 14113116753b98ab5b0932ab87c3092756d6f295 /Source/CTest/cmCTestCoverageHandler.cxx | |
parent | 44fc5729637330e463666f97ba952dcb6f2e9506 (diff) | |
parent | 5901699672cce82d9622a02c4c7d22889029ee0c (diff) | |
download | CMake-e11410bb0c66152c6fafb56d40c9328abaa7a1ab.zip CMake-e11410bb0c66152c6fafb56d40c9328abaa7a1ab.tar.gz CMake-e11410bb0c66152c6fafb56d40c9328abaa7a1ab.tar.bz2 |
Merge topic 'cmWorkingDirectory_success_checking'
5901699672 cmDepends: Remove attempt to change directory that always fails
e60e4dfc88 cmWorkingDirectory: Check success of current dir changes
e654622aee Tests: Add --build-and-test test case
a865f0beb2 Tests: Confirm test working dir set successfully
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1817
Diffstat (limited to 'Source/CTest/cmCTestCoverageHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 9c66e73..6cf0ac2 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -23,6 +23,7 @@ #include "cmsys/RegularExpression.hxx" #include <algorithm> #include <chrono> +#include <cstring> #include <iomanip> #include <iterator> #include <sstream> @@ -975,7 +976,12 @@ int cmCTestCoverageHandler::HandleGCovCoverage( std::string testingDir = this->CTest->GetBinaryDir() + "/Testing"; std::string tempDir = testingDir + "/CoverageInfo"; - cmSystemTools::MakeDirectory(tempDir); + if (!cmSystemTools::MakeDirectory(tempDir)) { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Unable to make directory: " << tempDir << std::endl); + cont->Error++; + return 0; + } cmWorkingDirectory workdir(tempDir); int gcovStyle = 0; @@ -1376,6 +1382,14 @@ int cmCTestCoverageHandler::HandleLCovCoverage( this->Quiet); std::string fileDir = cmSystemTools::GetFilenamePath(f); cmWorkingDirectory workdir(fileDir); + if (workdir.Failed()) { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Unable to change working directory to " + << fileDir << " : " + << std::strerror(workdir.GetLastResult()) << std::endl); + cont->Error++; + continue; + } cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Current coverage dir: " << fileDir << std::endl, @@ -1600,6 +1614,12 @@ bool cmCTestCoverageHandler::FindLCovFiles(std::vector<std::string>& files) gl.RecurseThroughSymlinksOff(); std::string buildDir = this->CTest->GetCTestConfiguration("BuildDirectory"); cmWorkingDirectory workdir(buildDir); + if (workdir.Failed()) { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Unable to change working directory to " << buildDir + << std::endl); + return false; + } // Run profmerge to merge all *.dyn files into dpi files if (!cmSystemTools::RunSingleCommand("profmerge")) { |