AutoTest: Fix handling of test runs when project changes

If the startup project or the current active target changes
while tests are running strange things can happen as we rely
on these both being unchanged from triggering the run.
Explicitly check for these being unchanged and cancel the
test run if necessary.

Change-Id: I506c7b1c0ca4b6ea31559556f6141fe9276d0ad0
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2018-06-21 10:36:50 +02:00
parent 3568f23e7e
commit 1b6a3fe493
3 changed files with 42 additions and 10 deletions

View File

@@ -54,7 +54,7 @@ class AUTOTESTSHARED_EXPORT TestRunner : public QObject
Q_OBJECT
public:
enum CancelReason { UserCanceled, Timeout };
enum CancelReason { UserCanceled, Timeout, KitChanged };
static TestRunner* instance();
~TestRunner();
@@ -91,6 +91,7 @@ private:
QFutureInterface<TestResultPtr> *m_fakeFutureInterface = nullptr;
QQueue<TestConfiguration *> m_selectedTests;
bool m_executingTests = false;
bool m_canceled = false;
TestConfiguration *m_currentConfig = nullptr;
QProcess *m_currentProcess = nullptr;
TestOutputReader *m_currentOutputReader = nullptr;
@@ -98,6 +99,8 @@ private:
// temporarily used if building before running is necessary
QMetaObject::Connection m_buildConnect;
// temporarily used for handling of switching the current target
QMetaObject::Connection m_targetConnect;
};
class RunConfigurationSelectionDialog : public QDialog