diff options
author | Christian Stenger <[email protected]> | 2018-06-21 10:36:50 +0200 |
---|---|---|
committer | Christian Stenger <[email protected]> | 2018-06-21 10:24:29 +0000 |
commit | 1b6a3fe49397ae91d95aa368d3eaadff1775d159 (patch) | |
tree | 03cd5eed1a3677b6754c601c858691a9256dad3e /src/plugins/autotest/testconfiguration.cpp | |
parent | 3568f23e7e09b222ae9ff7a6e7dfb7e75050c6c1 (diff) |
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 <[email protected]>
Reviewed-by: David Schulz <[email protected]>
Diffstat (limited to 'src/plugins/autotest/testconfiguration.cpp')
-rw-r--r-- | src/plugins/autotest/testconfiguration.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/plugins/autotest/testconfiguration.cpp b/src/plugins/autotest/testconfiguration.cpp index 7aafdd315c3..c4c020349f5 100644 --- a/src/plugins/autotest/testconfiguration.cpp +++ b/src/plugins/autotest/testconfiguration.cpp @@ -75,12 +75,14 @@ void TestConfiguration::completeTestInformation(ProjectExplorer::RunConfiguratio TestRunMode runMode) { QTC_ASSERT(rc, return); + QTC_ASSERT(m_project, return); + if (hasExecutable()) { qCDebug(LOG) << "Executable has been set already - not completing configuration again."; return; } Project *project = SessionManager::startupProject(); - if (!project) + if (!project || project != m_project) return; Target *target = project->activeTarget(); @@ -94,7 +96,6 @@ void TestConfiguration::completeTestInformation(ProjectExplorer::RunConfiguratio m_runnable = rc->runnable(); m_displayName = rc->displayName(); - m_project = rc->project(); const QString buildKey = rc->buildKey(); BuildTargetInfo targetInfo = target->applicationTargets().buildTargetInfo(buildKey); @@ -116,6 +117,7 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode) { QTC_ASSERT(!m_projectFile.isEmpty(), return); QTC_ASSERT(!m_buildTargets.isEmpty(), return); + QTC_ASSERT(m_project, return); if (m_origRunConfig) { qCDebug(LOG) << "Using run configuration specified by user or found by first call"; @@ -129,8 +131,10 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode) qCDebug(LOG) << "Failed to complete - using 'normal' way."; } Project *project = SessionManager::startupProject(); - if (!project) + if (!project || project != m_project) { + m_project = nullptr; return; + } Target *target = project->activeTarget(); if (!target) @@ -204,7 +208,6 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode) m_runnable = runnable; m_runnable.executable = currentExecutable; m_displayName = runConfig->displayName(); - m_project = project; if (runMode == TestRunMode::Debug || runMode == TestRunMode::DebugWithoutDeploy) m_runConfig = new TestRunConfiguration(runConfig->target(), this); break; @@ -224,7 +227,6 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode) if (isLocal(rc)) { // FIXME for now only Desktop support const Runnable runnable = rc->runnable(); m_runnable.environment = runnable.environment; - m_project = project; m_guessedConfiguration = true; m_guessedFrom = rc->displayName(); if (runMode == TestRunMode::Debug) |