mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 19:00:54 -06:00
cmCTestMultiProcessHandler: Clarify resource availability error member names
The members are about the availability of sufficient resources, not allocation of them.
This commit is contained in:
@@ -196,18 +196,18 @@ bool cmCTestMultiProcessHandler::StartTestProcess(int test)
|
||||
// working directory because FinishTestProcess() will try to unlock them
|
||||
this->LockResources(test);
|
||||
|
||||
if (!this->ResourceAllocationErrors[test].empty()) {
|
||||
if (!this->ResourceAvailabilityErrors[test].empty()) {
|
||||
std::ostringstream e;
|
||||
e << "Insufficient resources for test " << this->Properties[test]->Name
|
||||
<< ":\n\n";
|
||||
for (auto const& it : this->ResourceAllocationErrors[test]) {
|
||||
for (auto const& it : this->ResourceAvailabilityErrors[test]) {
|
||||
switch (it.second) {
|
||||
case ResourceAllocationError::NoResourceType:
|
||||
case ResourceAvailabilityError::NoResourceType:
|
||||
e << " Test requested resources of type '" << it.first
|
||||
<< "' which does not exist\n";
|
||||
break;
|
||||
|
||||
case ResourceAllocationError::InsufficientResources:
|
||||
case ResourceAvailabilityError::InsufficientResources:
|
||||
e << " Test requested resources of type '" << it.first
|
||||
<< "' in the following amounts:\n";
|
||||
for (auto const& group : this->Properties[test]->ResourceGroups) {
|
||||
@@ -280,7 +280,7 @@ bool cmCTestMultiProcessHandler::AllocateResources(int index)
|
||||
bool cmCTestMultiProcessHandler::TryAllocateResources(
|
||||
int index,
|
||||
std::map<std::string, std::vector<cmCTestBinPackerAllocation>>& allocations,
|
||||
std::map<std::string, ResourceAllocationError>* errors)
|
||||
std::map<std::string, ResourceAvailabilityError>* errors)
|
||||
{
|
||||
allocations.clear();
|
||||
|
||||
@@ -300,7 +300,7 @@ bool cmCTestMultiProcessHandler::TryAllocateResources(
|
||||
for (auto& it : allocations) {
|
||||
if (!availableResources.count(it.first)) {
|
||||
if (errors) {
|
||||
(*errors)[it.first] = ResourceAllocationError::NoResourceType;
|
||||
(*errors)[it.first] = ResourceAvailabilityError::NoResourceType;
|
||||
result = false;
|
||||
} else {
|
||||
return false;
|
||||
@@ -308,7 +308,7 @@ bool cmCTestMultiProcessHandler::TryAllocateResources(
|
||||
} else if (!cmAllocateCTestResourcesRoundRobin(
|
||||
availableResources.at(it.first), it.second)) {
|
||||
if (errors) {
|
||||
(*errors)[it.first] = ResourceAllocationError::InsufficientResources;
|
||||
(*errors)[it.first] = ResourceAvailabilityError::InsufficientResources;
|
||||
result = false;
|
||||
} else {
|
||||
return false;
|
||||
@@ -355,14 +355,14 @@ bool cmCTestMultiProcessHandler::AllResourcesAvailable()
|
||||
return true;
|
||||
}
|
||||
|
||||
void cmCTestMultiProcessHandler::CheckResourcesAvailable()
|
||||
void cmCTestMultiProcessHandler::CheckResourceAvailability()
|
||||
{
|
||||
if (this->UseResourceSpec) {
|
||||
for (auto const& t : this->PendingTests) {
|
||||
std::map<std::string, std::vector<cmCTestBinPackerAllocation>>
|
||||
allocations;
|
||||
this->TryAllocateResources(t.first, allocations,
|
||||
&this->ResourceAllocationErrors[t.first]);
|
||||
&this->ResourceAvailabilityErrors[t.first]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -455,7 +455,7 @@ bool cmCTestMultiProcessHandler::StartTest(int test)
|
||||
}
|
||||
|
||||
// Allocate resources
|
||||
if (this->ResourceAllocationErrors[test].empty() &&
|
||||
if (this->ResourceAvailabilityErrors[test].empty() &&
|
||||
!this->AllocateResources(test)) {
|
||||
this->DeallocateResources(test);
|
||||
return false;
|
||||
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
|
||||
void SetQuiet(bool b) { this->Quiet = b; }
|
||||
|
||||
void CheckResourcesAvailable();
|
||||
void CheckResourceAvailability();
|
||||
|
||||
protected:
|
||||
// Start the next test or tests as many as are allowed by
|
||||
@@ -151,7 +151,7 @@ protected:
|
||||
void LockResources(int index);
|
||||
void UnlockResources(int index);
|
||||
|
||||
enum class ResourceAllocationError
|
||||
enum class ResourceAvailabilityError
|
||||
{
|
||||
NoResourceType,
|
||||
InsufficientResources,
|
||||
@@ -163,7 +163,7 @@ protected:
|
||||
int index,
|
||||
std::map<std::string, std::vector<cmCTestBinPackerAllocation>>&
|
||||
allocations,
|
||||
std::map<std::string, ResourceAllocationError>* errors = nullptr);
|
||||
std::map<std::string, ResourceAvailabilityError>* errors = nullptr);
|
||||
void DeallocateResources(int index);
|
||||
bool AllResourcesAvailable();
|
||||
bool InitResourceAllocator(std::string& error);
|
||||
@@ -198,8 +198,8 @@ protected:
|
||||
std::map<int,
|
||||
std::vector<std::map<std::string, std::vector<ResourceAllocation>>>>
|
||||
AllocatedResources;
|
||||
std::map<int, std::map<std::string, ResourceAllocationError>>
|
||||
ResourceAllocationErrors;
|
||||
std::map<int, std::map<std::string, ResourceAvailabilityError>>
|
||||
ResourceAvailabilityErrors;
|
||||
cmCTestResourceAllocator ResourceAllocator;
|
||||
std::vector<cmCTestTestHandler::cmCTestTestResult>* TestResults;
|
||||
size_t ParallelLevel; // max number of process that can be run at once
|
||||
|
||||
@@ -165,7 +165,7 @@ cmCTestRunTest::EndTestResult cmCTestRunTest::EndTest(size_t completed,
|
||||
reason = "Invalid resource spec file";
|
||||
forceFail = true;
|
||||
} else {
|
||||
this->MultiTestHandler.CheckResourcesAvailable();
|
||||
this->MultiTestHandler.CheckResourceAvailability();
|
||||
}
|
||||
}
|
||||
std::ostringstream outputStream;
|
||||
|
||||
@@ -1389,7 +1389,7 @@ bool cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed,
|
||||
parallel->SetPassFailVectors(&passed, &failed);
|
||||
this->TestResults.clear();
|
||||
parallel->SetTestResults(&this->TestResults);
|
||||
parallel->CheckResourcesAvailable();
|
||||
parallel->CheckResourceAvailability();
|
||||
|
||||
if (this->CTest->ShouldPrintLabels()) {
|
||||
parallel->PrintLabels();
|
||||
|
||||
Reference in New Issue
Block a user