diff --git a/src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/CreateXHarnessAppleWorkItemsTests.cs b/src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/CreateXHarnessAppleWorkItemsTests.cs index 5ff6f153d38..1de74789d8a 100644 --- a/src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/CreateXHarnessAppleWorkItemsTests.cs +++ b/src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/CreateXHarnessAppleWorkItemsTests.cs @@ -133,6 +133,9 @@ public void ArchivePayloadIsOverwritten() payloadArchive.Should().NotBeNullOrEmpty(); _fileSystem.FileExists(payloadArchive).Should().BeTrue(); _fileSystem.RemovedFiles.Should().Contain(payloadArchive); + + var command = workItem.GetMetadata("Command"); + command.Should().Contain("--launch-timeout \"00:02:00\""); } [Fact] @@ -170,7 +173,7 @@ public void AppBundleIsReused() _task.ConfigureServices(collection); _task.AppBundles = new[] { - CreateAppBundle("item-1", "ios-simulator-64_13.5", appBundlePath: "apps/System.Foo.app"), + CreateAppBundle("item-1", "ios-device_13.5", appBundlePath: "apps/System.Foo.app"), CreateAppBundle("item-2", "ios-simulator-64_13.6", appBundlePath: "apps/System.Foo.app"), }; @@ -182,25 +185,27 @@ public void AppBundleIsReused() _task.WorkItems.Length.Should().Be(2); _fileSystem.RemovedFiles.Should().BeEmpty(); - var workItem1 = _task.WorkItems.Last(); - workItem1.GetMetadata("Identity").Should().Be("item-2"); + var workItem1 = _task.WorkItems.First(); + workItem1.GetMetadata("Identity").Should().Be("item-1"); var payloadArchive = workItem1.GetMetadata("PayloadArchive"); payloadArchive.Should().NotBeNullOrEmpty(); _fileSystem.FileExists(payloadArchive).Should().BeTrue(); var command = workItem1.GetMetadata("Command"); - command.Should().Contain("--target \"ios-simulator-64_13.6\""); + command.Should().Contain("--target \"ios-device_13.5\""); + command.Should().Contain("--launch-timeout \"00:05:00\""); - var workItem2 = _task.WorkItems.First(); - workItem2.GetMetadata("Identity").Should().Be("item-1"); + var workItem2 = _task.WorkItems.Last(); + workItem2.GetMetadata("Identity").Should().Be("item-2"); payloadArchive = workItem2.GetMetadata("PayloadArchive"); payloadArchive.Should().NotBeNullOrEmpty(); _fileSystem.FileExists(payloadArchive).Should().BeTrue(); command = workItem2.GetMetadata("Command"); - command.Should().Contain("--target \"ios-simulator-64_13.5\""); + command.Should().Contain("--target \"ios-simulator-64_13.6\""); + command.Should().Contain("--launch-timeout \"00:02:00\""); } [Fact] diff --git a/src/Microsoft.DotNet.Helix/Sdk/CreateXHarnessAppleWorkItems.cs b/src/Microsoft.DotNet.Helix/Sdk/CreateXHarnessAppleWorkItems.cs index fe8c942a338..76885f426f5 100644 --- a/src/Microsoft.DotNet.Helix/Sdk/CreateXHarnessAppleWorkItems.cs +++ b/src/Microsoft.DotNet.Helix/Sdk/CreateXHarnessAppleWorkItems.cs @@ -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; @@ -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); /// /// An array of one or more paths to iOS/tvOS app bundles (folders ending with ".app" usually) @@ -133,7 +135,7 @@ private async Task 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("device") ? s_defaultDeviceLaunchTimeout : s_defaultSimulatorLaunchTimeout; if (appBundleItem.TryGetMetadata(MetadataNames.LaunchTimeout, out string launchTimeoutProp)) { if (!TimeSpan.TryParse(launchTimeoutProp, out launchTimeout) || launchTimeout.Ticks < 0) diff --git a/tests/XHarness/XHarness.Apple.Simulator.Run.proj b/tests/XHarness/XHarness.Apple.Simulator.Run.proj index c67a80201e5..54a7b58068b 100644 --- a/tests/XHarness/XHarness.Apple.Simulator.Run.proj +++ b/tests/XHarness/XHarness.Apple.Simulator.Run.proj @@ -23,7 +23,6 @@ ios-simulator-64 00:12:00 00:08:00 - 00:05:00 false 200 diff --git a/tests/XHarness/XHarness.Apple.Simulator.Test.proj b/tests/XHarness/XHarness.Apple.Simulator.Test.proj index 49c9f339a8d..babce06d5da 100644 --- a/tests/XHarness/XHarness.Apple.Simulator.Test.proj +++ b/tests/XHarness/XHarness.Apple.Simulator.Test.proj @@ -23,7 +23,6 @@ ios-simulator-64 00:05:00 00:15:00 - 00:06:00