diff options
Diffstat (limited to 'Source/CTest/cmCTestMultiProcessHandler.h')
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.h | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index d66c348..1f6b042 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -58,12 +58,12 @@ public: unsigned int Slots; }; - cmCTestMultiProcessHandler(); + cmCTestMultiProcessHandler(cmCTest* ctest, cmCTestTestHandler* handler); virtual ~cmCTestMultiProcessHandler(); // Set the tests bool SetTests(TestMap tests, PropertiesMap properties); // Set the max number of tests that can be run at the same time. - void SetParallelLevel(size_t); + void SetParallelLevel(cm::optional<size_t> level); void SetTestLoad(unsigned long load); virtual void RunTests(); void PrintOutputAsJson(); @@ -81,13 +81,6 @@ public: this->TestResults = r; } - void SetCTest(cmCTest* ctest) { this->CTest = ctest; } - - void SetTestHandler(cmCTestTestHandler* handler) - { - this->TestHandler = handler; - } - cmCTestTestHandler* GetTestHandler() { return this->TestHandler; } void SetRepeatMode(cmCTest::Repeat mode, int count) @@ -171,22 +164,26 @@ protected: bool InitResourceAllocator(std::string& error); bool CheckGeneratedResourceSpec(); +private: + cmCTest* CTest; + cmCTestTestHandler* TestHandler; + bool UseResourceSpec = false; cmCTestResourceSpec ResourceSpec; std::string ResourceSpecFile; std::string ResourceSpecSetupFixture; cm::optional<std::size_t> ResourceSpecSetupTest; - bool HasInvalidGeneratedResourceSpec; + bool HasInvalidGeneratedResourceSpec = false; // Tests pending selection to start. They may have dependencies. TestMap PendingTests; // List of pending test indexes, ordered by cost. std::list<int> OrderedTests; // Total number of tests we'll be running - size_t Total; + size_t Total = 0; // Number of tests that are complete - size_t Completed; - size_t RunningCount; + size_t Completed = 0; + size_t RunningCount = 0; std::set<size_t> ProcessorsAvailable; size_t HaveAffinity; bool StopTimePassed = false; @@ -204,7 +201,15 @@ protected: ResourceAvailabilityErrors; cmCTestResourceAllocator ResourceAllocator; std::vector<cmCTestTestHandler::cmCTestTestResult>* TestResults; - size_t ParallelLevel; // max number of process that can be run at once + + // Get the maximum number of processors that may be used at once. + size_t GetParallelLevel() const; + + // With no '-j' option, default to serial testing. + cm::optional<size_t> ParallelLevel = 1; + + // Fallback parallelism limit when '-j' is given with no value. + size_t ParallelLevelDefault; // 'make' jobserver client. If connected, we acquire a token // for each test before running its process. @@ -214,16 +219,14 @@ protected: // Callback invoked when a token is received. void JobServerReceivedToken(); - unsigned long TestLoad; - unsigned long FakeLoadForTesting; + unsigned long TestLoad = 0; + unsigned long FakeLoadForTesting = 0; cm::uv_loop_ptr Loop; cm::uv_idle_ptr StartNextTestsOnIdle_; cm::uv_timer_ptr StartNextTestsOnTimer_; - cmCTestTestHandler* TestHandler; - cmCTest* CTest; - bool HasCycles; + bool HasCycles = false; cmCTest::Repeat RepeatMode = cmCTest::Repeat::Never; int RepeatCount = 1; - bool Quiet; - bool SerialTestRunning; + bool Quiet = false; + bool SerialTestRunning = false; }; |