diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2020-02-24 16:41:06 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2020-02-24 20:44:01 (GMT) |
commit | a5be3916eeee82d5237f9ace85a74fc052240717 (patch) | |
tree | 0cd95d08ce4aa5b96d17a5fc03d8096a3861955d /Source/CTest/cmCTestMultiProcessHandler.cxx | |
parent | f0df3ed5b99257ab8109fcbe09e8ff97565c00c8 (diff) | |
download | CMake-a5be3916eeee82d5237f9ace85a74fc052240717.zip CMake-a5be3916eeee82d5237f9ace85a74fc052240717.tar.gz CMake-a5be3916eeee82d5237f9ace85a74fc052240717.tar.bz2 |
CTest: Provide more detailed information on resource allocation error
Diffstat (limited to 'Source/CTest/cmCTestMultiProcessHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 6343353..2192843 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -197,7 +197,39 @@ bool cmCTestMultiProcessHandler::StartTestProcess(int test) this->LockResources(test); if (!this->ResourceAllocationErrors[test].empty()) { - testRun->StartFailure("Insufficient resources", "Failed to start"); + std::ostringstream e; + e << "Insufficient resources for test " << this->Properties[test]->Name + << ":\n\n"; + for (auto const& it : this->ResourceAllocationErrors[test]) { + switch (it.second) { + case ResourceAllocationError::NoResourceType: + e << " Test requested resources of type '" << it.first + << "' which does not exist\n"; + break; + + case ResourceAllocationError::InsufficientResources: + e << " Test requested resources of type '" << it.first + << "' in the following amounts:\n"; + for (auto const& group : this->Properties[test]->ResourceGroups) { + for (auto const& requirement : group) { + if (requirement.ResourceType == it.first) { + e << " " << requirement.SlotsNeeded + << (requirement.SlotsNeeded == 1 ? " slot\n" : " slots\n"); + } + } + } + e << " but only the following units were available:\n"; + for (auto const& res : + this->ResourceAllocator.GetResources().at(it.first)) { + e << " '" << res.first << "': " << res.second.Total + << (res.second.Total == 1 ? " slot\n" : " slots\n"); + } + break; + } + e << "\n"; + } + e << "Resource spec file:\n\n " << this->TestHandler->ResourceSpecFile; + testRun->StartFailure(e.str(), "Insufficient resources"); this->FinishTestProcess(testRun, false); return false; } |