summaryrefslogtreecommitdiff
path: root/tests/manual/ssh
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@theqtcompany.com>2015-06-29 10:56:15 +0200
committerChristian Kandeler <christian.kandeler@theqtcompany.com>2015-06-29 08:59:09 +0000
commit28e163de974d5bb2cec11cd98fa223def2170433 (patch)
tree1d95fa3e8dbb37144164c320e2c01a7cc2d802be /tests/manual/ssh
parent1ef9137c0d9594272d291112b3bb375711949165 (diff)
downloadqt-creator-28e163de974d5bb2cec11cd98fa223def2170433.tar.gz
SSH: Fix exit code of tests.
The test apps now return != 0 in case of an error. Change-Id: I2380bc4b8e0c85e68d79f90ccc39ad9419851b04 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Diffstat (limited to 'tests/manual/ssh')
-rw-r--r--tests/manual/ssh/errorhandling/main.cpp14
-rw-r--r--tests/manual/ssh/remoteprocess/remoteprocesstest.cpp36
2 files changed, 26 insertions, 24 deletions
diff --git a/tests/manual/ssh/errorhandling/main.cpp b/tests/manual/ssh/errorhandling/main.cpp
index 983617bcdc..f5fa4088b5 100644
--- a/tests/manual/ssh/errorhandling/main.cpp
+++ b/tests/manual/ssh/errorhandling/main.cpp
@@ -38,6 +38,8 @@
#include <QPair>
#include <QTimer>
+#include <cstdlib>
+
using namespace QSsh;
class Test : public QObject {
@@ -117,27 +119,27 @@ private slots:
void handleConnected()
{
qDebug("Error: Received unexpected connected() signal.");
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
}
void handleDisconnected()
{
qDebug("Error: Received unexpected disconnected() signal.");
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
}
void handleDataAvailable(const QString &msg)
{
qDebug("Error: Received unexpected dataAvailable() signal. "
"Message was: '%s'.", qPrintable(msg));
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
}
void handleError(QSsh::SshError error)
{
if (m_testSet.isEmpty()) {
qDebug("Error: Received error %d, but no test was running.", error);
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
}
const TestItem testItem = m_testSet.takeFirst();
@@ -151,7 +153,7 @@ private slots:
}
} else {
qDebug("Received unexpected error %d.", error);
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
}
}
@@ -159,7 +161,7 @@ private slots:
{
if (m_testSet.isEmpty()) {
qDebug("Error: timeout, but no test was running.");
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
}
const TestItem testItem = m_testSet.takeFirst();
qDebug("Error: The following test timed out: %s", testItem.description);
diff --git a/tests/manual/ssh/remoteprocess/remoteprocesstest.cpp b/tests/manual/ssh/remoteprocess/remoteprocesstest.cpp
index abe8a67091..5619edf242 100644
--- a/tests/manual/ssh/remoteprocess/remoteprocesstest.cpp
+++ b/tests/manual/ssh/remoteprocess/remoteprocesstest.cpp
@@ -82,14 +82,14 @@ void RemoteProcessTest::handleConnectionError()
? m_sshConnection->errorString() : m_remoteRunner->lastConnectionErrorString();
std::cerr << "Error: Connection failure (" << qPrintable(error) << ")." << std::endl;
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
}
void RemoteProcessTest::handleProcessStarted()
{
if (m_started) {
std::cerr << "Error: Received started() signal again." << std::endl;
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
} else {
m_started = true;
if (m_state == TestingCrash) {
@@ -109,11 +109,11 @@ void RemoteProcessTest::handleProcessStdout()
if (!m_started) {
std::cerr << "Error: Remote output from non-started process."
<< std::endl;
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
} else if (m_state != TestingSuccess && m_state != TestingTerminal) {
std::cerr << "Error: Got remote standard output in state " << m_state
<< "." << std::endl;
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
} else {
m_remoteStdout += m_remoteRunner->readAllStandardOutput();
}
@@ -124,11 +124,11 @@ void RemoteProcessTest::handleProcessStderr()
if (!m_started) {
std::cerr << "Error: Remote error output from non-started process."
<< std::endl;
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
} else if (m_state == TestingSuccess) {
std::cerr << "Error: Unexpected remote standard error output."
<< std::endl;
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
} else {
m_remoteStderr += m_remoteRunner->readAllStandardError();
}
@@ -140,7 +140,7 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
case SshRemoteProcess::NormalExit:
if (!m_started) {
std::cerr << "Error: Process exited without starting." << std::endl;
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
return;
}
switch (m_state) {
@@ -149,13 +149,13 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
if (exitCode != 0) {
std::cerr << "Error: exit code is " << exitCode
<< ", expected zero." << std::endl;
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
return;
}
if (m_remoteStdout.isEmpty()) {
std::cerr << "Error: Command did not produce output."
<< std::endl;
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
return;
}
@@ -171,12 +171,12 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
if (exitCode == 0) {
std::cerr << "Error: exit code is zero, expected non-zero."
<< std::endl;
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
return;
}
if (m_remoteStderr.isEmpty()) {
std::cerr << "Error: Command did not produce error output." << std::flush;
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
return;
}
@@ -191,7 +191,7 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
if (m_remoteRunner->processExitCode() == 0) {
std::cerr << "Error: Successful exit from process that was "
"supposed to crash." << std::endl;
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
} else {
// Some shells (e.g. mksh) don't report "killed", but just a non-zero exit code.
handleSuccessfulCrashTest();
@@ -202,13 +202,13 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
if (exitCode != 0) {
std::cerr << "Error: exit code is " << exitCode
<< ", expected zero." << std::endl;
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
return;
}
if (m_remoteStdout.isEmpty()) {
std::cerr << "Error: Command did not produce output."
<< std::endl;
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
return;
}
std::cout << "Ok.\nTesting I/O device functionality... " << std::flush;
@@ -256,7 +256,7 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
} else {
std::cerr << "Error: Process failed to start." << std::endl;
}
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
break;
case SshRemoteProcess::CrashExit:
switch (m_state) {
@@ -268,7 +268,7 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
break;
default:
std::cerr << "Error: Unexpected crash." << std::endl;
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
return;
}
}
@@ -277,7 +277,7 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
void RemoteProcessTest::handleTimeout()
{
std::cerr << "Error: Timeout waiting for progress." << std::endl;
- qApp->quit();
+ qApp->exit(EXIT_FAILURE);
}
void RemoteProcessTest::handleConnected()
@@ -305,7 +305,7 @@ void RemoteProcessTest::handleReadyRead()
if (data != testString()) {
std::cerr << "Testing of QIODevice functionality failed: Expected '"
<< qPrintable(testString()) << "', got '" << qPrintable(data) << "'." << std::endl;
- qApp->exit(1);
+ qApp->exit(EXIT_FAILURE);
}
SshRemoteProcessRunner * const killer = new SshRemoteProcessRunner(this);
killer->run("pkill -9 cat", m_sshParams);