Skip to content

Commit

Permalink
restart adb and retry installation after timeout (#609)
Browse files Browse the repository at this point in the history
  • Loading branch information
Katya Sokolova authored May 25, 2021
1 parent 5e628fa commit 3a13f31
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Microsoft.DotNet.XHarness.Android/AdbRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,15 @@ public int InstallApk(string apkPath)
result = RunAdbCommand($"install \"{apkPath}\"");
}

// 3. Installation timed out; restarting the ADB server helps
if (result.ExitCode == (int)AdbExitCodes.INSTRUMENTATION_TIMEOUT)
{
_log.LogWarning($"Installation timed out; Will make one attempt to restart ADB server, then retry the install");
KillAdbServer();
StartAdbServer();
result = RunAdbCommand($"install \"{apkPath}\"");
}

if (result.ExitCode != 0)
{
_log.LogError($"Error:{Environment.NewLine}{result}");
Expand Down

0 comments on commit 3a13f31

Please sign in to comment.