From 86557203b3a33ad3ed927780f38eb0abc6f20c71 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 15 Jan 2021 08:24:25 +0100 Subject: [PATCH] AutoTest: Handle summary of Qt tests if possible When using plain text output of Qt and Quick tests we are able to correct possible mis-parsings of the output. These merely can happen if the test application produces output on stdout on its own which may interfere with the normal test output and confuses the parser. If XML output is used this handling is impossible as we do not get any summary, but interfering the output with user stuff would end up in a parse error and a fatal anyhow. Task-number: QTCREATORBUG-25112 Change-Id: I84f5e542aa3faeb6470963c784e92ed1b2584b61 Reviewed-by: David Schulz --- src/plugins/autotest/qtest/qttestoutputreader.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/plugins/autotest/qtest/qttestoutputreader.cpp b/src/plugins/autotest/qtest/qttestoutputreader.cpp index 32e9221bec7..843a1dd2adb 100644 --- a/src/plugins/autotest/qtest/qttestoutputreader.cpp +++ b/src/plugins/autotest/qtest/qttestoutputreader.cpp @@ -359,8 +359,8 @@ void QtTestOutputReader::processPlainTextOutput(const QByteArray &outputLine) static const QRegularExpression start("^[*]{9} Start testing of (.*) [*]{9}$"); static const QRegularExpression config("^Config: Using QtTest library (.*), " "(Qt (\\d+(\\.\\d+){2}) \\(.*\\))$"); - static const QRegularExpression summary("^Totals: \\d+ passed, \\d+ failed, " - "\\d+ skipped(, \\d+ blacklisted)?$"); + static const QRegularExpression summary("^Totals: (\\d+) passed, (\\d+) failed, " + "(\\d+) skipped(, (\\d+) blacklisted)?(, \\d+ms)?$"); static const QRegularExpression finish("^[*]{9} Finished testing of (.*) [*]{9}$"); static const QRegularExpression result("^(PASS |FAIL! |XFAIL |XPASS |SKIP |RESULT " @@ -397,7 +397,15 @@ void QtTestOutputReader::processPlainTextOutput(const QByteArray &outputLine) m_className = match.captured(1); QTC_CHECK(!m_className.isEmpty()); sendStartMessage(false); - } else if (summary.match(line).hasMatch() || finish.match(line).hasMatch()) { + } else if (hasMatch(summary)) { + m_summary[ResultType::Pass] = match.captured(1).toInt(); + m_summary[ResultType::Fail] = match.captured(2).toInt(); + m_summary[ResultType::Skip] = match.captured(3).toInt(); + // BlacklistedXYZ is wrong here, but we use it for convenience (avoids another enum value) + if (int blacklisted = match.captured(5).toInt()) + m_summary[ResultType::BlacklistedPass] = blacklisted; + processSummaryFinishOutput(); + } else if (finish.match(line).hasMatch()) { processSummaryFinishOutput(); } else { // we have some plain output, but we cannot say where for sure it belongs to.. if (!m_description.isEmpty())