RemoteLinux: Do not use a shared connection when running test

This will fail the !isDisconnected() check and bail out without
re-setting the disconnected status.

Also, make the m_useConnectionSharing value function local.
It's used at max once before retesting.

Change-Id: I16cb950db96c6829b599f2a0b361220f46a83b15
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2024-10-21 17:25:09 +02:00
parent 5a9630dff6
commit 17c3731389

View File

@@ -431,7 +431,6 @@ public:
QByteArray m_output; QByteArray m_output;
QByteArray m_error; QByteArray m_error;
bool m_pidParsed = false; bool m_pidParsed = false;
bool m_useConnectionSharing = false;
}; };
SshProcessInterface::SshProcessInterface(const IDevice::ConstPtr &device) SshProcessInterface::SshProcessInterface(const IDevice::ConstPtr &device)
@@ -689,13 +688,17 @@ void SshProcessInterfacePrivate::start()
return; return;
} }
m_useConnectionSharing = SshSettings::connectionSharingEnabled() && !q->m_setup.m_extraData.value(Constants::DisableSharing).toBool(); auto linuxDevice = std::dynamic_pointer_cast<const LinuxDevice>(m_device);
QTC_ASSERT(linuxDevice, handleDone(); return);
const bool useConnectionSharing = !linuxDevice->isDisconnected()
&& SshSettings::connectionSharingEnabled()
&& !q->m_setup.m_extraData.value(Constants::DisableSharing).toBool();
// TODO: Do we really need it for master process? // TODO: Do we really need it for master process?
m_sshParameters.x11DisplayName m_sshParameters.x11DisplayName
= q->m_setup.m_extraData.value("Ssh.X11ForwardToDisplay").toString(); = q->m_setup.m_extraData.value("Ssh.X11ForwardToDisplay").toString();
if (m_useConnectionSharing) { if (useConnectionSharing) {
m_connecting = true; m_connecting = true;
m_connectionHandle.reset(new SshConnectionHandle(m_device)); m_connectionHandle.reset(new SshConnectionHandle(m_device));
m_connectionHandle->setParent(this); m_connectionHandle->setParent(this);
@@ -703,16 +706,6 @@ void SshProcessInterfacePrivate::start()
this, &SshProcessInterfacePrivate::handleConnected); this, &SshProcessInterfacePrivate::handleConnected);
connect(m_connectionHandle.get(), &SshConnectionHandle::disconnected, connect(m_connectionHandle.get(), &SshConnectionHandle::disconnected,
this, &SshProcessInterfacePrivate::handleDisconnected); this, &SshProcessInterfacePrivate::handleDisconnected);
auto linuxDevice = std::dynamic_pointer_cast<const LinuxDevice>(m_device);
QTC_ASSERT(linuxDevice, handleDone(); return);
if (linuxDevice->isDisconnected()) {
emit q->done(
{-1,
QProcess::CrashExit,
QProcess::FailedToStart,
Tr::tr("Device \"%1\" is disconnected.").arg(linuxDevice->displayName())});
return;
}
linuxDevice->connectionAccess() linuxDevice->connectionAccess()
->attachToSharedConnection(m_connectionHandle.get(), m_sshParameters); ->attachToSharedConnection(m_connectionHandle.get(), m_sshParameters);
} else { } else {