Qnx: DeviceTester code cosmetics

Change-Id: I77463ecde1c64333de35b33773f3eacf275f983f
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2023-03-14 16:38:02 +01:00
parent 7a2dbace9b
commit 4d325522e0
2 changed files with 9 additions and 13 deletions

View File

@@ -33,7 +33,7 @@ static QStringList versionSpecificCommandsToTest(int versionNumber)
return {}; return {};
} }
void QnxDeviceTester::testDevice(const ProjectExplorer::IDevice::Ptr &deviceConfiguration) void QnxDeviceTester::testDevice(const ProjectExplorer::IDevice::Ptr &device)
{ {
static const QStringList s_commandsToTest = {"awk", static const QStringList s_commandsToTest = {"awk",
"cat", "cat",
@@ -52,8 +52,8 @@ void QnxDeviceTester::testDevice(const ProjectExplorer::IDevice::Ptr &deviceConf
"sleep", "sleep",
"tail", "tail",
"uname"}; "uname"};
m_deviceConfiguration = deviceConfiguration; m_device = device;
QnxDevice::ConstPtr qnxDevice = m_deviceConfiguration.dynamicCast<const QnxDevice>(); QnxDevice::ConstPtr qnxDevice = m_device.dynamicCast<const QnxDevice>();
m_genericTester->setExtraCommandsToTest( m_genericTester->setExtraCommandsToTest(
s_commandsToTest + versionSpecificCommandsToTest(qnxDevice->qnxVersion())); s_commandsToTest + versionSpecificCommandsToTest(qnxDevice->qnxVersion()));
@@ -63,7 +63,7 @@ void QnxDeviceTester::testDevice(const ProjectExplorer::IDevice::Ptr &deviceConf
emit progressMessage(Tr::tr("Checking that files can be created in %1...") emit progressMessage(Tr::tr("Checking that files can be created in %1...")
.arg(Constants::QNX_TMP_DIR)); .arg(Constants::QNX_TMP_DIR));
const QString pidFile = QString("%1/qtc_xxxx.pid").arg(Constants::QNX_TMP_DIR); const QString pidFile = QString("%1/qtc_xxxx.pid").arg(Constants::QNX_TMP_DIR);
const CommandLine cmd(m_deviceConfiguration->filePath("/bin/sh"), const CommandLine cmd(m_device->filePath("/bin/sh"),
{"-c", QLatin1String("rm %1 > /dev/null 2>&1; echo ABC > %1 && rm %1").arg(pidFile)}); {"-c", QLatin1String("rm %1 > /dev/null 2>&1; echo ABC > %1 && rm %1").arg(pidFile)});
process.setCommand(cmd); process.setCommand(cmd);
}; };
@@ -79,7 +79,7 @@ void QnxDeviceTester::testDevice(const ProjectExplorer::IDevice::Ptr &deviceConf
}; };
m_genericTester->setExtraTests({Process(setupHandler, doneHandler, errorHandler)}); m_genericTester->setExtraTests({Process(setupHandler, doneHandler, errorHandler)});
m_genericTester->testDevice(deviceConfiguration); m_genericTester->testDevice(device);
} }
void QnxDeviceTester::stopTest() void QnxDeviceTester::stopTest()

View File

@@ -5,23 +5,19 @@
#include <remotelinux/linuxdevicetester.h> #include <remotelinux/linuxdevicetester.h>
namespace Qnx { namespace Qnx::Internal {
namespace Internal {
class QnxDeviceTester : public ProjectExplorer::DeviceTester class QnxDeviceTester : public ProjectExplorer::DeviceTester
{ {
Q_OBJECT
public: public:
explicit QnxDeviceTester(QObject *parent = nullptr); explicit QnxDeviceTester(QObject *parent = nullptr);
void testDevice(const ProjectExplorer::IDevice::Ptr &deviceConfiguration) override; void testDevice(const ProjectExplorer::IDevice::Ptr &device) override;
void stopTest() override; void stopTest() override;
private: private:
RemoteLinux::GenericLinuxDeviceTester *m_genericTester = nullptr; RemoteLinux::GenericLinuxDeviceTester *m_genericTester = nullptr;
ProjectExplorer::IDevice::ConstPtr m_deviceConfiguration; ProjectExplorer::IDevice::ConstPtr m_device;
}; };
} // namespace Internal } // Qnx::Internal
} // namespace Qnx