Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set more aggressive launch timeout for Apple Simulator runs #8104

Merged
merged 3 commits into from
Oct 27, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Arcade.Common;
using Microsoft.Build.Framework;
Expand Down Expand Up @@ -30,7 +29,10 @@ public static class MetadataNames
private const string EntryPointScript = "xharness-helix-job.apple.sh";
private const string RunnerScript = "xharness-runner.apple.sh";

private static readonly TimeSpan s_defaultLaunchTimeout = TimeSpan.FromMinutes(5);
// We have a more aggressive timeout towards simulators which tend to slow down until installation takes 20 minutes and the machine needs a reboot
// For this reason, it's better to be aggressive and detect a slower machine sooner
private static readonly TimeSpan s_defaultSimulatorLaunchTimeout = TimeSpan.FromMinutes(2);
private static readonly TimeSpan s_defaultDeviceLaunchTimeout = TimeSpan.FromMinutes(5);

/// <summary>
/// An array of one or more paths to iOS/tvOS app bundles (folders ending with ".app" usually)
Expand Down Expand Up @@ -133,7 +135,7 @@ private async Task<ITaskItem> PrepareWorkItem(
target = target.ToLowerInvariant();

// Optional timeout for the how long it takes for the app to be installed, booted and tests start executing
TimeSpan launchTimeout = s_defaultLaunchTimeout;
TimeSpan launchTimeout = target.Contains("simulator") ? s_defaultSimulatorLaunchTimeout : s_defaultDeviceLaunchTimeout;
if (appBundleItem.TryGetMetadata(MetadataNames.LaunchTimeout, out string launchTimeoutProp))
{
if (!TimeSpan.TryParse(launchTimeoutProp, out launchTimeout) || launchTimeout.Ticks < 0)
Expand Down