forked from qt-creator/qt-creator
AutoTest: Improve Boost test results handling
This improves constructing the results tree and additionally fixes matching free functions to their respective test tree items. Change-Id: I79490507ba7a1934a7be010a00cb341374bf93ad Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -157,7 +157,11 @@ void BoostTestOutputReader::handleMessageMatch(const QRegularExpressionMatch &ma
|
|||||||
m_currentTest = match.captured(9);
|
m_currentTest = match.captured(9);
|
||||||
m_description = tr("Executing test case %1").arg(m_currentTest);
|
m_description = tr("Executing test case %1").arg(m_currentTest);
|
||||||
} else if (type == "suite") {
|
} else if (type == "suite") {
|
||||||
m_currentSuite = match.captured(9);
|
if (m_currentSuite.isEmpty())
|
||||||
|
m_currentSuite = match.captured(9);
|
||||||
|
else
|
||||||
|
m_currentSuite.append("/").append(match.captured(9));
|
||||||
|
m_currentTest.clear();
|
||||||
m_description = tr("Executing test suite %1").arg(m_currentSuite);
|
m_description = tr("Executing test suite %1").arg(m_currentSuite);
|
||||||
}
|
}
|
||||||
} else if (content.startsWith("Leaving")) {
|
} else if (content.startsWith("Leaving")) {
|
||||||
@@ -168,8 +172,18 @@ void BoostTestOutputReader::handleMessageMatch(const QRegularExpressionMatch &ma
|
|||||||
m_result = ResultType::TestEnd;
|
m_result = ResultType::TestEnd;
|
||||||
m_description = tr("Test execution took %1").arg(match.captured(12));
|
m_description = tr("Test execution took %1").arg(match.captured(12));
|
||||||
} else if (type == "suite") {
|
} else if (type == "suite") {
|
||||||
if (m_currentSuite != match.captured(11) && m_currentSuite.isEmpty())
|
if (!m_currentSuite.isEmpty()) {
|
||||||
|
int index = m_currentSuite.lastIndexOf('/');
|
||||||
|
if (QTC_GUARD(m_currentSuite.mid(index + 1) == match.captured(11))) {
|
||||||
|
if (index == -1)
|
||||||
|
m_currentSuite.clear();
|
||||||
|
else
|
||||||
|
m_currentSuite = m_currentSuite.left(index);
|
||||||
|
}
|
||||||
|
} else if (match.capturedLength(11)) { // FIXME remove this branch?
|
||||||
|
QTC_CHECK(false);
|
||||||
m_currentSuite = match.captured(11);
|
m_currentSuite = match.captured(11);
|
||||||
|
}
|
||||||
m_currentTest.clear();
|
m_currentTest.clear();
|
||||||
m_result = ResultType::TestEnd;
|
m_result = ResultType::TestEnd;
|
||||||
m_description = tr("Test suite execution took %1").arg(match.captured(12));
|
m_description = tr("Test suite execution took %1").arg(match.captured(12));
|
||||||
|
@@ -62,16 +62,27 @@ bool BoostTestResult::isDirectParentOf(const TestResult *other, bool *needsInter
|
|||||||
if (!TestResult::isDirectParentOf(other, needsIntermediate))
|
if (!TestResult::isDirectParentOf(other, needsIntermediate))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const BoostTestResult *boostOther = static_cast<const BoostTestResult *>(other);
|
if (result() != ResultType::TestStart)
|
||||||
|
|
||||||
if (m_testSuite != boostOther->m_testSuite)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (result() == ResultType::TestStart) {
|
bool weAreModule = (m_testCase.isEmpty() && m_testSuite.isEmpty());
|
||||||
if (!boostOther->m_testCase.isEmpty())
|
bool weAreSuite = (m_testCase.isEmpty() && !m_testSuite.isEmpty());
|
||||||
return boostOther->m_testSuite == m_testSuite && boostOther->result() != ResultType::TestStart;
|
bool weAreCase = (!m_testCase.isEmpty());
|
||||||
|
|
||||||
return boostOther->m_testCase == m_testCase;
|
const BoostTestResult *boostOther = static_cast<const BoostTestResult *>(other);
|
||||||
|
bool otherIsSuite = boostOther->m_testCase.isEmpty() && !boostOther->m_testSuite.isEmpty();
|
||||||
|
bool otherIsCase = !boostOther->m_testCase.isEmpty();
|
||||||
|
|
||||||
|
if (otherIsSuite)
|
||||||
|
return weAreSuite ? boostOther->m_testSuite.startsWith(m_testSuite + '/') : weAreModule;
|
||||||
|
|
||||||
|
if (otherIsCase) {
|
||||||
|
if (weAreCase)
|
||||||
|
return boostOther->m_testCase == m_testCase && boostOther->m_testSuite == m_testSuite;
|
||||||
|
if (weAreSuite)
|
||||||
|
return boostOther->m_testSuite == m_testSuite;
|
||||||
|
if (weAreModule)
|
||||||
|
return boostOther->m_testSuite.isEmpty();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user