1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// Copyright (C) 2016 BlackBerry Limited. All rights reserved.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qnxdevicetester.h"
#include "qnxconstants.h"
#include "qnxtr.h"
#include <utils/qtcprocess.h>
using namespace Utils;
namespace Qnx::Internal {
QnxDeviceTester::QnxDeviceTester(const ProjectExplorer::IDevice::Ptr &device, QObject *parent)
: RemoteLinux::GenericLinuxDeviceTester(device, parent)
{}
void QnxDeviceTester::testDevice()
{
static const QStringList commandsToTest {
"awk",
"cat",
"cut",
"df",
"grep",
"kill",
"netstat",
"mkdir",
"print",
"printf",
"pidin",
"read",
"rm",
"sed",
"sleep",
"tail",
"uname",
"slog2info"
};
setExtraCommandsToTest(commandsToTest);
using namespace Tasking;
auto onSetup = [device = device(), this](Process &process) {
emit progressMessage(Tr::tr("Checking that files can be created in %1...")
.arg(Constants::QNX_TMP_DIR));
const QString pidFile = QString("%1/qtc_xxxx.pid").arg(Constants::QNX_TMP_DIR);
const CommandLine cmd(device->filePath("/bin/sh"),
{"-c", QLatin1String("rm %1 > /dev/null 2>&1; echo ABC > %1 && rm %1").arg(pidFile)});
process.setCommand(cmd);
};
auto onDone = [this](const Process &process, DoneWith result) {
if (result == DoneWith::Success) {
emit progressMessage(Tr::tr("Files can be created in /var/run.") + '\n');
return;
}
const QString message = process.result() == ProcessResult::StartFailed
? Tr::tr("An error occurred while checking that files can be created in %1.")
.arg(Constants::QNX_TMP_DIR) + '\n' + process.errorString()
: Tr::tr("Files cannot be created in %1.").arg(Constants::QNX_TMP_DIR);
emit errorMessage(message + '\n');
};
setExtraTests({ProcessTask(onSetup, onDone, CallDoneIf::Success)});
RemoteLinux::GenericLinuxDeviceTester::testDevice();
}
} // Qnx::Internal
|