MCPcopy Create free account
hub / github.com/Kitware/CMake / StartNextTests

Method StartNextTests

Source/CTest/cmCTestMultiProcessHandler.cxx:589–752  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

587}
588
589void cmCTestMultiProcessHandler::StartNextTests()
590{
591 // One or more events may be scheduled to call this method again.
592 // Since this method has been called they are no longer needed.
593 this->StartNextTestsOnIdle_.stop();
594 this->StartNextTestsOnTimer_.stop();
595
596 if (this->PendingTests.empty() || this->CheckStopTimePassed() ||
597 (this->CheckStopOnFailure() && !this->Failed->empty())) {
598 return;
599 }
600
601 size_t numToStart = 0;
602
603 size_t const parallelLevel = this->GetParallelLevel();
604 if (this->RunningCount < parallelLevel) {
605 numToStart = parallelLevel - this->RunningCount;
606 }
607
608 if (numToStart == 0) {
609 return;
610 }
611
612 // Don't start any new tests if one with the RUN_SERIAL property
613 // is already running.
614 if (this->SerialTestRunning) {
615 return;
616 }
617
618 bool allTestsFailedTestLoadCheck = false;
619 size_t minProcessorsRequired = this->GetParallelLevel();
620 std::string testWithMinProcessors;
621
622 cmsys::SystemInformation info;
623
624 unsigned long systemLoad = 0;
625 size_t spareLoad = 0;
626 if (this->TestLoad > 0) {
627 // Activate possible wait.
628 allTestsFailedTestLoadCheck = true;
629
630 // Check for a fake load average value used in testing.
631 if (this->FakeLoadForTesting > 0) {
632 systemLoad = this->FakeLoadForTesting;
633 // Drop the fake load for the next iteration to a value low enough
634 // that the next iteration will start tests.
635 this->FakeLoadForTesting = 1;
636 }
637 // If it's not set, look up the true load average.
638 else {
639 systemLoad = static_cast<unsigned long>(ceil(info.GetLoadAverage()));
640 }
641 spareLoad =
642 (this->TestLoad > systemLoad ? this->TestLoad - systemLoad : 0);
643
644 // Don't start more tests than the spare load can support.
645 if (numToStart > spareLoad) {
646 numToStart = spareLoad;

Callers 2

StartNextTestsOnIdleMethod · 0.95
StartNextTestsOnTimerMethod · 0.95

Calls 15

CheckStopTimePassedMethod · 0.95
CheckStopOnFailureMethod · 0.95
GetParallelLevelMethod · 0.95
GetProcessorsUsedMethod · 0.95
GetNameMethod · 0.95
AllocateResourcesMethod · 0.95
LockResourcesMethod · 0.95
StartTestMethod · 0.95
StartNextTestsOnTimerMethod · 0.95
GetLoadAverageMethod · 0.80
eraseMethod · 0.80

Tested by

no test coverage detected