Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Expand Up @@ -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]
Expand Down Expand Up @@ -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"),
};

Expand All @@ -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]
Expand Down
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("device") ? s_defaultDeviceLaunchTimeout : s_defaultSimulatorLaunchTimeout;
if (appBundleItem.TryGetMetadata(MetadataNames.LaunchTimeout, out string launchTimeoutProp))
{
if (!TimeSpan.TryParse(launchTimeoutProp, out launchTimeout) || launchTimeout.Ticks < 0)
Expand Down
1 change: 0 additions & 1 deletion tests/XHarness/XHarness.Apple.Simulator.Run.proj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<TestTarget>ios-simulator-64</TestTarget>
<WorkItemTimeout>00:12:00</WorkItemTimeout>
<TestTimeout>00:08:00</TestTimeout>
<LaunchTimeout>00:05:00</LaunchTimeout>
<IncludesTestRunner>false</IncludesTestRunner>
<ExpectedExitCode>200</ExpectedExitCode>
</XHarnessAppBundleToTest>
Expand Down
1 change: 0 additions & 1 deletion tests/XHarness/XHarness.Apple.Simulator.Test.proj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<TestTarget>ios-simulator-64</TestTarget>
<TestTimeout>00:05:00</TestTimeout>
<WorkItemTimeout>00:15:00</WorkItemTimeout>
<LaunchTimeout>00:06:00</LaunchTimeout>
</XHarnessAppBundleToTest>
</ItemGroup>
</Target>
Expand Down