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

Method CheckCycles

Source/CTest/cmCTestMultiProcessHandler.cxx:1565–1600  ·  view source on GitHub ↗

Returns true if no cycles exist in the dependency graph

Source from the content-addressed store, hash-verified

1563
1564// Returns true if no cycles exist in the dependency graph
1565bool cmCTestMultiProcessHandler::CheckCycles()
1566{
1567 cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
1568 "Checking test dependency graph..." << std::endl,
1569 this->Quiet);
1570 for (auto const& it : this->PendingTests) {
1571 // DFS from each element to itself
1572 int root = it.first;
1573 std::set<int> visited;
1574 std::stack<int> s;
1575 s.push(root);
1576 while (!s.empty()) {
1577 int test = s.top();
1578 s.pop();
1579 if (visited.insert(test).second) {
1580 for (auto const& d : this->PendingTests[test].Depends) {
1581 if (d == root) {
1582 // cycle exists
1583 cmCTestLog(
1584 this->CTest, ERROR_MESSAGE,
1585 "Error: a cycle exists in the test dependency graph "
1586 "for the test \""
1587 << this->Properties[root]->Name
1588 << "\".\nPlease fix the cycle and run ctest again.\n");
1589 return false;
1590 }
1591 s.push(d);
1592 }
1593 }
1594 }
1595 }
1596 cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
1597 "Checking test dependency graph end" << std::endl,
1598 this->Quiet);
1599 return true;
1600}
1601
1602bool cmCTestMultiProcessHandler::CheckGeneratedResourceSpec()
1603{

Callers 1

SetTestsMethod · 0.95

Calls 2

emptyMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected