summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestMultiProcessHandler.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CTest/cmCTestMultiProcessHandler.h')
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h33
1 files changed, 31 insertions, 2 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index be31c75..da716f0 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -14,10 +14,13 @@
#include "cm_uv.h"
+#include "cmCTestHardwareAllocator.h"
#include "cmCTestTestHandler.h"
#include "cmUVHandlePtr.h"
class cmCTest;
+struct cmCTestBinPackerAllocation;
+class cmCTestHardwareSpec;
class cmCTestRunTest;
/** \class cmCTestMultiProcessHandler
@@ -44,6 +47,11 @@ public:
: public std::map<int, cmCTestTestHandler::cmCTestTestProperties*>
{
};
+ struct HardwareAllocation
+ {
+ std::string Id;
+ unsigned int Slots;
+ };
cmCTestMultiProcessHandler();
virtual ~cmCTestMultiProcessHandler();
@@ -79,6 +87,13 @@ public:
void SetQuiet(bool b) { this->Quiet = b; }
+ void InitHardwareAllocator(const cmCTestHardwareSpec& spec)
+ {
+ this->HardwareAllocator.InitializeFromHardwareSpec(spec);
+ }
+
+ void CheckHardwareAvailable();
+
protected:
// Start the next test or tests as many as are allowed by
// ParallelLevel
@@ -119,8 +134,17 @@ protected:
bool CheckStopTimePassed();
void SetStopTimePassed();
- void LockResources(int index);
- void UnlockResources(int index);
+ void AllocateResources(int index);
+ void DeallocateResources(int index);
+
+ bool AllocateHardware(int index);
+ bool TryAllocateHardware(
+ int index,
+ std::map<std::string, std::vector<cmCTestBinPackerAllocation>>&
+ allocations);
+ void DeallocateHardware(int index);
+ bool AllHardwareAvailable();
+
// map from test number to set of depend tests
TestMap Tests;
TestList SortedTests;
@@ -141,6 +165,11 @@ protected:
std::vector<std::string>* Failed;
std::vector<std::string> LastTestsFailed;
std::set<std::string> LockedResources;
+ std::map<int,
+ std::vector<std::map<std::string, std::vector<HardwareAllocation>>>>
+ AllocatedHardware;
+ std::map<int, bool> TestsHaveSufficientHardware;
+ cmCTestHardwareAllocator HardwareAllocator;
std::vector<cmCTestTestHandler::cmCTestTestResult>* TestResults;
size_t ParallelLevel; // max number of process that can be run at once
unsigned long TestLoad;