diff options
author | Craig Scott <craig.scott@crascit.com> | 2018-03-04 06:27:09 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2018-03-08 09:07:14 (GMT) |
commit | e60e4dfc88252aaec53f0d832508d41dff6165fd (patch) | |
tree | 5903e9e8f2eb57780d47a21d83f282f9cee11741 /Source/CTest/cmCTestMultiProcessHandler.cxx | |
parent | e654622aee22655c418a9c663fad79243ca0c819 (diff) | |
download | CMake-e60e4dfc88252aaec53f0d832508d41dff6165fd.zip CMake-e60e4dfc88252aaec53f0d832508d41dff6165fd.tar.gz CMake-e60e4dfc88252aaec53f0d832508d41dff6165fd.tar.bz2 |
cmWorkingDirectory: Check success of current dir changes
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 50c2d86..a8bf1e5 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -19,6 +19,7 @@ #include <algorithm> #include <chrono> +#include <cstring> #include <iomanip> #include <list> #include <math.h> @@ -151,13 +152,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); @@ -666,6 +673,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); |