diff options
author | Brad King <brad.king@kitware.com> | 2010-12-21 18:58:21 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2010-12-21 18:58:21 (GMT) |
commit | 7a7a2cbd318b56eaf1708dfba0b7d42fb6f179a1 (patch) | |
tree | a5048620728cdc1b067669b39bd3a494207f9020 /Source | |
parent | 451567cda315cc165fc34ee71c307b1fd7f13576 (diff) | |
parent | 1f7133cd61c88bbb60e5695312c91c7a3238a707 (diff) | |
download | CMake-7a7a2cbd318b56eaf1708dfba0b7d42fb6f179a1.zip CMake-7a7a2cbd318b56eaf1708dfba0b7d42fb6f179a1.tar.gz CMake-7a7a2cbd318b56eaf1708dfba0b7d42fb6f179a1.tar.bz2 |
Merge topic 'ctest-depend-cycle'
1f7133c CTest: Fix line-too-long style in DEPEND cycle error
f48d3bc CTest: Fix test DEPEND cycle detection
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 93c2963..94614cf 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -653,32 +653,37 @@ bool cmCTestMultiProcessHandler::CheckCycles() it != this->Tests.end(); ++it) { //DFS from each element to itself + int root = it->first; + std::set<int> visited; std::stack<int> s; - std::vector<int> visited; - - s.push(it->first); - + s.push(root); while(!s.empty()) { int test = s.top(); s.pop(); - - for(TestSet::iterator d = this->Tests[test].begin(); - d != this->Tests[test].end(); ++d) + if(visited.insert(test).second) { - if(std::find(visited.begin(), visited.end(), *d) != visited.end()) + for(TestSet::iterator d = this->Tests[test].begin(); + d != this->Tests[test].end(); ++d) { - //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; + if(*d == root) + { + //cycle exists + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Error: a cycle exists in the test dependency graph " + "for the test \"" << this->Properties[root]->Name << + "\".\nPlease fix the cycle and run ctest again.\n"); + return false; + } + else + { + s.push(*d); + } } - s.push(*d); } - visited.push_back(test); } } + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Checking test dependency graph end" << std::endl); return true; } |