AutoTest: Ensure that testrunner can always return to not running state

Task-number: QTCREATORBUG-17226
Change-Id: I3ebba229ad8df4d59b550f7be3305bb8f14fb8b2
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2016-11-04 09:47:15 +01:00
parent 261cfb1c98
commit b171f3dfbc

View File

@@ -74,9 +74,10 @@ TestRunner::TestRunner(QObject *parent) :
connect(this, &TestRunner::requestStopTestRun,
&m_futureWatcher, &QFutureWatcher<TestResultPtr>::cancel);
connect(&m_futureWatcher, &QFutureWatcher<TestResultPtr>::canceled,
this, [this]() { emit testResultReady(TestResultPtr(new FaultyTestResult(
Result::MessageFatal,
tr("Test run canceled by user."))));
this, [this]() {
emit testResultReady(TestResultPtr(new FaultyTestResult(
Result::MessageFatal, tr("Test run canceled by user."))));
m_executingTests = false; // avoid being stuck if finished() signal won't get emitted
});
}
@@ -231,15 +232,12 @@ void TestRunner::prepareToRunTests(Mode mode)
if (!projectExplorerSettings.buildBeforeDeploy || mode == TestRunner::DebugWithoutDeploy
|| mode == TestRunner::RunWithoutDeploy) {
runOrDebugTests();
} else if (project->hasActiveBuildSettings()) {
buildProject(project);
} else {
if (project->hasActiveBuildSettings()) {
buildProject(project);
} else {
emit testResultReady(TestResultPtr(new FaultyTestResult(Result::MessageFatal,
tr("Project is not configured. Canceling test run."))));
onFinished();
return;
}
emit testResultReady(TestResultPtr(new FaultyTestResult(Result::MessageFatal,
tr("Project is not configured. Canceling test run."))));
onFinished();
}
}
@@ -368,6 +366,7 @@ void TestRunner::runOrDebugTests()
debugTests();
break;
default:
onFinished();
QTC_ASSERT(false, return); // unexpected run mode
}
}
@@ -380,6 +379,8 @@ void TestRunner::buildProject(ProjectExplorer::Project *project)
connect(buildManager, &ProjectExplorer::BuildManager::buildQueueFinished,
this, &TestRunner::buildFinished);
ProjectExplorer::ProjectExplorerPlugin::buildProject(project);
if (!buildManager->isBuilding())
buildFinished(false);
}
void TestRunner::buildFinished(bool success)