2011-07-21 11:30:56 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
|
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2011-07-21 11:30:56 +02:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
2011-07-21 11:30:56 +02:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
#include "linuxdevicetester.h"
|
|
|
|
|
|
|
|
|
|
#include "linuxdeviceconfiguration.h"
|
2011-07-22 16:04:55 +02:00
|
|
|
#include "remotelinuxusedportsgatherer.h"
|
2011-07-21 11:30:56 +02:00
|
|
|
|
|
|
|
|
#include <utils/qtcassert.h>
|
2011-12-12 15:13:22 +01:00
|
|
|
#include <utils/ssh/sshremoteprocessrunner.h>
|
2011-07-21 11:30:56 +02:00
|
|
|
#include <utils/ssh/sshconnection.h>
|
2011-12-12 15:13:22 +01:00
|
|
|
#include <utils/ssh/sshconnectionmanager.h>
|
2011-07-21 11:30:56 +02:00
|
|
|
|
|
|
|
|
using namespace Utils;
|
|
|
|
|
|
|
|
|
|
namespace RemoteLinux {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2011-12-12 15:13:22 +01:00
|
|
|
class LinuxDeviceTesterPrivate
|
2011-07-21 11:30:56 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2011-12-12 15:13:22 +01:00
|
|
|
LinuxDeviceTesterPrivate()
|
|
|
|
|
{ }
|
2011-07-21 11:30:56 +02:00
|
|
|
|
2011-12-12 15:13:22 +01:00
|
|
|
QString headLine;
|
2011-07-21 11:30:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
|
|
|
|
|
using namespace Internal;
|
|
|
|
|
|
2011-12-12 15:13:22 +01:00
|
|
|
LinuxDeviceTester::LinuxDeviceTester(const QSharedPointer<const LinuxDeviceConfiguration> &deviceConfiguration,
|
|
|
|
|
const QString &headline, const QString &commandline) :
|
|
|
|
|
SimpleRunner(deviceConfiguration, commandline),
|
|
|
|
|
d(new LinuxDeviceTesterPrivate)
|
2011-07-21 11:30:56 +02:00
|
|
|
{
|
2011-12-12 15:13:22 +01:00
|
|
|
d->headLine = headline;
|
2011-07-21 11:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
2011-12-12 15:13:22 +01:00
|
|
|
LinuxDeviceTester::~LinuxDeviceTester()
|
2011-07-21 11:30:56 +02:00
|
|
|
{
|
2011-12-12 15:13:22 +01:00
|
|
|
delete d;
|
2011-07-21 11:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
2011-12-12 15:13:22 +01:00
|
|
|
QString LinuxDeviceTester::headLine() const
|
2011-07-21 11:30:56 +02:00
|
|
|
{
|
2011-12-12 15:13:22 +01:00
|
|
|
return d->headLine;
|
2011-07-21 11:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
2011-12-12 15:13:22 +01:00
|
|
|
int LinuxDeviceTester::processFinished(int exitStatus)
|
2011-07-21 11:30:56 +02:00
|
|
|
{
|
2011-12-12 15:13:22 +01:00
|
|
|
return SimpleRunner::processFinished(exitStatus) == 0 ? TestSuccess : TestFailure;
|
2011-07-21 11:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
2011-12-12 15:13:22 +01:00
|
|
|
AuthenticationTester::AuthenticationTester(const QSharedPointer<const LinuxDeviceConfiguration> &deviceConfiguration) :
|
|
|
|
|
LinuxDeviceTester(deviceConfiguration, tr("Checking authentication data..."),
|
|
|
|
|
QLatin1String("echo \"Success!\""))
|
2011-07-21 11:30:56 +02:00
|
|
|
{
|
2011-12-12 15:13:22 +01:00
|
|
|
SshConnectionManager::instance().forceNewConnection(sshParameters());
|
2011-07-21 11:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
2011-12-12 15:13:22 +01:00
|
|
|
void AuthenticationTester::handleStdOutput(const QByteArray &data)
|
2011-07-21 11:30:56 +02:00
|
|
|
{
|
2011-12-12 15:13:22 +01:00
|
|
|
m_authenticationSucceded = data.contains("Success!");
|
|
|
|
|
LinuxDeviceTester::handleStdOutput(data);
|
2011-07-21 11:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
2011-12-12 15:13:22 +01:00
|
|
|
int AuthenticationTester::processFinished(int exitStatus)
|
2011-07-21 11:30:56 +02:00
|
|
|
{
|
2011-12-12 15:13:22 +01:00
|
|
|
return LinuxDeviceTester::processFinished(exitStatus) == TestSuccess
|
|
|
|
|
&& m_authenticationSucceded ? TestSuccess : TestCriticalFailure;
|
2011-07-21 11:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
2011-12-12 15:13:22 +01:00
|
|
|
UsedPortsTester::UsedPortsTester(const QSharedPointer<const LinuxDeviceConfiguration> &deviceConfiguration) :
|
|
|
|
|
LinuxDeviceTester(deviceConfiguration, tr("Checking for available ports..."), QString()),
|
|
|
|
|
gatherer(new RemoteLinuxUsedPortsGatherer(deviceConfiguration))
|
2011-07-21 11:30:56 +02:00
|
|
|
{
|
2011-12-12 15:13:22 +01:00
|
|
|
connect(gatherer, SIGNAL(aboutToStart()), this, SIGNAL(aboutToStart()));
|
|
|
|
|
connect(gatherer, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString)));
|
|
|
|
|
connect(gatherer, SIGNAL(finished(int)), this, SIGNAL(finished(int)));
|
|
|
|
|
connect(gatherer, SIGNAL(progressMessage(QString)), this, SIGNAL(progressMessage(QString)));
|
|
|
|
|
connect(gatherer, SIGNAL(started()), this, SIGNAL(started()));
|
2011-07-21 11:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
2011-12-12 15:13:22 +01:00
|
|
|
UsedPortsTester::~UsedPortsTester()
|
2011-07-21 11:30:56 +02:00
|
|
|
{
|
2011-12-12 15:13:22 +01:00
|
|
|
delete gatherer;
|
2011-07-21 11:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
2011-12-12 15:13:22 +01:00
|
|
|
QString UsedPortsTester::commandLine() const
|
2011-07-21 11:30:56 +02:00
|
|
|
{
|
2011-12-12 15:13:22 +01:00
|
|
|
return gatherer->commandLine();
|
2011-07-21 11:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
2011-12-12 15:13:22 +01:00
|
|
|
void UsedPortsTester::run()
|
2011-07-21 11:30:56 +02:00
|
|
|
{
|
2011-12-12 15:13:22 +01:00
|
|
|
gatherer->run();
|
2011-07-21 11:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
2011-12-12 15:13:22 +01:00
|
|
|
void UsedPortsTester::cancel()
|
2011-07-21 11:30:56 +02:00
|
|
|
{
|
2011-12-12 15:13:22 +01:00
|
|
|
gatherer->cancel();
|
2011-07-21 11:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace RemoteLinux
|