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

Method StartTestProcess

Source/CTest/cmCTestMultiProcessHandler.cxx:259–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257}
258
259void cmCTestMultiProcessHandler::StartTestProcess(int test)
260{
261 cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
262 "test " << test << "\n", this->Quiet);
263
264 auto testRun = cm::make_unique<cmCTestRunTest>(*this, test);
265
266 if (this->RepeatMode != cmCTest::Repeat::Never) {
267 testRun->SetRepeatMode(this->RepeatMode);
268 testRun->SetNumberOfRuns(this->RepeatCount);
269 }
270 if (this->UseResourceSpec) {
271 testRun->SetUseAllocatedResources(true);
272 testRun->SetAllocatedResources(this->AllocatedResources[test]);
273 }
274
275 // Find any failed dependencies for this test. We assume the more common
276 // scenario has no failed tests, so make it the outer loop.
277 for (std::string const& f : *this->Failed) {
278 if (cm::contains(this->Properties[test]->RequireSuccessDepends, f)) {
279 testRun->AddFailedDependency(f);
280 }
281 }
282
283 if (!this->ResourceAvailabilityErrors[test].empty()) {
284 std::ostringstream e;
285 e << "Insufficient resources for test " << this->Properties[test]->Name
286 << ":\n\n";
287 for (auto const& it : this->ResourceAvailabilityErrors[test]) {
288 switch (it.second) {
289 case ResourceAvailabilityError::NoResourceType:
290 e << " Test requested resources of type '" << it.first
291 << "' which does not exist\n";
292 break;
293
294 case ResourceAvailabilityError::InsufficientResources:
295 e << " Test requested resources of type '" << it.first
296 << "' in the following amounts:\n";
297 for (auto const& group : this->Properties[test]->ResourceGroups) {
298 for (auto const& requirement : group) {
299 if (requirement.ResourceType == it.first) {
300 e << " " << requirement.SlotsNeeded
301 << (requirement.SlotsNeeded == 1 ? " slot\n" : " slots\n");
302 }
303 }
304 }
305 e << " but only the following units were available:\n";
306 for (auto const& res :
307 this->ResourceAllocator.GetResources().at(it.first)) {
308 e << " '" << res.first << "': " << res.second.Total
309 << (res.second.Total == 1 ? " slot\n" : " slots\n");
310 }
311 break;
312 }
313 e << "\n";
314 }
315 e << "Resource spec file:\n\n " << this->ResourceSpecFile;
316 cmCTestRunTest::StartFailure(std::move(testRun), this->Total, e.str(),

Callers 2

StartTestMethod · 0.95

Calls 11

moveFunction · 0.85
SetNumberOfRunsMethod · 0.80
SetAllocatedResourcesMethod · 0.80
AddFailedDependencyMethod · 0.80
strMethod · 0.80
FailedMethod · 0.80
SetRepeatModeMethod · 0.45
emptyMethod · 0.45
atMethod · 0.45
GetErrorMethod · 0.45

Tested by

no test coverage detected