aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2022-11-07 08:18:07 +0100
committerChristian Stenger <christian.stenger@qt.io>2022-11-07 13:13:47 +0000
commitf792dc0216fc1fdae1e9d4421ccb489cae2aac2f (patch)
tree559209b6d18eb9017b715252220fa7f65537759b
parentdc9cb0562afce3d794acef07ea35ad87cffa2464 (diff)
AutoTest: Fix Catch2 output handling
Handle warnings or explicit failures instead of ignoring them. Fixes: QTCREATORBUG-28394 Change-Id: I5ccde8e7b9dfa1118f42ea881b9152069616193f Reviewed-by: David Schulz <david.schulz@qt.io>
-rw-r--r--src/plugins/autotest/catch/catchoutputreader.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/plugins/autotest/catch/catchoutputreader.cpp b/src/plugins/autotest/catch/catchoutputreader.cpp
index 9ec3006ab7..3d79f683b7 100644
--- a/src/plugins/autotest/catch/catchoutputreader.cpp
+++ b/src/plugins/autotest/catch/catchoutputreader.cpp
@@ -18,6 +18,8 @@ namespace CatchXml {
const char TestCaseElement[] = "TestCase";
const char SectionElement[] = "Section";
const char ExceptionElement[] = "Exception";
+ const char WarningElement[] = "Warning";
+ const char FailureElement[] = "Failure";
const char ExpressionElement[] = "Expression";
const char ExpandedElement[] = "Expanded";
const char BenchmarkResults[] = "BenchmarkResults";
@@ -102,6 +104,11 @@ void CatchOutputReader::processOutputLine(const QByteArray &outputLineWithNewLin
m_currentResult = m_shouldFail ? ResultType::UnexpectedPass : ResultType::Pass;
else
m_currentResult = m_mayFail || m_shouldFail ? ResultType::ExpectedFail : ResultType::Fail;
+ } else if (m_currentTagName == CatchXml::WarningElement) {
+ m_currentResult = ResultType::MessageWarn;
+ } else if (m_currentTagName == CatchXml::FailureElement) {
+ m_currentResult = ResultType::Fail;
+ recordTestInformation(m_xmlReader.attributes());
} else if (m_currentTagName == CatchXml::BenchmarkResults) {
recordBenchmarkInformation(m_xmlReader.attributes());
m_currentResult = ResultType::Benchmark;
@@ -121,7 +128,9 @@ void CatchOutputReader::processOutputLine(const QByteArray &outputLineWithNewLin
const auto text = m_xmlReader.text();
if (m_currentTagName == CatchXml::ExpandedElement) {
m_currentExpression.append(text);
- } else if (m_currentTagName == CatchXml::ExceptionElement) {
+ } else if (m_currentTagName == CatchXml::ExceptionElement
+ || m_currentTagName == CatchXml::WarningElement
+ || m_currentTagName == CatchXml::FailureElement) {
m_currentExpression.append('\n').append(text.trimmed());
}
break;
@@ -138,10 +147,14 @@ void CatchOutputReader::processOutputLine(const QByteArray &outputLineWithNewLin
} else if (currentTag == QLatin1String(CatchXml::GroupElement)) {
testOutputNodeFinished(GroupNode);
} else if (currentTag == QLatin1String(CatchXml::ExpressionElement)
+ || currentTag == QLatin1String(CatchXml::FailureElement)
|| currentTag == QLatin1String(CatchXml::BenchmarkResults)) {
sendResult(m_currentResult);
m_currentExpression.clear();
m_testCaseInfo.pop();
+ } else if (currentTag == QLatin1String(CatchXml::WarningElement)) {
+ sendResult(m_currentResult);
+ m_currentExpression.clear();
}
break;
}
@@ -255,6 +268,8 @@ void CatchOutputReader::sendResult(const ResultType result)
.arg(catchResult->description()));
} else if (result == ResultType::Benchmark || result == ResultType::MessageFatal) {
catchResult->setDescription(m_currentExpression);
+ } else if (result == ResultType::MessageWarn) {
+ catchResult->setDescription(m_currentExpression.trimmed());
}
reportResult(catchResult);