AutoTest: Improve handling of canceled test configurations

If a test configuration cannot be guessed correctly and the
user cancels the dialog to select the correct runnable we still
have no valid executable.
Deselect the respective configuration for the current test run
and avoid warnings regarding empty executable.

Change-Id: I843bf2844a5530be047c142805992a5fb79cbc19
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Christian Stenger
2017-09-28 13:46:22 +02:00
parent 7c94750d70
commit cff8dac2b8

View File

@@ -362,12 +362,24 @@ static bool askUserForRunConfiguration(TestConfiguration *config)
void TestRunner::runTests() void TestRunner::runTests()
{ {
QList<TestConfiguration *> toBeRemoved;
for (TestConfiguration *config : m_selectedTests) { for (TestConfiguration *config : m_selectedTests) {
config->completeTestInformation(TestRunMode::Run); config->completeTestInformation(TestRunMode::Run);
if (!config->hasExecutable()) if (!config->hasExecutable())
if (askUserForRunConfiguration(config)) if (!askUserForRunConfiguration(config))
config->completeTestInformation(config->originalRunConfiguration(), TestRunMode::Run); toBeRemoved.append(config);
} }
for (TestConfiguration *config : toBeRemoved)
m_selectedTests.removeOne(config);
qDeleteAll(toBeRemoved);
toBeRemoved.clear();
if (m_selectedTests.isEmpty()) {
emit testResultReady(TestResultPtr(new FaultyTestResult(Result::MessageWarn,
tr("No test cases left for execution. Canceling test run."))));
onFinished();
return;
}
QFuture<TestResultPtr> future = Utils::runAsync(&performTestRun, m_selectedTests, QFuture<TestResultPtr> future = Utils::runAsync(&performTestRun, m_selectedTests,
*AutotestPlugin::instance()->settings()); *AutotestPlugin::instance()->settings());
m_futureWatcher.setFuture(future); m_futureWatcher.setFuture(future);