GoCmdBridge: Add some hint related to the remote device to debug output

Also, some timing.

Change-Id: Iab8a1c141a6f7ee79ca245982452fb10a35afb31
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2024-10-11 10:43:24 +02:00
parent 0fefc7886a
commit d5891c7d2e

View File

@@ -65,7 +65,13 @@ Result FileAccess::deployAndInit(const FilePath &libExecPath, const FilePath &re
if (!whichDD) // TODO: Support Windows? if (!whichDD) // TODO: Support Windows?
return Result::Error(Tr::tr("Could not find dd on remote host: %1").arg(whichDD.error())); return Result::Error(Tr::tr("Could not find dd on remote host: %1").arg(whichDD.error()));
qCDebug(faLog) << "Found dd on remote host:" << *whichDD; QElapsedTimer timer;
timer.start();
auto deco = [&] {
return QString("%1 (%2 ms)").arg(remoteRootPath.host()).arg(timer.elapsed());
};
qCDebug(faLog) << deco() << "Found dd on remote host:" << *whichDD;
const expected_str<QString> unameOs = run({remoteRootPath.withNewPath("uname"), {"-s"}}); const expected_str<QString> unameOs = run({remoteRootPath.withNewPath("uname"), {"-s"}});
if (!unameOs) { if (!unameOs) {
@@ -76,7 +82,7 @@ Result FileAccess::deployAndInit(const FilePath &libExecPath, const FilePath &re
if (!osType) if (!osType)
return Result::Error(osType.error()); return Result::Error(osType.error());
qCDebug(faLog) << "Remote host OS:" << *unameOs; qCDebug(faLog) << deco() << "Remote host OS:" << *unameOs;
const expected_str<QString> unameArch = run({remoteRootPath.withNewPath("uname"), {"-m"}}); const expected_str<QString> unameArch = run({remoteRootPath.withNewPath("uname"), {"-m"}});
if (!unameArch) { if (!unameArch) {
@@ -88,7 +94,7 @@ Result FileAccess::deployAndInit(const FilePath &libExecPath, const FilePath &re
if (!osArch) if (!osArch)
return Result::Error(osArch.error()); return Result::Error(osArch.error());
qCDebug(faLog) << "Remote host architecture:" << *unameArch; qCDebug(faLog) << deco() << "Remote host architecture:" << *unameArch;
const Utils::expected_str<Utils::FilePath> cmdBridgePath const Utils::expected_str<Utils::FilePath> cmdBridgePath
= Client::getCmdBridgePath(*osType, *osArch, libExecPath); = Client::getCmdBridgePath(*osType, *osArch, libExecPath);
@@ -99,7 +105,7 @@ Result FileAccess::deployAndInit(const FilePath &libExecPath, const FilePath &re
.arg(cmdBridgePath.error())); .arg(cmdBridgePath.error()));
} }
qCDebug(faLog) << "Using cmdbridge at:" << *cmdBridgePath; qCDebug(faLog) << deco() << "Using cmdbridge at:" << *cmdBridgePath;
if (remoteRootPath.needsDevice()) { if (remoteRootPath.needsDevice()) {
const auto cmdBridgeFileData = cmdBridgePath->fileContents(); const auto cmdBridgeFileData = cmdBridgePath->fileContents();
@@ -117,10 +123,12 @@ Result FileAccess::deployAndInit(const FilePath &libExecPath, const FilePath &re
QString("Could not create temporary file: %1").arg(tmpFile.error())); QString("Could not create temporary file: %1").arg(tmpFile.error()));
} }
qCDebug(faLog) << "Using temporary file:" << *tmpFile; qCDebug(faLog) << deco() << "Using temporary file:" << *tmpFile;
const auto dd = run({remoteRootPath.withNewPath("dd"), {"of=" + *tmpFile, "bs=1"}}, const auto dd = run({remoteRootPath.withNewPath("dd"), {"of=" + *tmpFile, "bs=1"}},
*cmdBridgeFileData); *cmdBridgeFileData);
qCDebug(faLog) << deco() << "dd run";
const auto makeExecutable = run({remoteRootPath.withNewPath("chmod"), {"+x", *tmpFile}}); const auto makeExecutable = run({remoteRootPath.withNewPath("chmod"), {"+x", *tmpFile}});
if (!makeExecutable) { if (!makeExecutable) {