forked from qt-creator/qt-creator
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:
@@ -362,12 +362,24 @@ static bool askUserForRunConfiguration(TestConfiguration *config)
|
||||
|
||||
void TestRunner::runTests()
|
||||
{
|
||||
QList<TestConfiguration *> 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<TestResultPtr> future = Utils::runAsync(&performTestRun, m_selectedTests,
|
||||
*AutotestPlugin::instance()->settings());
|
||||
m_futureWatcher.setFuture(future);
|
||||
|
Reference in New Issue
Block a user