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 <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2021-01-15 08:24:25 +01:00
parent 3f7fd1383e
commit 86557203b3

View File

@@ -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())