mirror of
https://github.com/reactos/CMake.git
synced 2025-01-19 01:42:18 +00:00
Merge topic 'test-handler-multimap'
1af67b19 cmCTestTestHandler: use multimap
This commit is contained in:
commit
d59010e47f
@ -797,8 +797,9 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
|
|||||||
|
|
||||||
// Prepare some maps to help us find setup and cleanup tests for
|
// Prepare some maps to help us find setup and cleanup tests for
|
||||||
// any given fixture
|
// any given fixture
|
||||||
typedef std::set<ListOfTests::const_iterator> TestIteratorSet;
|
typedef ListOfTests::const_iterator TestIterator;
|
||||||
typedef std::map<std::string, TestIteratorSet> FixtureDependencies;
|
typedef std::multimap<std::string, TestIterator> FixtureDependencies;
|
||||||
|
typedef FixtureDependencies::const_iterator FixtureDepsIterator;
|
||||||
FixtureDependencies fixtureSetups;
|
FixtureDependencies fixtureSetups;
|
||||||
FixtureDependencies fixtureDeps;
|
FixtureDependencies fixtureDeps;
|
||||||
|
|
||||||
@ -809,14 +810,14 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
|
|||||||
const std::set<std::string>& setups = p.FixturesSetup;
|
const std::set<std::string>& setups = p.FixturesSetup;
|
||||||
for (std::set<std::string>::const_iterator depsIt = setups.begin();
|
for (std::set<std::string>::const_iterator depsIt = setups.begin();
|
||||||
depsIt != setups.end(); ++depsIt) {
|
depsIt != setups.end(); ++depsIt) {
|
||||||
fixtureSetups[*depsIt].insert(it);
|
fixtureSetups.insert(std::make_pair(*depsIt, it));
|
||||||
fixtureDeps[*depsIt].insert(it);
|
fixtureDeps.insert(std::make_pair(*depsIt, it));
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::set<std::string>& cleanups = p.FixturesCleanup;
|
const std::set<std::string>& cleanups = p.FixturesCleanup;
|
||||||
for (std::set<std::string>::const_iterator depsIt = cleanups.begin();
|
for (std::set<std::string>::const_iterator depsIt = cleanups.begin();
|
||||||
depsIt != cleanups.end(); ++depsIt) {
|
depsIt != cleanups.end(); ++depsIt) {
|
||||||
fixtureDeps[*depsIt].insert(it);
|
fixtureDeps.insert(std::make_pair(*depsIt, it));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -859,19 +860,17 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
|
|||||||
// associated with the required fixture. If any of those setup
|
// associated with the required fixture. If any of those setup
|
||||||
// tests fail, this test should not run. We make the fixture's
|
// tests fail, this test should not run. We make the fixture's
|
||||||
// cleanup tests depend on this test case later.
|
// cleanup tests depend on this test case later.
|
||||||
FixtureDependencies::const_iterator setupIt =
|
std::pair<FixtureDepsIterator, FixtureDepsIterator> setupRange =
|
||||||
fixtureSetups.find(requiredFixtureName);
|
fixtureSetups.equal_range(requiredFixtureName);
|
||||||
if (setupIt != fixtureSetups.end()) {
|
for (FixtureDepsIterator sIt = setupRange.first;
|
||||||
for (TestIteratorSet::const_iterator sIt = setupIt->second.begin();
|
sIt != setupRange.second; ++sIt) {
|
||||||
sIt != setupIt->second.end(); ++sIt) {
|
const std::string& setupTestName = sIt->second->Name;
|
||||||
const std::string& setupTestName = (**sIt).Name;
|
|
||||||
tests[i].RequireSuccessDepends.insert(setupTestName);
|
tests[i].RequireSuccessDepends.insert(setupTestName);
|
||||||
if (std::find(tests[i].Depends.begin(), tests[i].Depends.end(),
|
if (std::find(tests[i].Depends.begin(), tests[i].Depends.end(),
|
||||||
setupTestName) == tests[i].Depends.end()) {
|
setupTestName) == tests[i].Depends.end()) {
|
||||||
tests[i].Depends.push_back(setupTestName);
|
tests[i].Depends.push_back(setupTestName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Append any fixture setup/cleanup tests to our test list if they
|
// Append any fixture setup/cleanup tests to our test list if they
|
||||||
// are not already in it (they could have been in the original
|
// are not already in it (they could have been in the original
|
||||||
@ -882,17 +881,11 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
|
|||||||
// Already added this fixture
|
// Already added this fixture
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
FixtureDependencies::const_iterator fixtureIt =
|
std::pair<FixtureDepsIterator, FixtureDepsIterator> fixtureRange =
|
||||||
fixtureDeps.find(requiredFixtureName);
|
fixtureDeps.equal_range(requiredFixtureName);
|
||||||
if (fixtureIt == fixtureDeps.end()) {
|
for (FixtureDepsIterator it = fixtureRange.first;
|
||||||
// No setup or cleanup tests for this fixture
|
it != fixtureRange.second; ++it) {
|
||||||
continue;
|
ListOfTests::const_iterator lotIt = it->second;
|
||||||
}
|
|
||||||
|
|
||||||
const TestIteratorSet& testIters = fixtureIt->second;
|
|
||||||
for (TestIteratorSet::const_iterator depsIt = testIters.begin();
|
|
||||||
depsIt != testIters.end(); ++depsIt) {
|
|
||||||
ListOfTests::const_iterator lotIt = *depsIt;
|
|
||||||
const cmCTestTestProperties& p = *lotIt;
|
const cmCTestTestProperties& p = *lotIt;
|
||||||
|
|
||||||
if (!addedTests.insert(p.Name).second) {
|
if (!addedTests.insert(p.Name).second) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user