RemoteLinux: Have an extra simple echo test

First test without additional complications through quoting.
Makes debugging easier.

Change-Id: I3ea1a0725474fed09204fda1219cbc535bd2ef7c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2023-03-31 12:28:54 +02:00
parent 9bdddd3df7
commit e094e738b0

View File

@@ -34,7 +34,7 @@ public:
QStringList commandsToTest() const; QStringList commandsToTest() const;
TaskItem echoTask() const; TaskItem echoTask(const QString &contents) const;
TaskItem unameTask() const; TaskItem unameTask() const;
TaskItem gathererTask() const; TaskItem gathererTask() const;
TaskItem transferTask(FileTransferMethod method, TaskItem transferTask(FileTransferMethod method,
@@ -50,8 +50,6 @@ public:
QList<TaskItem> m_extraTests; QList<TaskItem> m_extraTests;
}; };
static const char s_echoContents[] = "Hello Remote World!";
QStringList GenericLinuxDeviceTesterPrivate::commandsToTest() const QStringList GenericLinuxDeviceTesterPrivate::commandsToTest() const
{ {
static const QStringList s_commandsToTest = {"base64", static const QStringList s_commandsToTest = {"base64",
@@ -92,15 +90,15 @@ QStringList GenericLinuxDeviceTesterPrivate::commandsToTest() const
return commands; return commands;
} }
TaskItem GenericLinuxDeviceTesterPrivate::echoTask() const TaskItem GenericLinuxDeviceTesterPrivate::echoTask(const QString &contents) const
{ {
const auto setup = [this](QtcProcess &process) { const auto setup = [this, contents](QtcProcess &process) {
emit q->progressMessage(Tr::tr("Sending echo to device...")); emit q->progressMessage(Tr::tr("Sending echo to device..."));
process.setCommand({m_device->filePath("echo"), {s_echoContents}}); process.setCommand({m_device->filePath("echo"), {contents}});
}; };
const auto done = [this](const QtcProcess &process) { const auto done = [this, contents](const QtcProcess &process) {
const QString reply = Utils::chopIfEndsWith(process.cleanedStdOut(), '\n'); const QString reply = Utils::chopIfEndsWith(process.cleanedStdOut(), '\n');
if (reply != s_echoContents) if (reply != contents)
emit q->errorMessage(Tr::tr("Device replied to echo with unexpected contents: \"%1\"") emit q->errorMessage(Tr::tr("Device replied to echo with unexpected contents: \"%1\"")
.arg(reply) + '\n'); .arg(reply) + '\n');
else else
@@ -284,7 +282,8 @@ void GenericLinuxDeviceTester::testDevice(const IDevice::Ptr &deviceConfiguratio
}; };
QList<TaskItem> taskItems = { QList<TaskItem> taskItems = {
d->echoTask(), d->echoTask("Hello"), // No quoting necessary
d->echoTask("Hello Remote World!"), // Checks quoting, too.
d->unameTask(), d->unameTask(),
d->gathererTask(), d->gathererTask(),
d->transferTasks() d->transferTasks()