AndroidTestRunner: make adb logcat -b crash non blocking

We only need a snapshot of the crash logs, so pass -d to make the call
non-blocking, this means we we can check right away for start/finish
of that process. This would also, the error:

  Error: failed to run ndk-stack command.
  agent:2024/10/21 16:31:42 build.go:404: QProcess: Destroyed while
process ("/opt/android/sdk/platform-tools/adb") is still running.

Pick-to: 6.8
Change-Id: I2314d0b9567865934c2aa8f6d40ace2b4288ebb2
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
This commit is contained in:
Assam Boudjelthia 2024-10-21 21:32:46 +03:00
parent 61468b3411
commit 2d3334a879

View File

@ -647,7 +647,7 @@ void printLogcatCrashBuffer(const QString &formattedTime)
ndkStackProcess.start(g_options.ndkStackPath, { "-sym"_L1, libsPath });
}
QStringList adbCrashArgs = { "logcat"_L1, "-b"_L1, "crash"_L1, "-t"_L1, formattedTime };
QStringList adbCrashArgs = {"logcat"_L1, "-d"_L1, "-b"_L1, "crash"_L1, "-t"_L1, formattedTime};
if (!g_options.serial.isEmpty())
adbCrashArgs = QStringList{"-s"_L1 + g_options.serial} + adbCrashArgs;
@ -658,19 +658,21 @@ void printLogcatCrashBuffer(const QString &formattedTime)
return;
}
if (useNdkStack && !ndkStackProcess.waitForStarted()) {
qCritical() << "Error: failed to run ndk-stack command.";
return;
}
if (!adbCrashProcess.waitForFinished()) {
qCritical() << "Error: adb command timed out.";
return;
}
if (useNdkStack && !ndkStackProcess.waitForFinished()) {
qCritical() << "Error: ndk-stack command timed out.";
return;
if (useNdkStack) {
if (!ndkStackProcess.waitForStarted()) {
qCritical() << "Error: failed to run ndk-stack command.";
return;
}
if (!ndkStackProcess.waitForFinished()) {
qCritical() << "Error: ndk-stack command timed out.";
return;
}
}
const QByteArray crash = useNdkStack ? ndkStackProcess.readAllStandardOutput()