diff --git a/src/Compilers/CSharp/Test/Emit2/Semantics/CollectionExpressionTests.cs b/src/Compilers/CSharp/Test/Emit2/Semantics/CollectionExpressionTests.cs index b0a4ab2522064..35e0095aa9fc5 100644 --- a/src/Compilers/CSharp/Test/Emit2/Semantics/CollectionExpressionTests.cs +++ b/src/Compilers/CSharp/Test/Emit2/Semantics/CollectionExpressionTests.cs @@ -28975,7 +28975,7 @@ public void M() comp.VerifyEmitDiagnostics(); } - [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/70381")] + [ConditionalFact(typeof(WindowsOrLinuxOnly)), WorkItem("https://github.com/dotnet/roslyn/issues/70381")] public void ExtremelyNestedCollectionExpressionDoesNotOverflow_1() { var code = $$""" diff --git a/src/Compilers/CSharp/Test/EndToEnd/EndToEndTests.cs b/src/Compilers/CSharp/Test/EndToEnd/EndToEndTests.cs index d6e0431585ae3..ccc34c3e368d9 100644 --- a/src/Compilers/CSharp/Test/EndToEnd/EndToEndTests.cs +++ b/src/Compilers/CSharp/Test/EndToEnd/EndToEndTests.cs @@ -18,6 +18,7 @@ using System.Threading; using System.Diagnostics; using Roslyn.Test.Utilities.TestGenerators; +using System.Runtime.InteropServices; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.EndToEnd { @@ -174,14 +175,15 @@ void M2() { [Fact, WorkItem("https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1874763")] public void OverflowOnFluentCall_ExtensionMethods() { - int numberFluentCalls = (IntPtr.Size, ExecutionConditionUtil.Configuration, RuntimeUtilities.IsDesktopRuntime) switch - { - (8, ExecutionConfiguration.Debug, false) => 750, - (8, ExecutionConfiguration.Release, false) => 750, // Should be ~3_400, but is flaky. - (4, ExecutionConfiguration.Debug, true) => 450, - (4, ExecutionConfiguration.Release, true) => 1_600, - (8, ExecutionConfiguration.Debug, true) => 1_100, - (8, ExecutionConfiguration.Release, true) => 3_300, + int numberFluentCalls = (IntPtr.Size, ExecutionConditionUtil.Configuration, RuntimeUtilities.IsDesktopRuntime, RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) switch + { + (8, ExecutionConfiguration.Debug, false, false) => 750, + (8, ExecutionConfiguration.Release, false, false) => 750, // Should be ~3_400, but is flaky. + (4, ExecutionConfiguration.Debug, true, false) => 450, + (4, ExecutionConfiguration.Release, true, false) => 1_600, + (8, ExecutionConfiguration.Debug, true, false) => 1_100, + (8, ExecutionConfiguration.Release, true, false) => 3_300, + (_, _, _, true) => 200, _ => throw new Exception($"Unexpected configuration {IntPtr.Size * 8}-bit {ExecutionConditionUtil.Configuration}, Desktop: {RuntimeUtilities.IsDesktopRuntime}") }; diff --git a/src/Tools/Source/RunTests/TestRunner.cs b/src/Tools/Source/RunTests/TestRunner.cs index cedf33d604544..f837f34a2e8d9 100644 --- a/src/Tools/Source/RunTests/TestRunner.cs +++ b/src/Tools/Source/RunTests/TestRunner.cs @@ -193,6 +193,7 @@ string MakeHelixWorkItemProject(WorkItemInfo workItemInfo) // We could relax this and allow for example Linux clients to kick off Windows jobs, but we'd have to // figure out solutions for issues such as creating file paths in the correct format for the target machine. var isUnix = !RuntimeInformation.IsOSPlatform(OSPlatform.Windows); + var isMac = RuntimeInformation.IsOSPlatform(OSPlatform.OSX); var setEnvironmentVariable = isUnix ? "export" : "set"; @@ -202,15 +203,40 @@ string MakeHelixWorkItemProject(WorkItemInfo workItemInfo) command.AppendLine(isUnix ? $"ls -l" : $"dir"); command.AppendLine("dotnet --info"); - var knownEnvironmentVariables = new[] { "ROSLYN_TEST_IOPERATION", "ROSLYN_TEST_USEDASSEMBLIES" }; + string[] knownEnvironmentVariables = + [ + "ROSLYN_TEST_IOPERATION", + "ROSLYN_TEST_USEDASSEMBLIES" + ]; + foreach (var knownEnvironmentVariable in knownEnvironmentVariables) { - if (string.Equals(Environment.GetEnvironmentVariable(knownEnvironmentVariable), "true", StringComparison.OrdinalIgnoreCase)) + if (Environment.GetEnvironmentVariable(knownEnvironmentVariable) is string { Length: > 0 } value) { - command.AppendLine($"{setEnvironmentVariable} {knownEnvironmentVariable}=true"); + command.AppendLine($"{setEnvironmentVariable} {knownEnvironmentVariable}=\"{value}\""); } } + // OSX produces extremely large dump files that commonly exceed the limits of Helix + // uploads. These settings limit the dump file size + produce a .json detailing crash + // reasons that work better with Helix size limitations. + if (isMac) + { + command.AppendLine($"{setEnvironmentVariable} DOTNET_DbgEnableMiniDump=1"); + command.AppendLine($"{setEnvironmentVariable} DOTNET_DbgMiniDumpType=1"); + command.AppendLine($"{setEnvironmentVariable} DOTNET_EnableCrashReport=1"); + } + + // Set the dump folder so that dotnet writes all dump files to this location automatically. + // This saves the need to scan for all the different types of dump files later and copy + // them around. + var helixDumpFolder = isUnix + ? @"$HELIX_DUMP_FOLDER/crash.%d.%e.dmp" + : @"%HELIX_DUMP_FOLDER%\crash.%d.%e.dmp"; + command.AppendLine($"{setEnvironmentVariable} DOTNET_DbgMiniDumpName=\"{helixDumpFolder}\""); + + command.AppendLine(isUnix ? "env | sort" : "set"); + // Create a payload directory that contains all the assemblies in the work item in separate folders. var payloadDirectory = Path.Combine(msbuildTestPayloadRoot, "artifacts", "bin"); @@ -259,6 +285,9 @@ string MakeHelixWorkItemProject(WorkItemInfo workItemInfo) // return value of the main command is captured; a Helix Job is considered to fail if the main command returns a // non-zero error code, and we don't want the cleanup steps to interefere with that. PostCommands exist // precisely to address this problem. + // + // This is still necessary even with us setting DOTNET_DbgMiniDumpName because the system can create + // non .NET Core dump files that aren't controlled by that value. var postCommands = new StringBuilder(); if (isUnix)