Returns true if no cycles exist in the dependency graph
| 1563 | |
| 1564 | // Returns true if no cycles exist in the dependency graph |
| 1565 | bool 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 | |
| 1602 | bool cmCTestMultiProcessHandler::CheckGeneratedResourceSpec() |
| 1603 | { |