diff options
author | Zach Mullen <zach.mullen@kitware.com> | 2010-06-30 14:39:17 (GMT) |
---|---|---|
committer | Zach Mullen <zach.mullen@kitware.com> | 2010-06-30 14:39:17 (GMT) |
commit | 3e52000a07cb71172bc0ff7223dbca6f793786b6 (patch) | |
tree | 9b3d206df0385e8d6f6af76118a97b9ab581a877 /Source/CTest/cmCTestMultiProcessHandler.cxx | |
parent | b65cd9b70b52dc36d51165bd00d551ce01b0465b (diff) | |
download | CMake-3e52000a07cb71172bc0ff7223dbca6f793786b6.zip CMake-3e52000a07cb71172bc0ff7223dbca6f793786b6.tar.gz CMake-3e52000a07cb71172bc0ff7223dbca6f793786b6.tar.bz2 |
Fix cycle detection for test dependencies
Diffstat (limited to 'Source/CTest/cmCTestMultiProcessHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 4d39367..4d2a573 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -611,7 +611,7 @@ int cmCTestMultiProcessHandler::FindMaxIndex() //Returns true if no cycles exist in the dependency graph bool cmCTestMultiProcessHandler::CheckCycles() { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Checking test dependency graph..." << std::endl); for(TestMap::iterator it = this->Tests.begin(); it != this->Tests.end(); ++it) @@ -619,34 +619,29 @@ bool cmCTestMultiProcessHandler::CheckCycles() //DFS from each element to itself std::stack<int> s; std::vector<int> visited; + s.push(it->first); - visited.push_back(it->first); while(!s.empty()) { int test = s.top(); s.pop(); - + for(TestSet::iterator d = this->Tests[test].begin(); d != this->Tests[test].end(); ++d) { - s.push(*d); - for(std::vector<int>::iterator v = visited.begin(); - v != visited.end(); ++v) + if(std::find(visited.begin(), visited.end(), *d) != visited.end()) { - if(*v == *d) - { - //cycle exists - cmCTestLog(this->CTest, ERROR_MESSAGE, "Error: a cycle exists in " - "the test dependency graph for the test \"" - << this->Properties[*d]->Name << "\"." << std::endl - << "Please fix the cycle and run ctest again." << std::endl); - return false; - } + //cycle exists + cmCTestLog(this->CTest, ERROR_MESSAGE, "Error: a cycle exists in " + "the test dependency graph for the test \"" + << this->Properties[it->first]->Name << "\"." << std::endl + << "Please fix the cycle and run ctest again." << std::endl); + return false; } - visited.push_back(*d); + s.push(*d); } - visited.pop_back(); + visited.push_back(test); } } return true; |