forked from qt-creator/qt-creator
AutoTest: Handle test crashes inside ctest appropriate
If a ctest run fails to start the test application it will provide some hints we ignored for the visual output, which ended up in no result for this test. Change-Id: Id90c4855163c742484f55f7b422a6f307e7fd861 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -84,6 +84,8 @@ void CTestOutputReader::processOutputLine(const QByteArray &outputLine)
|
|||||||
static const QRegularExpression testResult("^\\s*\\d+/\\d+ Test\\s+#\\d+: (.*) (\\.+)\\s*"
|
static const QRegularExpression testResult("^\\s*\\d+/\\d+ Test\\s+#\\d+: (.*) (\\.+)\\s*"
|
||||||
"(Passed|\\*\\*\\*Failed|\\*\\*\\*Not Run|"
|
"(Passed|\\*\\*\\*Failed|\\*\\*\\*Not Run|"
|
||||||
".*\\*\\*\\*Exception:.*)\\s+(.*) sec$");
|
".*\\*\\*\\*Exception:.*)\\s+(.*) sec$");
|
||||||
|
static const QRegularExpression testCrash("^\\s*\\d+/\\d+ Test\\s+#\\d+: (.*) (\\.+)\\s*"
|
||||||
|
"Exit code .*$");
|
||||||
static const QRegularExpression summary("^\\d+% tests passed, (\\d+) tests failed "
|
static const QRegularExpression summary("^\\d+% tests passed, (\\d+) tests failed "
|
||||||
"out of (\\d+)");
|
"out of (\\d+)");
|
||||||
static const QRegularExpression summaryTime("^Total Test time .* =\\s+(.*) sec$");
|
static const QRegularExpression summaryTime("^Total Test time .* =\\s+(.*) sec$");
|
||||||
@@ -137,10 +139,19 @@ void CTestOutputReader::processOutputLine(const QByteArray &outputLine)
|
|||||||
testResult->setResult(ResultType::TestEnd);
|
testResult->setResult(ResultType::TestEnd);
|
||||||
testResult->setDescription(match.captured());
|
testResult->setDescription(match.captured());
|
||||||
reportResult(testResult);
|
reportResult(testResult);
|
||||||
|
} else if (ExactMatch match = testCrash.match(line)) {
|
||||||
|
m_description = match.captured();
|
||||||
|
m_testName = match.captured(1);
|
||||||
|
m_result = ResultType::Fail;
|
||||||
|
m_expectExceptionFromCrash = true;
|
||||||
} else {
|
} else {
|
||||||
if (!m_description.isEmpty())
|
if (!m_description.isEmpty())
|
||||||
m_description.append('\n');
|
m_description.append('\n');
|
||||||
m_description.append(line);
|
m_description.append(line);
|
||||||
|
if (m_expectExceptionFromCrash) {
|
||||||
|
if (QTC_GUARD(line.startsWith("***Exception:")))
|
||||||
|
m_expectExceptionFromCrash = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -46,6 +46,7 @@ protected:
|
|||||||
QString m_testName;
|
QString m_testName;
|
||||||
QString m_description;
|
QString m_description;
|
||||||
ResultType m_result = ResultType::Invalid;
|
ResultType m_result = ResultType::Invalid;
|
||||||
|
bool m_expectExceptionFromCrash = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user