From a2224881b46b88ab54d97773674c9f10d7181772 Mon Sep 17 00:00:00 2001 From: James McDonnell Date: Wed, 19 Dec 2018 16:28:52 -0500 Subject: [PATCH] Additional QNX compatibility checks cut, df and tail are required for the disk space deploy check. The QNX code creates PID files in /var/run. rm is used by the /var/run device test. The QNX Qt Creator code should be using it to to remove the .pid files that it creates. Currently, it does not do this. That'll be a separate fix. Change-Id: Ie6bbe480b10ad5ac6396e882c993b90c61dcfe70 Reviewed-by: Sami Nurmenniemi Reviewed-by: hjk --- src/plugins/qnx/qnxdevicetester.cpp | 36 +++++++++++++++++++++++++++++ src/plugins/qnx/qnxdevicetester.h | 3 +++ 2 files changed, 39 insertions(+) diff --git a/src/plugins/qnx/qnxdevicetester.cpp b/src/plugins/qnx/qnxdevicetester.cpp index cf5614e817c..a710210ce3b 100644 --- a/src/plugins/qnx/qnxdevicetester.cpp +++ b/src/plugins/qnx/qnxdevicetester.cpp @@ -54,6 +54,8 @@ QnxDeviceTester::QnxDeviceTester(QObject *parent) m_commandsToTest << QLatin1String("awk") << QLatin1String("cat") + << QLatin1String("cut") + << QLatin1String("df") << QLatin1String("grep") << QLatin1String("kill") << QLatin1String("netstat") @@ -61,8 +63,10 @@ QnxDeviceTester::QnxDeviceTester(QObject *parent) << QLatin1String("printf") << QLatin1String("ps") << QLatin1String("read") + << QLatin1String("rm") << QLatin1String("sed") << QLatin1String("sleep") + << QLatin1String("tail") << QLatin1String("uname"); } @@ -86,6 +90,7 @@ void QnxDeviceTester::stopTest() case GenericTest: m_genericTester->stopTest(); break; + case VarRunTest: case CommandsTest: m_processRunner->cancel(); break; @@ -105,6 +110,32 @@ void QnxDeviceTester::handleGenericTestFinished(TestResult result) return; } + m_state = VarRunTest; + emit progressMessage(tr("Checking that files can be created in /var/run...")); + m_processRunner->run(QStringLiteral("rm %1 > /dev/null 2>&1; echo ABC > %1 && rm %1") + .arg("/var/run/qtc_xxxx.pid") + .toLatin1(), + m_deviceConfiguration->sshParameters()); +} + +void QnxDeviceTester::handleVarRunProcessFinished(const QString &error) +{ + QTC_ASSERT(m_state == VarRunTest, return); + + if (error.isEmpty()) { + if (m_processRunner->processExitCode() == 0) { + emit progressMessage(tr("Files can be created in /var/run.") + QLatin1Char('\n')); + } else { + emit errorMessage(tr("Files cannot be created in /var/run.") + QLatin1Char('\n')); + m_result = TestFailure; + } + } else { + emit errorMessage(tr("An error occurred checking that" + " files can be created in /var/run.") + + QLatin1Char('\n')); + m_result = TestFailure; + } + m_state = CommandsTest; QnxDevice::ConstPtr qnxDevice = m_deviceConfiguration.dynamicCast(); @@ -115,6 +146,11 @@ void QnxDeviceTester::handleGenericTestFinished(TestResult result) void QnxDeviceTester::handleProcessFinished(const QString &error) { + if (m_state == VarRunTest) { + handleVarRunProcessFinished(error); + return; + } + QTC_ASSERT(m_state == CommandsTest, return); const QString command = m_commandsToTest[m_currentCommandIndex]; diff --git a/src/plugins/qnx/qnxdevicetester.h b/src/plugins/qnx/qnxdevicetester.h index c63ec13d75a..21c555e5381 100644 --- a/src/plugins/qnx/qnxdevicetester.h +++ b/src/plugins/qnx/qnxdevicetester.h @@ -53,6 +53,7 @@ private: enum State { Inactive, GenericTest, + VarRunTest, CommandsTest }; @@ -61,6 +62,8 @@ private: QStringList versionSpecificCommandsToTest(int versionNumber) const; + void handleVarRunProcessFinished(const QString &error); + RemoteLinux::GenericLinuxDeviceTester *m_genericTester; ProjectExplorer::IDevice::ConstPtr m_deviceConfiguration; ProjectExplorer::DeviceTester::TestResult m_result;