From cff8dac2b8a27438b2bf12f4f6f5c00b80455884 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 28 Sep 2017 13:46:22 +0200 Subject: [PATCH] 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 Reviewed-by: Oliver Wolff --- src/plugins/autotest/testrunner.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp index 81bc2c7451d..9fa78e0547d 100644 --- a/src/plugins/autotest/testrunner.cpp +++ b/src/plugins/autotest/testrunner.cpp @@ -362,12 +362,24 @@ static bool askUserForRunConfiguration(TestConfiguration *config) void TestRunner::runTests() { + QList toBeRemoved; for (TestConfiguration *config : m_selectedTests) { config->completeTestInformation(TestRunMode::Run); if (!config->hasExecutable()) - if (askUserForRunConfiguration(config)) - config->completeTestInformation(config->originalRunConfiguration(), TestRunMode::Run); + if (!askUserForRunConfiguration(config)) + 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 future = Utils::runAsync(&performTestRun, m_selectedTests, *AutotestPlugin::instance()->settings()); m_futureWatcher.setFuture(future);