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/cmCTestMultiProcessHandler.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/cmCTestMultiProcessHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 99cf551..14b5caa 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -20,6 +20,7 @@ #include <algorithm> #include <chrono> +#include <cstring> #include <iomanip> #include <list> #include <math.h> @@ -169,13 +170,19 @@ bool cmCTestMultiProcessHandler::StartTestProcess(int test) } } - cmWorkingDirectory workdir(this->Properties[test]->Directory); - - // Lock the resources we'll be using + // Always lock the resources we'll be using, even if we fail to set the + // working directory because FinishTestProcess() will try to unlock them this->LockResources(test); - if (testRun->StartTest(this->Total)) { - return true; + cmWorkingDirectory workdir(this->Properties[test]->Directory); + if (workdir.Failed()) { + testRun->StartFailure("Failed to change working directory to " + + this->Properties[test]->Directory + " : " + + std::strerror(workdir.GetLastResult())); + } else { + if (testRun->StartTest(this->Total)) { + return true; + } } this->FinishTestProcess(testRun, false); @@ -694,6 +701,8 @@ void cmCTestMultiProcessHandler::PrintTestList() count++; cmCTestTestHandler::cmCTestTestProperties& p = *it.second; + // Don't worry if this fails, we are only showing the test list, not + // running the tests cmWorkingDirectory workdir(p.Directory); cmCTestRunTest testRun(*this); |