AndroidTestRunner: try to pull results for few times

Try to pull result files for 3 times in case they fail,
just to ensure less flakiness.

Change-Id: Id052fe2359d190fe87e304bbd22fc2096d50cadb
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 488f30e4a0a13a90f14883d1b511d3c21db8402e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Assam Boudjelthia 2024-10-21 15:43:49 +03:00 committed by Qt Cherry-pick Bot
parent 00f35aa0a3
commit e7b28a3899

View File

@ -114,6 +114,7 @@ struct Options
bool verbose = false; bool verbose = false;
bool skipAddInstallRoot = false; bool skipAddInstallRoot = false;
int timeoutSecs = 600; // 10 minutes int timeoutSecs = 600; // 10 minutes
int resultsPullRetries = 3;
QString buildPath; QString buildPath;
QString adbCommand{"adb"_L1}; QString adbCommand{"adb"_L1};
QString serial; QString serial;
@ -547,8 +548,18 @@ static bool pullFiles()
const QStringList fullCatArgs = { "shell"_L1, "run-as %1 --user %2 %3"_L1.arg( const QStringList fullCatArgs = { "shell"_L1, "run-as %1 --user %2 %3"_L1.arg(
g_options.package, QString::fromUtf8(userId.simplified()), catCmd) }; g_options.package, QString::fromUtf8(userId.simplified()), catCmd) };
bool catSuccess = false;
QByteArray output; QByteArray output;
if (!execAdbCommand(fullCatArgs, &output, false)) {
for (int i = 1; i <= g_options.resultsPullRetries; ++i) {
catSuccess = execAdbCommand(fullCatArgs, &output, false);
if (!catSuccess)
continue;
else if (!output.isEmpty())
break;
}
if (!catSuccess) {
qCritical() << "Error: failed to retrieve the test's output.%1 file."_L1.arg(outSuffix); qCritical() << "Error: failed to retrieve the test's output.%1 file."_L1.arg(outSuffix);
return false; return false;
} }