forked from qt-creator/qt-creator
AutoTest: Fix handling cancellation for timeout
If the timeout triggered a cancellation of a test run the testrunner missed to inform the progress manager about this. This in turn resulted in a sticky progress widget which even could pile up with further progress widgets. Fix this by explicitly informing the progress manager of the cancellation. Change-Id: Ie19a1aa998e19f911cd0dd856008552baaffeb9b Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -217,24 +217,24 @@ void TestRunner::scheduleNext()
|
||||
void TestRunner::cancelCurrent(TestRunner::CancelReason reason)
|
||||
{
|
||||
m_canceled = true;
|
||||
if (reason == UserCanceled) {
|
||||
// when using the stop button we need to report, for progress bar this happens automatically
|
||||
if (m_fakeFutureInterface && !m_fakeFutureInterface->isCanceled())
|
||||
m_fakeFutureInterface->reportCanceled();
|
||||
} else if (reason == KitChanged) {
|
||||
if (m_fakeFutureInterface)
|
||||
m_fakeFutureInterface->reportCanceled();
|
||||
emit testResultReady(TestResultPtr(new FaultyTestResult(Result::MessageWarn,
|
||||
tr("Current kit has changed. Canceling test run."))));
|
||||
}
|
||||
|
||||
if (m_fakeFutureInterface)
|
||||
m_fakeFutureInterface->reportCanceled();
|
||||
|
||||
auto reportResult = [this](Result::Type type, const QString &detail){
|
||||
emit testResultReady(TestResultPtr(new FaultyTestResult(type, detail)));
|
||||
};
|
||||
|
||||
if (reason == KitChanged)
|
||||
reportResult(Result::MessageWarn, tr("Current kit has changed. Canceling test run."));
|
||||
else if (reason == Timeout)
|
||||
reportResult(Result::MessageFatal, tr("Test case canceled due to timeout.\nMaybe raise the timeout?"));
|
||||
|
||||
// if user or timeout cancels the current run ensure to kill the running process
|
||||
if (m_currentProcess && m_currentProcess->state() != QProcess::NotRunning) {
|
||||
m_currentProcess->kill();
|
||||
m_currentProcess->waitForFinished();
|
||||
}
|
||||
if (reason == Timeout) {
|
||||
emit testResultReady(TestResultPtr(new FaultyTestResult(Result::MessageFatal,
|
||||
tr("Test case canceled due to timeout.\nMaybe raise the timeout?"))));
|
||||
}
|
||||
}
|
||||
|
||||
void TestRunner::onProcessFinished()
|
||||
|
||||
Reference in New Issue
Block a user