forked from qt-creator/qt-creator
AutoTest: Delegate reporting crashes to output reader
Let the output reader report crashes of the test instead of just reporting crashes globally. This allows to reflect the crash also inside summary items to avoid having tests displayed as passed if no fail happened until the crash. Task-number: QTCREATORBUG-19565 Change-Id: Idd9fe28f7486cbb31b1aa6556530718a2278722f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -66,6 +66,14 @@ void TestOutputReader::processStdError(const QByteArray &output)
|
|||||||
qWarning() << "AutoTest.Run: Ignored plain output:" << output;
|
qWarning() << "AutoTest.Run: Ignored plain output:" << output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestOutputReader::reportCrash()
|
||||||
|
{
|
||||||
|
TestResultPtr result = createDefaultResult();
|
||||||
|
result->setDescription(tr("Test executable crashed."));
|
||||||
|
result->setResult(Result::MessageFatal);
|
||||||
|
m_futureInterface.reportResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
void TestOutputReader::reportResult(const TestResultPtr &result)
|
void TestOutputReader::reportResult(const TestResultPtr &result)
|
||||||
{
|
{
|
||||||
m_futureInterface.reportResult(result);
|
m_futureInterface.reportResult(result);
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ public:
|
|||||||
|
|
||||||
virtual void processOutput(const QByteArray &outputLine) = 0;
|
virtual void processOutput(const QByteArray &outputLine) = 0;
|
||||||
virtual void processStdError(const QByteArray &output);
|
virtual void processStdError(const QByteArray &output);
|
||||||
|
void reportCrash();
|
||||||
bool hadValidOutput() const { return m_hadValidOutput; }
|
bool hadValidOutput() const { return m_hadValidOutput; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
@@ -253,6 +253,7 @@ static void performTestRun(QFutureInterface<TestResultPtr> &futureInterface,
|
|||||||
+ rcInfo(testConfiguration))));
|
+ rcInfo(testConfiguration))));
|
||||||
}
|
}
|
||||||
if (testProcess.exitStatus() == QProcess::CrashExit) {
|
if (testProcess.exitStatus() == QProcess::CrashExit) {
|
||||||
|
outputReader->reportCrash();
|
||||||
futureInterface.reportResult(TestResultPtr(new FaultyTestResult(Result::MessageFatal,
|
futureInterface.reportResult(TestResultPtr(new FaultyTestResult(Result::MessageFatal,
|
||||||
TestRunner::tr("Test for project \"%1\" crashed.")
|
TestRunner::tr("Test for project \"%1\" crashed.")
|
||||||
.arg(testConfiguration->displayName()) + processInformation(testProcess)
|
.arg(testConfiguration->displayName()) + processInformation(testProcess)
|
||||||
|
|||||||
Reference in New Issue
Block a user