diff options
author | Tobias Hunger <tobias.hunger@nokia.com> | 2011-12-12 15:13:22 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@nokia.com> | 2011-12-21 15:44:39 +0100 |
commit | 34ed3f295be2a2c7dae156f86517236f5b07804d (patch) | |
tree | 41a2a01384cc7a251ac244446009828b07f0d4a8 /src/plugins/remotelinux/linuxdevicetester.h | |
parent | a92e38f47f7c54a0844e98e47d3a0f830b1c4c93 (diff) | |
download | qt-creator-34ed3f295be2a2c7dae156f86517236f5b07804d.tar.gz |
Remote Linux: Rework device testing
Allow for a set of tests to be defined. This simplifies the code for
the individual test to run and allows for a more flexible approach
to device testing.
MaddeDeviceTester is no longer needed due to that.
Change-Id: I77fd2d53246dec2d8c6b584d0c73cc1134d7f47d
Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
Diffstat (limited to 'src/plugins/remotelinux/linuxdevicetester.h')
-rw-r--r-- | src/plugins/remotelinux/linuxdevicetester.h | 76 |
1 files changed, 45 insertions, 31 deletions
diff --git a/src/plugins/remotelinux/linuxdevicetester.h b/src/plugins/remotelinux/linuxdevicetester.h index 1a469af806..7c1df21eae 100644 --- a/src/plugins/remotelinux/linuxdevicetester.h +++ b/src/plugins/remotelinux/linuxdevicetester.h @@ -34,65 +34,79 @@ #include "remotelinux_export.h" +#include "simplerunner.h" + +#include <utils/ssh/sshconnection.h> + #include <QtCore/QObject> #include <QtCore/QSharedPointer> QT_FORWARD_DECLARE_CLASS(QString) -namespace Utils { -class SshConnection; -} - namespace RemoteLinux { class LinuxDeviceConfiguration; +class RemoteLinuxUsedPortsGatherer; namespace Internal { -class GenericLinuxDeviceTesterPrivate; +class LinuxDeviceTesterPrivate; } // namespace Internal -class REMOTELINUX_EXPORT AbstractLinuxDeviceTester : public QObject +// ----------------------------------------------------------------------- +// LinuxDeviceTester: +// ----------------------------------------------------------------------- + +class REMOTELINUX_EXPORT LinuxDeviceTester : public SimpleRunner { Q_OBJECT - Q_DISABLE_COPY(AbstractLinuxDeviceTester) + public: - enum TestResult { TestSuccess, TestFailure }; + enum TestResult { TestSuccess = 0, TestFailure, TestCriticalFailure }; - virtual void testDevice(const QSharedPointer<const LinuxDeviceConfiguration> &deviceConfiguration) = 0; - virtual void stopTest() = 0; + LinuxDeviceTester(const QSharedPointer<const LinuxDeviceConfiguration> &deviceConfiguration, + const QString &headline, const QString &commandline); + ~LinuxDeviceTester(); -signals: - void progressMessage(const QString &message); - void errorMessage(const QString &message); - void finished(RemoteLinux::AbstractLinuxDeviceTester::TestResult result); + virtual QString headLine() const; protected: - explicit AbstractLinuxDeviceTester(QObject *parent = 0); -}; + int processFinished(int exitStatus); +private: + Internal::LinuxDeviceTesterPrivate *const d; +}; -class REMOTELINUX_EXPORT GenericLinuxDeviceTester : public AbstractLinuxDeviceTester +class REMOTELINUX_EXPORT AuthenticationTester : public LinuxDeviceTester { Q_OBJECT -public: - explicit GenericLinuxDeviceTester(QObject *parent = 0); - ~GenericLinuxDeviceTester(); - void testDevice(const QSharedPointer<const LinuxDeviceConfiguration> &deviceConfiguration); - void stopTest(); +public: + AuthenticationTester(const QSharedPointer<const LinuxDeviceConfiguration> &deviceConfiguration); - QSharedPointer<Utils::SshConnection> connection() const; +protected slots: + void handleStdOutput(const QByteArray &data); -private slots: - void handleConnected(); - void handleConnectionFailure(); - void handleProcessFinished(int exitStatus); - void handlePortsGatheringError(const QString &message); - void handlePortListReady(); +protected: + int processFinished(int exitStatus); private: - void setFinished(TestResult result); + bool m_authenticationSucceded; +}; + +class REMOTELINUX_EXPORT UsedPortsTester : public LinuxDeviceTester +{ + Q_OBJECT - Internal::GenericLinuxDeviceTesterPrivate * const d; +public: + UsedPortsTester(const QSharedPointer<const LinuxDeviceConfiguration> &deviceConfiguration); + ~UsedPortsTester(); + + QString commandLine() const; + + void run(); + void cancel(); + +private: + RemoteLinuxUsedPortsGatherer *const gatherer; }; } // namespace RemoteLinux |