diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs index 0a7e7d5b02..259b52d09b 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs @@ -10,34 +10,22 @@ public sealed class CrashDumpTests : AcceptanceTestBase $TargetFrameworks$ Exe - true enable preview diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpOutputTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpOutputTests.cs index 69145bf55c..1daa8ffc9e 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpOutputTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpOutputTests.cs @@ -8,7 +8,6 @@ public sealed class HangDumpOutputTests : AcceptanceTestBase $TargetFrameworks$ Exe - true enable preview diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpProcessTreeTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpProcessTreeTests.cs index d070d15827..8449b3c0fa 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpProcessTreeTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpProcessTreeTests.cs @@ -10,23 +10,19 @@ public sealed class HangDumpProcessTreeTests : AcceptanceTestBase + var testHost = TestInfrastructure.TestHost.LocateFrom(AssetFixture.TargetAssetPath, "HangDumpWithChild", tfm); + TestHostResult testHostResult = await testHost.ExecuteAsync( + $"--hangdump --hangdump-timeout 8s --hangdump-type mini --results-directory {resultDirectory}", + new Dictionary { - { "SLEEPTIMEMS1", "4000" }, - { "SLEEPTIMEMS2", "600000" }, + { "SLEEPTIMEMS1", "4000" }, + { "SLEEPTIMEMS2", "600000" }, }, - failIfReturnValueIsNotZero: false, cancellationToken: TestContext.CancellationToken); - - result.AssertExitCodeIs(ExitCodes.TestHostProcessExitedNonGracefully); - string[] dumpFiles = Directory.GetFiles(resultDirectory, "*.dmp", SearchOption.AllDirectories); - Assert.HasCount(4, dumpFiles, $"There should be 4 dumps, one for each process in the tree. {result}"); + testHostResult.AssertExitCodeIs(ExitCodes.TestHostProcessExitedNonGracefully); + string[] dumpFiles = Directory.GetFiles(resultDirectory, "HangDump*.dmp", SearchOption.AllDirectories); + Assert.HasCount(4, dumpFiles, $"There should be 4 dumps, one for each process in the tree. {testHostResult}"); } public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpTests.cs index 81f7f4ad52..4fa0aae264 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpTests.cs @@ -8,7 +8,6 @@ public sealed class HangDumpTests : AcceptanceTestBase $TargetFrameworks$ Exe - true enable preview diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/Helpers/DumpWorkaround.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/Helpers/DumpWorkaround.cs deleted file mode 100644 index c7468c4930..0000000000 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/Helpers/DumpWorkaround.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System.Runtime.InteropServices; - -namespace Microsoft.Testing.Platform.Acceptance.IntegrationTests.Helpers; - -internal static class DumpWorkaround -{ - /// - /// Gets MSBuild global properties to work around crash/hang dump issues on macOS. - /// - /// - /// On macOS, returns "-p:UseAppHost=false" to work around createdump not working correctly on apphost. - /// On other platforms, returns an empty string. - /// - /// - /// Workaround: createdump doesn't work correctly on the apphost on macOS. - /// But it works correctly on the dotnet process. - /// So, disable apphost on macOS for now. - /// Related: https://github.com/dotnet/runtime/issues/119945 - /// - public static string GetGlobalPropertiesWorkaround() - => RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? "-p:UseAppHost=false" : string.Empty; -} diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/RetryFailedTestsTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/RetryFailedTestsTests.cs index 3cf5101b78..d548c3dfdb 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/RetryFailedTestsTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/RetryFailedTestsTests.cs @@ -145,9 +145,7 @@ public async Task RetryFailedTests_MaxTestsCount_Succeeds(string tfm, bool fail) [TestMethod] // We use crash dump, not supported in NetFramework at the moment [DynamicData(nameof(TargetFrameworks.NetForDynamicData), typeof(TargetFrameworks))] - [OSCondition(ConditionMode.Exclude, OperatingSystems.OSX)] public async Task RetryFailedTests_MoveFiles_Succeeds(string tfm) - // TODO: Crash dump is not working properly on macos, so we skip the test for now => await RetryHelper.RetryAsync( async () => { @@ -229,7 +227,6 @@ public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture. enable enable Exe - true preview false false diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxTests.cs index 7fc99cc812..6fc4558f50 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxTests.cs @@ -38,7 +38,6 @@ public async Task Trx_WhenReportTrxIsSpecified_TrxReportIsGeneratedInDefaultLoca [DynamicData(nameof(TargetFrameworks.NetForDynamicData), typeof(TargetFrameworks))] [TestMethod] - [OSCondition(ConditionMode.Exclude, OperatingSystems.OSX, IgnoreMessage = "Investigate failures on macos")] public async Task Trx_WhenTestHostCrash_ErrorIsDisplayedInsideTheTrx(string tfm) { string fileName = Guid.NewGuid().ToString("N"); @@ -220,7 +219,6 @@ public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture. enable enable Exe - true preview diff --git a/test/Utilities/Microsoft.Testing.TestInfrastructure/TempDirectory.cs b/test/Utilities/Microsoft.Testing.TestInfrastructure/TempDirectory.cs index 285a53fe3a..368591b513 100644 --- a/test/Utilities/Microsoft.Testing.TestInfrastructure/TempDirectory.cs +++ b/test/Utilities/Microsoft.Testing.TestInfrastructure/TempDirectory.cs @@ -204,7 +204,31 @@ we end up with a -dev or -ci version which will lose resolution over -preview de --> + + + + + +"""); + + File.WriteAllText(System.IO.Path.Combine(directoryPath, "mtp-test-entitlements.plist"), """ + + + + + com.apple.security.cs.allow-jit + + com.apple.security.cs.allow-dyld-environment-variables + + com.apple.security.cs.disable-library-validation + + com.apple.security.cs.debugger + + com.apple.security.get-task-allow + + + """); string directoryPackagesProps = System.IO.Path.Combine(directoryPath, "Directory.Packages.props");