Set the max number of tests that can be run at the same time.
| 153 | |
| 154 | // Set the max number of tests that can be run at the same time. |
| 155 | void cmCTestMultiProcessHandler::SetParallelLevel(cm::optional<size_t> level) |
| 156 | { |
| 157 | this->ParallelLevel = level; |
| 158 | |
| 159 | if (!this->ParallelLevel) { |
| 160 | // '-j' was given with no value. Limit by number of processors. |
| 161 | cmsys::SystemInformation info; |
| 162 | info.RunCPUCheck(); |
| 163 | unsigned long processorCount = info.GetNumberOfLogicalCPU(); |
| 164 | |
| 165 | if (cm::optional<std::string> fakeProcessorCount = |
| 166 | cmSystemTools::GetEnvVar( |
| 167 | "__CTEST_FAKE_PROCESSOR_COUNT_FOR_TESTING")) { |
| 168 | unsigned long pc = 0; |
| 169 | if (cmStrToULong(*fakeProcessorCount, &pc)) { |
| 170 | processorCount = pc; |
| 171 | } else { |
| 172 | cmSystemTools::Error("Failed to parse fake processor count: " + |
| 173 | *fakeProcessorCount); |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | this->ParallelLevelDefault = |
| 178 | std::max(kParallelLevelMinimum, processorCount); |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | size_t cmCTestMultiProcessHandler::GetParallelLevel() const |
| 183 | { |
no test coverage detected