diff --git a/tests/manual/ssh/errorhandling/main.cpp b/tests/manual/ssh/errorhandling/main.cpp index 6f5bf30f92d..b999877f2c9 100644 --- a/tests/manual/ssh/errorhandling/main.cpp +++ b/tests/manual/ssh/errorhandling/main.cpp @@ -48,7 +48,7 @@ public: Test() { m_timeoutTimer.setSingleShot(true); - m_connection = SshConnection::create(SshConnectionParameters(SshConnectionParameters::DefaultProxy)); + m_connection = SshConnection::create(SshConnectionParameters()); if (m_connection->state() != SshConnection::Unconnected) { qDebug("Error: Newly created SSH connection has state %d.", m_connection->state()); @@ -59,13 +59,13 @@ public: if (m_connection->createSftpChannel()) qDebug("Error: Unconnected SSH connection creates SFTP channel."); - SshConnectionParameters noHost = SshConnectionParameters(SshConnectionParameters::DefaultProxy); + SshConnectionParameters noHost; noHost.host = QLatin1String("hgdfxgfhgxfhxgfchxgcf"); noHost.port = 12345; noHost.timeout = 10; noHost.authenticationType = SshConnectionParameters::AuthenticationByPassword; - SshConnectionParameters noUser = SshConnectionParameters(SshConnectionParameters::DefaultProxy); + SshConnectionParameters noUser; noUser.host = QLatin1String("localhost"); noUser.port = 22; noUser.timeout = 30; @@ -73,7 +73,7 @@ public: noUser.userName = QLatin1String("dumdidumpuffpuff"); noUser.password = QLatin1String("whatever"); - SshConnectionParameters wrongPwd = SshConnectionParameters(SshConnectionParameters::DefaultProxy); + SshConnectionParameters wrongPwd; wrongPwd.host = QLatin1String("localhost"); wrongPwd.port = 22; wrongPwd.timeout = 30; @@ -81,7 +81,7 @@ public: wrongPwd.userName = QLatin1String("root"); noUser.password = QLatin1String("thiscantpossiblybeapasswordcanit"); - SshConnectionParameters invalidKeyFile = SshConnectionParameters(SshConnectionParameters::DefaultProxy); + SshConnectionParameters invalidKeyFile; invalidKeyFile.host = QLatin1String("localhost"); invalidKeyFile.port = 22; invalidKeyFile.timeout = 30; diff --git a/tests/manual/ssh/remoteprocess/argumentscollector.cpp b/tests/manual/ssh/remoteprocess/argumentscollector.cpp index 72bffae677c..64cc0ef883e 100644 --- a/tests/manual/ssh/remoteprocess/argumentscollector.cpp +++ b/tests/manual/ssh/remoteprocess/argumentscollector.cpp @@ -46,7 +46,7 @@ ArgumentsCollector::ArgumentsCollector(const QStringList &args) Utils::SshConnectionParameters ArgumentsCollector::collect(bool &success) const { - SshConnectionParameters parameters(Utils::SshConnectionParameters::NoProxy); + SshConnectionParameters parameters; try { bool authTypeGiven = false; bool portGiven = false; diff --git a/tests/manual/ssh/remoteprocess/remoteprocesstest.cpp b/tests/manual/ssh/remoteprocess/remoteprocesstest.cpp index 4abe56927f6..47eaaee77b6 100644 --- a/tests/manual/ssh/remoteprocess/remoteprocesstest.cpp +++ b/tests/manual/ssh/remoteprocess/remoteprocesstest.cpp @@ -185,13 +185,18 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus) m_state = TestingCrash; m_started = false; m_timeoutTimer->start(); - m_remoteRunner->run("sleep 100", m_sshParams); + m_remoteRunner->run("/bin/sleep 100", m_sshParams); break; } case TestingCrash: - std::cerr << "Error: Successful exit from process that was " - "supposed to crash." << std::endl; - qApp->quit(); + if (m_remoteRunner->processExitCode() == 0) { + std::cerr << "Error: Successful exit from process that was " + "supposed to crash." << std::endl; + qApp->quit(); + } else { + // Some shells (e.g. mksh) don't report "killed", but just a non-zero exit code. + handleSuccessfulCrashTest(); + } break; case TestingTerminal: { const int exitCode = m_remoteRunner->processExitCode(); @@ -218,9 +223,13 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus) break; } case TestingIoDevice: - std::cerr << "Error: Successful exit from process that was supposed to crash." - << std::endl; - qApp->exit(EXIT_FAILURE); + if (m_catProcess->exitCode() == 0) { + std::cerr << "Error: Successful exit from process that was supposed to crash." + << std::endl; + qApp->exit(EXIT_FAILURE); + } else { + handleSuccessfulIoTest(); + } break; case TestingProcessChannels: if (m_remoteStderr.isEmpty()) { @@ -253,26 +262,10 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus) case SshRemoteProcess::KilledBySignal: switch (m_state) { case TestingCrash: - std::cout << "Ok.\nTesting remote process with terminal... " << std::flush; - m_state = TestingTerminal; - m_started = false; - m_timeoutTimer->start(); - m_remoteRunner->runInTerminal("top -n 1", SshPseudoTerminal(), m_sshParams); + handleSuccessfulCrashTest(); break; case TestingIoDevice: - std::cout << "Ok\nTesting process channels... " << std::flush; - m_state = TestingProcessChannels; - m_started = false; - m_remoteStderr.clear(); - m_echoProcess = m_sshConnection->createRemoteProcess("printf " + StderrOutput + " >&2"); - m_echoProcess->setReadChannel(QProcess::StandardError); - connect(m_echoProcess.data(), SIGNAL(started()), SLOT(handleProcessStarted())); - connect(m_echoProcess.data(), SIGNAL(closed(int)), SLOT(handleProcessClosed(int))); - connect(m_echoProcess.data(), SIGNAL(readyRead()), SLOT(handleReadyRead())); - connect(m_echoProcess.data(), SIGNAL(readyReadStandardError()), - SLOT(handleReadyReadStderr())); - m_echoProcess->start(); - m_timeoutTimer->start(); + handleSuccessfulIoTest(); break; default: std::cerr << "Error: Unexpected crash." << std::endl; @@ -292,7 +285,7 @@ void RemoteProcessTest::handleConnected() { Q_ASSERT(m_state == TestingIoDevice); - m_catProcess = m_sshConnection->createRemoteProcess(QString::fromLocal8Bit("cat").toUtf8()); + m_catProcess = m_sshConnection->createRemoteProcess(QString::fromLocal8Bit("/bin/cat").toUtf8()); connect(m_catProcess.data(), SIGNAL(started()), SLOT(handleProcessStarted())); connect(m_catProcess.data(), SIGNAL(closed(int)), SLOT(handleProcessClosed(int))); m_started = false; @@ -302,7 +295,7 @@ void RemoteProcessTest::handleConnected() QString RemoteProcessTest::testString() const { - return QLatin1String("x"); + return QLatin1String("x\r\n"); } void RemoteProcessTest::handleReadyRead() @@ -342,3 +335,29 @@ void RemoteProcessTest::handleReadyReadStderr() m_remoteStderr = "dummy"; } + +void RemoteProcessTest::handleSuccessfulCrashTest() +{ + std::cout << "Ok.\nTesting remote process with terminal... " << std::flush; + m_state = TestingTerminal; + m_started = false; + m_timeoutTimer->start(); + m_remoteRunner->runInTerminal("top -n 1", SshPseudoTerminal(), m_sshParams); +} + +void RemoteProcessTest::handleSuccessfulIoTest() +{ + std::cout << "Ok\nTesting process channels... " << std::flush; + m_state = TestingProcessChannels; + m_started = false; + m_remoteStderr.clear(); + m_echoProcess = m_sshConnection->createRemoteProcess("printf " + StderrOutput + " >&2"); + m_echoProcess->setReadChannel(QProcess::StandardError); + connect(m_echoProcess.data(), SIGNAL(started()), SLOT(handleProcessStarted())); + connect(m_echoProcess.data(), SIGNAL(closed(int)), SLOT(handleProcessClosed(int))); + connect(m_echoProcess.data(), SIGNAL(readyRead()), SLOT(handleReadyRead())); + connect(m_echoProcess.data(), SIGNAL(readyReadStandardError()), + SLOT(handleReadyReadStderr())); + m_echoProcess->start(); + m_timeoutTimer->start(); +} diff --git a/tests/manual/ssh/remoteprocess/remoteprocesstest.h b/tests/manual/ssh/remoteprocess/remoteprocesstest.h index f1236a3f0e3..e203eaea637 100644 --- a/tests/manual/ssh/remoteprocess/remoteprocesstest.h +++ b/tests/manual/ssh/remoteprocess/remoteprocesstest.h @@ -67,6 +67,8 @@ private: }; QString testString() const; + void handleSuccessfulCrashTest(); + void handleSuccessfulIoTest(); const Utils::SshConnectionParameters m_sshParams; QTimer * const m_timeoutTimer; diff --git a/tests/manual/ssh/sftp/parameters.h b/tests/manual/ssh/sftp/parameters.h index 03205bdb48c..81b473239c6 100644 --- a/tests/manual/ssh/sftp/parameters.h +++ b/tests/manual/ssh/sftp/parameters.h @@ -36,8 +36,6 @@ #include struct Parameters { - Parameters() : sshParams(Utils::SshConnectionParameters::DefaultProxy) {} - Utils::SshConnectionParameters sshParams; int smallFileCount; int bigFileSize; diff --git a/tests/manual/ssh/sftpfsmodel/window.cpp b/tests/manual/ssh/sftpfsmodel/window.cpp index bb8bb7816da..d3ca3dccda7 100644 --- a/tests/manual/ssh/sftpfsmodel/window.cpp +++ b/tests/manual/ssh/sftpfsmodel/window.cpp @@ -62,7 +62,7 @@ SftpFsWindow::~SftpFsWindow() void SftpFsWindow::connectToHost() { m_ui->connectButton->setEnabled(false); - SshConnectionParameters sshParams(SshConnectionParameters::NoProxy); + SshConnectionParameters sshParams; sshParams.host = m_ui->hostLineEdit->text(); sshParams.userName = m_ui->userLineEdit->text(); sshParams.authenticationType = SshConnectionParameters::AuthenticationByPassword;