diff --git a/global.json b/global.json index ee8ab86fd2..f3b3fabd08 100644 --- a/global.json +++ b/global.json @@ -1,12 +1,12 @@ { "sdk": { - "version": "5.0.100-rc.1.20380.12", + "version": "5.0.100-rc.1.20453.7", "rollForward": "minor", "allowPrerelease": false, "architecture": "x64" }, "tools": { - "dotnet": "5.0.100-rc.1.20380.12" + "dotnet": "5.0.100-rc.1.20453.7" }, "msbuild-sdks": { "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20427.6", diff --git a/scripts/build.ps1 b/scripts/build.ps1 index a2bf383069..69f65283d4 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -82,7 +82,7 @@ $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1 # Dotnet build doesn't support --packages yet. See https://github.com/dotnet/cli/issues/2712 $env:NUGET_PACKAGES = $env:TP_PACKAGES_DIR $env:NUGET_EXE_Version = "3.4.3" -$env:DOTNET_CLI_VERSION = "5.0.100-rc.1.20380.12" +$env:DOTNET_CLI_VERSION = "5.0.100-rc.1.20453.7" # $env:DOTNET_RUNTIME_VERSION = "LATEST" $env:VSWHERE_VERSION = "2.0.2" $env:MSBUILD_VERSION = "15.0" @@ -174,14 +174,17 @@ function Install-DotNetCli New-Item -ItemType directory -Path $dotnetInstallPath -Force | Out-Null & $dotnetInstallScript -Channel "master" -InstallDir $dotnetInstallPath -Version $env:DOTNET_CLI_VERSION - # Pull in additional shared frameworks. - # Get netcoreapp2.1 shared components. - & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Version '2.1.0' -Channel '2.1.0' -Architecture x64 -NoPath $env:DOTNET_ROOT= $dotnetInstallPath & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Version '2.1.0' -Channel '2.1.0' -Architecture x86 -NoPath ${env:DOTNET_ROOT(x86)} = "${dotnetInstallPath}_x86" + + & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Version '3.1.0' -Channel '3.1.0' -Architecture x64 -NoPath + $env:DOTNET_ROOT= $dotnetInstallPath + + & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Version '3.1.0' -Channel '3.1.0' -Architecture x86 -NoPath + ${env:DOTNET_ROOT(x86)} = "${dotnetInstallPath}_x86" $env:DOTNET_MULTILEVEL_LOOKUP=0 diff --git a/scripts/build.sh b/scripts/build.sh index e4454a5dc8..d59176c1d4 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -111,7 +111,7 @@ VERSION=$(test -z $VERSION && grep TPVersionPrefix $TP_ROOT_DIR/scripts/build/Te export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 # Dotnet build doesnt support --packages yet. See https://github.com/dotnet/cli/issues/2712 export NUGET_PACKAGES=$TP_PACKAGES_DIR -DOTNET_CLI_VERSION="5.0.100-rc.1.20380.12" +DOTNET_CLI_VERSION="5.0.100-rc.1.20453.7" #DOTNET_RUNTIME_VERSION="LATEST" # diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs b/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs index df0d013624..90085ef614 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs @@ -4,7 +4,8 @@ namespace Microsoft.TestPlatform.AcceptanceTests { using System; - + using System.Collections.Generic; + using System.Linq; using Microsoft.TestPlatform.TestUtilities; public class AcceptanceTestBase : IntegrationTestBase @@ -21,6 +22,7 @@ public class AcceptanceTestBase : IntegrationTestBase public const string DesktopTargetFramework = "net451"; public const string Core21TargetFramework = "netcoreapp2.1"; public const string Core31TargetFramework = "netcoreapp3.1"; + public const string Core50TargetFramework = "net5.0"; public const string DesktopFrameworkArgValue = ".NETFramework,Version=v4.5.1"; public const string Net451FrameworkArgValue = ".NETFramework,Version=v4.5.1"; @@ -35,10 +37,23 @@ public class AcceptanceTestBase : IntegrationTestBase public const string Core21FrameworkArgValue = ".NETCoreApp,Version=v2.1"; public const string Core31FrameworkArgValue = ".NETCoreApp,Version=v3.1"; + public const string Core50FrameworkArgValue = ".NETCoreApp,Version=v5.0"; + public const string DesktopRunnerTargetRuntime = "win7-x64"; public const string CoreRunnerTargetRuntime = ""; public const string InIsolation = "/InIsolation"; + public const string NETFX452_48 = "net452;net461;net472;net48"; + public const string NETFX451_48 = "net452;net461;net472;net48"; + public const string NETCORE21_50 = "netcoreapp2.1;netcoreapp3.1;net5.0"; + public const string NETFX452_NET50 = "net452;net461;net472;net48;netcoreapp2.1;netcoreapp3.1;net5.0"; + public const string NETFX452_NET31 = "net452;net461;net472;net48;netcoreapp2.1;netcoreapp3.1"; + + public static string And(string left, string right) + { + return string.Join(";", left, right); + } + protected string FrameworkArgValue => DeriveFrameworkArgValue(this.testEnvironment); protected static void SetTestEnvironment(IntegrationTestEnvironment testEnvironment, RunnerInfo runnerInfo) @@ -56,6 +71,8 @@ protected static string DeriveFrameworkArgValue(IntegrationTestEnvironment testE return Core21FrameworkArgValue; case Core31TargetFramework: return Core31FrameworkArgValue; + case Core50TargetFramework: + return Core50FrameworkArgValue; case Net451TargetFramework: return Net451FrameworkArgValue; case Net452TargetFramework: diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs index f3939f2e6b..e7b0fa5281 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs @@ -5,7 +5,10 @@ namespace Microsoft.TestPlatform.AcceptanceTests { using Microsoft.VisualStudio.TestTools.UnitTesting; using System; + using System.Collections.Generic; using System.IO; + using System.Linq; + using System.Text; using System.Xml; [TestClass] @@ -13,6 +16,9 @@ public class BlameDataCollectorTests : AcceptanceTestBase { private readonly string resultsDir; + public const string NETCOREANDFX = "net452;net472;netcoreapp3.1"; + public const string NET50 = "net5.0"; + public BlameDataCollectorTests() { this.resultsDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); @@ -61,6 +67,182 @@ public void BlameDataCollectorShouldOutputDumpFile(RunnerInfo runnerInfo) this.VaildateOutput(true); } + [TestMethod] + [NetFrameworkRunner("net452;net472;netcoreapp3.1;net5.0")] + // should make no difference, keeping for easy debug + // [NetCoreRunner("net452;net472;netcoreapp3.1;net5.0")] + public void HangDumpOnTimeout(RunnerInfo runnerInfo) + { + Environment.SetEnvironmentVariable("PROCDUMP_PATH", Path.Combine(this.testEnvironment.PackageDirectory, @"procdump\0.0.1\bin")); + + AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); + var assemblyPaths = this.GetAssetFullPath("timeout.dll"); + var arguments = PrepareArguments(assemblyPaths, this.GetTestAdapterPath(), string.Empty, string.Empty, runnerInfo.InIsolationValue); + arguments = string.Concat(arguments, $@" /Blame:""CollectHangDump;HangDumpType=full;TestTimeout=3s"""); + this.InvokeVsTest(arguments); + + this.ValidateDump(); + } + + [TestMethod] + // net5.0 does not suppord dump on exit + [NetFrameworkRunner("net452;net472;netcoreapp3.1")] + // should make no difference, keeping for easy debug + // [NetCoreRunner("net452;net472;netcoreapp3.1")] + public void CrashDumpWhenThereIsNoTimeout(RunnerInfo runnerInfo) + { + Environment.SetEnvironmentVariable("PROCDUMP_PATH", Path.Combine(this.testEnvironment.PackageDirectory, @"procdump\0.0.1\bin")); + + AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); + var assemblyPaths = this.GetAssetFullPath("timeout.dll"); + var arguments = PrepareArguments(assemblyPaths, this.GetTestAdapterPath(), string.Empty, string.Empty, runnerInfo.InIsolationValue); + arguments = string.Concat(arguments, $@" /Blame:""CollectDump;DumpType=full;CollectAlways=true;CollectHangDump"""); + this.InvokeVsTest(arguments); + + this.ValidateDump(); + } + + [TestMethod] + // net5.0 does not suppord dump on exit + [NetFrameworkRunner("net452;net472;netcoreapp3.1")] + // should make no difference, keeping for easy debug + // [NetCoreRunner("net452;net472;netcoreapp3.1")] + public void CrashDumpOnExit(RunnerInfo runnerInfo) + { + Environment.SetEnvironmentVariable("PROCDUMP_PATH", Path.Combine(this.testEnvironment.PackageDirectory, @"procdump\0.0.1\bin")); + + AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); + var assemblyPaths = this.GetAssetFullPath("timeout.dll"); + var arguments = PrepareArguments(assemblyPaths, this.GetTestAdapterPath(), string.Empty, string.Empty, runnerInfo.InIsolationValue); + arguments = string.Concat(arguments, $@" /Blame:""CollectDump;DumpType=full;CollectAlways=true"""); + this.InvokeVsTest(arguments); + + this.ValidateDump(); + } + + [TestMethod] + [NetFrameworkRunner("net452;net472;netcoreapp3.1;net5.0")] + // should make no difference, keeping for easy debug + // [NetCoreRunner("net452;net472;netcoreapp3.1;net5.0")] + public void CrashDumpOnStackOverflow(RunnerInfo runnerInfo) + { + Environment.SetEnvironmentVariable("PROCDUMP_PATH", Path.Combine(this.testEnvironment.PackageDirectory, @"procdump\0.0.1\bin")); + + AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); + var assemblyPaths = this.GetAssetFullPath("crash.dll"); + var arguments = PrepareArguments(assemblyPaths, this.GetTestAdapterPath(), string.Empty, string.Empty, runnerInfo.InIsolationValue); + arguments = string.Concat(arguments, $@" /Blame:""CollectDump;DumpType=full"""); + this.InvokeVsTest(arguments); + + this.ValidateDump(); + } + + [TestMethod] + [NetFrameworkRunner(NET50)] + // should make no difference, keeping for easy debug + // [NetCoreRunner(NET50)] + public void CrashDumpChildProcesses(RunnerInfo runnerInfo) + { + AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); + var assemblyPaths = this.GetAssetFullPath("child-crash.dll"); + var arguments = PrepareArguments(assemblyPaths, this.GetTestAdapterPath(), string.Empty, string.Empty, runnerInfo.InIsolationValue); + arguments = string.Concat(arguments, $@" /Blame:""CollectDump;DumpType=full"""); + this.InvokeVsTest(arguments); + + this.ValidateDump(2); + } + + [TestMethod] + [NetFrameworkRunner("net452;net472;netcoreapp3.1;net5.0")] + // should make no difference, keeping for easy debug + // [NetCoreRunner("net452;net472;netcoreapp3.1;net5.0")] + public void HangDumpChildProcesses(RunnerInfo runnerInfo) + { + AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); + var assemblyPaths = this.GetAssetFullPath("child-hang.dll"); + var arguments = PrepareArguments(assemblyPaths, this.GetTestAdapterPath(), string.Empty, string.Empty, runnerInfo.InIsolationValue); + arguments = string.Concat(arguments, $@" /Blame:""CollectHangDump;HangDumpType=full;TestTimeout=15s"""); + this.InvokeVsTest(arguments); + + this.ValidateDump(2); + } + + + private void ValidateDump(int expectedDumpCount = 1) + { + var attachments = this.StdOutWithWhiteSpace.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries) + .SkipWhile(l => !l.Contains("Attachments:")).Skip(1) + .Where(l => !string.IsNullOrWhiteSpace(l)) + .ToList(); + + var output = string.Join(Environment.NewLine, attachments); + if (!attachments.Any(a => a.Contains("Sequence_"))) + { + // sequence file is pretty flaky, and easily substituted by diag log + // throw new AssertFailedException("Expected Sequence file in Attachments, but there was none." + // + Environment.NewLine + // + output); + } + + var dumps = attachments + .Where(a => a.EndsWith(".dmp")) + // On Windows we might collect conhost which tells us nothing + // or WerFault in case we would start hanging during crash + // we don't want these to make cross-platform checks more difficult + // so we filter them out. + .Where(a => !a.Contains("WerFault") && !a.Contains("conhost")) + .Select(a => a.Trim()).ToList(); + + if (dumps.Count < expectedDumpCount) + { + throw new AssertFailedException($"Expected at least {expectedDumpCount} dump file in Attachments, but there were {dumps.Count}." + + Environment.NewLine + + string.Join(Environment.NewLine, dumps)); + } + + var nonExistingDumps = new List(); + var emptyDumps = new List(); + foreach (var dump in dumps) + { + if (!File.Exists(dump)) + { + nonExistingDumps.Add(dump); + } + else + { + var file = new FileInfo(dump); + if (file.Length == 0) + { + emptyDumps.Add(dump); + } + } + } + + // allow some child dumps to be missing, they manage to terminate early from time to time + if ((dumps.Count == 1 && nonExistingDumps.Any()) || (dumps.Count > 1 && nonExistingDumps.Count > 1) + || emptyDumps.Any()) + { + var err = new StringBuilder(); + err.AppendLine("Expected all dumps in the list of attachments to exist, and not be empty, but:"); + if (nonExistingDumps.Any()) + { + err.AppendLine($"{nonExistingDumps.Count} don't exist:") + .AppendLine(string.Join(Environment.NewLine, nonExistingDumps)); + } + + if (emptyDumps.Any()) + { + err.AppendLine($"{emptyDumps.Count} are empty:") + .AppendLine(string.Join(Environment.NewLine, emptyDumps)); + } + + err.AppendLine("Reported attachments:") + .AppendLine(output); + + throw new AssertFailedException(err.ToString()); + } + } + private void VaildateOutput(bool validateDumpFile = false) { bool isSequenceAttachmentReceived = false; @@ -70,7 +252,7 @@ private void VaildateOutput(bool validateDumpFile = false) this.StdOutputContains("Sequence_"); var resultFiles = Directory.GetFiles(this.resultsDir, "*", SearchOption.AllDirectories); - foreach(var file in resultFiles) + foreach (var file in resultFiles) { if (file.Contains("Sequence_")) { diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreRunner.cs b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreRunner.cs new file mode 100644 index 0000000000..045c9a8f6a --- /dev/null +++ b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreRunner.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.AcceptanceTests +{ + using System; + using System.Collections.Generic; + using System.Globalization; + using System.Reflection; + using TestUtilities; + using VisualStudio.TestTools.UnitTesting; + + /// + /// Runs tests using the dotnet vstest.console.dll built against .NET Core 2.1. + /// Provide a list of target frameworks to run the tests from given as a ';' separated list, or using a constant containing that range such as + /// AcceptanceTestBase.NETFX452_NET50 = "net452;net472;net48;netcoreapp2.1;netcoreapp3.1;net5.0" to determine which target framework of the project + /// to test. The target project must list those TFMs in the TargetFrameworks property in csproj. + /// + public class NetCoreRunner : Attribute, ITestDataSource + { + /// + /// Initializes a new instance of the class. + /// + /// To run tests with desktop runner(vstest.console.exe), use AcceptanceTestBase.Net452TargetFramework or alike values. + public NetCoreRunner(string targetFrameworks = AcceptanceTestBase.NETFX452_NET50) + { + foreach (var fmw in targetFrameworks.Split(';')) + { + this.dataRows.Add(new object[] { new RunnerInfo(IntegrationTestBase.CoreRunnerFramework, fmw) }); + } + + } + + private List dataRows = new List(); + + public IEnumerable GetData(MethodInfo methodInfo) + { + return this.dataRows; + } + + public string GetDisplayName(MethodInfo methodInfo, object[] data) + { + return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data)); + } + } +} \ No newline at end of file diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSource.cs b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSource.cs index a87b0af6b3..d17feb364d 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSource.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSource.cs @@ -63,18 +63,6 @@ public NetCoreTargetFrameworkDataSource( } } - /// - /// Initializes a new instance of the class. - /// - /// To run tests with desktop runner(vstest.console.exe), use AcceptanceTestBase.Net452TargetFramework or alike values. - public NetCoreTargetFrameworkDataSource(string[] targetFrameworks) - { - foreach (var fmw in targetFrameworks) - { - this.AddRunnerDataRow(IntegrationTestBase.CoreRunnerFramework, fmw); - } - } - private void AddRunnerDataRow(string runnerFramework, string targetFramework) { var runnerInfo = new RunnerInfo(runnerFramework, targetFramework); diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetFrameworkRunner.cs b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetFrameworkRunner.cs new file mode 100644 index 0000000000..a463d50e1e --- /dev/null +++ b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetFrameworkRunner.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.AcceptanceTests +{ + using System; + using System.Collections.Generic; + using System.Globalization; + using System.Reflection; + using TestUtilities; + using VisualStudio.TestTools.UnitTesting; + + /// + /// Runs tests using the dotnet vstest.console.dll built against .NET Core 2.1. + /// Provide a list of target frameworks to run the tests from given as a ';' separated list, or using a constant containing that range such as + /// AcceptanceTestBase.NETFX452_NET50 = "net452;net472;net48;netcoreapp2.1;netcoreapp3.1;net5.0" to determine which target framework of the project + /// to test. The target project must list those TFMs in the TargetFrameworks property in csproj. + /// + public class NetFrameworkRunner : Attribute, ITestDataSource + { + /// + /// Initializes a new instance of the class. + /// + /// To run tests with desktop runner(vstest.console.exe), use AcceptanceTestBase.Net452TargetFramework or alike values. + public NetFrameworkRunner(string targetFrameworks = AcceptanceTestBase.NETFX452_NET50) + { + foreach (var fmw in targetFrameworks.Split(';')) + { + this.dataRows.Add(new object[] { new RunnerInfo(IntegrationTestBase.DesktopRunnerFramework, fmw, AcceptanceTestBase.InIsolation) }); + } + + } + + private List dataRows = new List(); + + public IEnumerable GetData(MethodInfo methodInfo) + { + return this.dataRows; + } + + public string GetDisplayName(MethodInfo methodInfo, object[] data) + { + return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data)); + } + } +} \ No newline at end of file diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetFullTargetFrameworkDataSource.cs b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetFullTargetFrameworkDataSource.cs index 928531e501..f9765c1a66 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetFullTargetFrameworkDataSource.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetFullTargetFrameworkDataSource.cs @@ -48,6 +48,7 @@ public NetFullTargetFrameworkDataSource(bool inIsolation = true, bool inProcess } } + /// /// Initializes a new instance of the class. /// diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/MultitargetingTestHostTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/MultitargetingTestHostTests.cs index c560a23cfe..415c93567b 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/MultitargetingTestHostTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/MultitargetingTestHostTests.cs @@ -13,8 +13,8 @@ public class MultitargetingTestHostTests : AcceptanceTestBase [TestMethod] // the underlying test is using xUnit to avoid AppDomain enhancements in MSTest that make this pass even without multitargetting // xUnit supports net452 onwards, so that is why this starts at net452, I also don't test all framework versions - [NetCoreTargetFrameworkDataSource(targetFrameworks: new string[] { Net452TargetFramework, Net461TargetFramework, Net472TargetFramework, Net48TargetFramework })] - [NetFullTargetFrameworkDataSource(targetFrameworks: new string[] { Net452TargetFramework, Net461TargetFramework, Net472TargetFramework, Net48TargetFramework })] + [NetCoreRunner(NETFX452_48)] + [NetFrameworkRunner(NETFX452_48)] public void RunningTestWithAFailingDebugAssertDoesNotCrashTheHostingProcess(RunnerInfo runnerInfo) { AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); diff --git a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs index 8dd3b2aa1a..0322a30247 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs @@ -33,6 +33,8 @@ public class IntegrationTestBase private const string TestSummaryStatusMessageFormat = "Total tests: {0} Passed: {1} Failed: {2} Skipped: {3}"; private string standardTestOutput = string.Empty; private string standardTestError = string.Empty; + private string standardTestOutputWithWhiteSpace = string.Empty; + private string standardTestErrorWithWhiteSpace = string.Empty; private int runnerExitCode = -1; private string arguments = string.Empty; @@ -55,8 +57,10 @@ public IntegrationTestBase() } public string StdOut => this.standardTestOutput; + public string StdOutWithWhiteSpace => this.standardTestOutputWithWhiteSpace; public string StdErr => this.standardTestError; + public string StdErrWithWhiteSpace => this.standardTestErrorWithWhiteSpace; /// /// Prepare arguments for vstest.console.exe. @@ -574,10 +578,10 @@ private void ExecuteApplication(string path, string args, out string stdOut, out var stderrBuffer = new StringBuilder(); process.OutputDataReceived += (sender, eventArgs) => { - stdoutBuffer.Append(eventArgs.Data).Append(Environment.NewLine); + stdoutBuffer.AppendLine(eventArgs.Data); }; - process.ErrorDataReceived += (sender, eventArgs) => stderrBuffer.Append(eventArgs.Data).Append(Environment.NewLine); + process.ErrorDataReceived += (sender, eventArgs) => stderrBuffer.AppendLine(eventArgs.Data); Console.WriteLine("IntegrationTestBase.Execute: Path = {0}", process.StartInfo.FileName); Console.WriteLine("IntegrationTestBase.Execute: Arguments = {0}", process.StartInfo.Arguments); @@ -615,7 +619,10 @@ private void ExecuteApplication(string path, string args, out string stdOut, out private void FormatStandardOutCome() { + this.standardTestErrorWithWhiteSpace = this.standardTestError; this.standardTestError = Regex.Replace(this.standardTestError, @"\s+", " "); + + this.standardTestOutputWithWhiteSpace = this.standardTestOutput; this.standardTestOutput = Regex.Replace(this.standardTestOutput, @"\s+", " "); } diff --git a/test/TestAssets/TestAssets.sln/TestAssets.sln b/test/TestAssets/TestAssets.sln similarity index 77% rename from test/TestAssets/TestAssets.sln/TestAssets.sln rename to test/TestAssets/TestAssets.sln index 0be52ca562..d2b2ef6850 100644 --- a/test/TestAssets/TestAssets.sln/TestAssets.sln +++ b/test/TestAssets/TestAssets.sln @@ -3,78 +3,90 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29102.190 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NUnitAdapterPerfTestProject", "..\PerfAssets\NUnitAdapterPerfTestProject\NUnitAdapterPerfTestProject.csproj", "{F22A8D65-0581-4CC7-9C1C-9BC9F9E80DA4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NUnitAdapterPerfTestProject", "PerfAssets\NUnitAdapterPerfTestProject\NUnitAdapterPerfTestProject.csproj", "{F22A8D65-0581-4CC7-9C1C-9BC9F9E80DA4}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XUnitAdapterPerfTestProject", "..\PerfAssets\XUnitAdapterPerfTestProject\XUnitAdapterPerfTestProject.csproj", "{C1A621CF-8FA8-437C-98E8-C6C6418FEBEF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XUnitAdapterPerfTestProject", "PerfAssets\XUnitAdapterPerfTestProject\XUnitAdapterPerfTestProject.csproj", "{C1A621CF-8FA8-437C-98E8-C6C6418FEBEF}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MSTestAdapterPerfTestProject", "..\PerfAssets\MSTestAdapterPerfTestProject\MSTestAdapterPerfTestProject.csproj", "{52CAF89F-2309-4597-B531-79D6A96902BE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MSTestAdapterPerfTestProject", "PerfAssets\MSTestAdapterPerfTestProject\MSTestAdapterPerfTestProject.csproj", "{52CAF89F-2309-4597-B531-79D6A96902BE}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NUTestProject", "..\NUTestProject\NUTestProject.csproj", "{1ADE5795-2365-4790-8ACB-2EF0C2613D61}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NUTestProject", "NUTestProject\NUTestProject.csproj", "{1ADE5795-2365-4790-8ACB-2EF0C2613D61}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlameUnitTestProject", "..\BlameUnitTestProject\BlameUnitTestProject.csproj", "{29294E06-3998-4FF4-910F-EE93A915C3A1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlameUnitTestProject", "BlameUnitTestProject\BlameUnitTestProject.csproj", "{29294E06-3998-4FF4-910F-EE93A915C3A1}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XUTestProject", "..\XUTestProject\XUTestProject.csproj", "{C8AB532E-28E9-4C5E-9F2D-06B6690FCB72}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XUTestProject", "XUTestProject\XUTestProject.csproj", "{C8AB532E-28E9-4C5E-9F2D-06B6690FCB72}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleTestProject", "..\SimpleTestProject\SimpleTestProject.csproj", "{7E79BDC2-49BA-403A-BE07-212C463A279B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleTestProject", "SimpleTestProject\SimpleTestProject.csproj", "{7E79BDC2-49BA-403A-BE07-212C463A279B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleDataCollector", "..\SimpleDataCollector\SimpleDataCollector.csproj", "{E0042DCD-0C90-4736-B673-BC6CBDA04834}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleDataCollector", "SimpleDataCollector\SimpleDataCollector.csproj", "{E0042DCD-0C90-4736-B673-BC6CBDA04834}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleTestProject2", "..\SimpleTestProject2\SimpleTestProject2.csproj", "{2B0F911C-5864-4EF7-A1F4-6923F7963D74}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleTestProject2", "SimpleTestProject2\SimpleTestProject2.csproj", "{2B0F911C-5864-4EF7-A1F4-6923F7963D74}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OutOfProcDataCollector", "..\OutOfProcDataCollector\OutOfProcDataCollector.csproj", "{1266AB9D-94D9-496D-8AE5-73612D097A09}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OutOfProcDataCollector", "OutOfProcDataCollector\OutOfProcDataCollector.csproj", "{1266AB9D-94D9-496D-8AE5-73612D097A09}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PerfTestProject", "..\PerfTestProject\PerfTestProject.csproj", "{1D1FDCD9-10B5-4C54-8A95-AD0C941F41C6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PerfTestProject", "PerfTestProject\PerfTestProject.csproj", "{1D1FDCD9-10B5-4C54-8A95-AD0C941F41C6}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleRunners", "..\ConsoleRunners\ConsoleRunners.csproj", "{FBDB7A61-C1DB-4B24-B568-DA96AAD0DB8A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleRunners", "ConsoleRunners\ConsoleRunners.csproj", "{FBDB7A61-C1DB-4B24-B568-DA96AAD0DB8A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MstestV1UnitTestProject", "..\MstestV1UnitTestProject\MstestV1UnitTestProject.csproj", "{E28DD78A-E4C1-48C1-B027-88576F669C73}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MstestV1UnitTestProject", "MstestV1UnitTestProject\MstestV1UnitTestProject.csproj", "{E28DD78A-E4C1-48C1-B027-88576F669C73}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleTestProjectx86", "..\SimpleTestProjectx86\SimpleTestProjectx86.csproj", "{C4369F97-5D81-4D1A-BAE1-2AE3B2408D44}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleTestProjectx86", "SimpleTestProjectx86\SimpleTestProjectx86.csproj", "{C4369F97-5D81-4D1A-BAE1-2AE3B2408D44}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleTestProjectARM", "..\SimpleTestProjectARM\SimpleTestProjectARM.csproj", "{7C865EAA-C6C2-4CAF-A6AD-D9CF29577A36}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleTestProjectARM", "SimpleTestProjectARM\SimpleTestProjectARM.csproj", "{7C865EAA-C6C2-4CAF-A6AD-D9CF29577A36}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CUITTestProject", "..\CUITTestProject\CUITTestProject.csproj", "{CF46C8A0-E9FA-40E9-96CA-DCD3797546D8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CUITTestProject", "CUITTestProject\CUITTestProject.csproj", "{CF46C8A0-E9FA-40E9-96CA-DCD3797546D8}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DisableAppdomainTest1", "..\DisableAppdomainTest1\DisableAppdomainTest1.csproj", "{36C7990F-0A36-47CE-8E10-7887D24E2F9A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DisableAppdomainTest1", "DisableAppdomainTest1\DisableAppdomainTest1.csproj", "{36C7990F-0A36-47CE-8E10-7887D24E2F9A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DisableAppdomainTest2", "..\DisableAppdomainTest2\DisableAppdomainTest2.csproj", "{A09B21CC-F726-413A-B185-3AE1172BAED0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DisableAppdomainTest2", "DisableAppdomainTest2\DisableAppdomainTest2.csproj", "{A09B21CC-F726-413A-B185-3AE1172BAED0}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleManagedApp", "..\ConsoleManagedApp\ConsoleManagedApp.csproj", "{132E4690-DE43-4684-BA05-6942155EEAB5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleManagedApp", "ConsoleManagedApp\ConsoleManagedApp.csproj", "{132E4690-DE43-4684-BA05-6942155EEAB5}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LegacySettingsUnitTestProject", "..\LegacySettingsUnitTestProject\LegacySettingsUnitTestProject.csproj", "{8C38E692-FBE3-41A4-A008-4CA79B203985}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LegacySettingsUnitTestProject", "LegacySettingsUnitTestProject\LegacySettingsUnitTestProject.csproj", "{8C38E692-FBE3-41A4-A008-4CA79B203985}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NewtonSoftDependency", "..\NewtonSoftDependency\NewtonSoftDependency.csproj", "{79EDA259-5EA0-45F0-990A-F078427E198A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NewtonSoftDependency", "NewtonSoftDependency\NewtonSoftDependency.csproj", "{79EDA259-5EA0-45F0-990A-F078427E198A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppDomainGetAssembliesTestProject", "..\AppDomainGetAssembliesTestProject\AppDomainGetAssembliesTestProject.csproj", "{BF090BCE-CC7D-4359-93E2-30F2B454F751}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppDomainGetAssembliesTestProject", "AppDomainGetAssembliesTestProject\AppDomainGetAssembliesTestProject.csproj", "{BF090BCE-CC7D-4359-93E2-30F2B454F751}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EnvironmentVariablesTestProject", "..\EnvironmentVariablesTestProject\EnvironmentVariablesTestProject.csproj", "{BA53C202-55D6-4BBC-A24A-444B2D5F6309}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EnvironmentVariablesTestProject", "EnvironmentVariablesTestProject\EnvironmentVariablesTestProject.csproj", "{BA53C202-55D6-4BBC-A24A-444B2D5F6309}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProjectFileRunSettingsTestProject", "..\ProjectFileRunSettingsTestProject\ProjectFileRunSettingsTestProject.csproj", "{A0113409-56D3-4060-BD94-A4BA4739712D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProjectFileRunSettingsTestProject", "ProjectFileRunSettingsTestProject\ProjectFileRunSettingsTestProject.csproj", "{A0113409-56D3-4060-BD94-A4BA4739712D}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CrashingOnDebugAssertTestProject", "..\CrashingOnDebugAssertTestProject\CrashingOnDebugAssertTestProject.csproj", "{7A04F7AC-09E4-426C-A599-110DFA693200}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CrashingOnDebugAssertTestProject", "CrashingOnDebugAssertTestProject\CrashingOnDebugAssertTestProject.csproj", "{7A04F7AC-09E4-426C-A599-110DFA693200}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DCD7C4DA-B8CC-46D0-AA21-1340DD1EB5ED}" ProjectSection(SolutionItems) = preProject - ..\NuGet.config = ..\NuGet.config + NuGet.config = NuGet.config EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleTestProject3", "..\SimpleTestProject3\SimpleTestProject3.csproj", "{1FF723F6-3A09-41F6-B85C-C4BE9C4374F0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleTestProject3", "SimpleTestProject3\SimpleTestProject3.csproj", "{1FF723F6-3A09-41F6-B85C-C4BE9C4374F0}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscoveryTestProject", "..\DiscoveryTestProject\DiscoveryTestProject.csproj", "{4BAA0E81-FB31-4BAB-BD75-0CA315245BD8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscoveryTestProject", "DiscoveryTestProject\DiscoveryTestProject.csproj", "{4BAA0E81-FB31-4BAB-BD75-0CA315245BD8}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventLogUnitTestProject", "..\EventLogUnitTestProject\EventLogUnitTestProject.csproj", "{40DA6965-C3C3-46BC-BA56-6D457C097F3C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventLogUnitTestProject", "EventLogUnitTestProject\EventLogUnitTestProject.csproj", "{40DA6965-C3C3-46BC-BA56-6D457C097F3C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleProjectWithOldTestHost", "..\SampleProjectWithOldTestHost\SampleProjectWithOldTestHost.csproj", "{D7869421-F18B-4BEF-AECD-71485136808C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleProjectWithOldTestHost", "SampleProjectWithOldTestHost\SampleProjectWithOldTestHost.csproj", "{D7869421-F18B-4BEF-AECD-71485136808C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleClassLibrary", "..\SimpleClassLibrary\SimpleClassLibrary.csproj", "{F37144D7-2C6D-42AF-9E85-EF10E5244A7B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleClassLibrary", "SimpleClassLibrary\SimpleClassLibrary.csproj", "{F37144D7-2C6D-42AF-9E85-EF10E5244A7B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SelfContainedAppTestProject", "..\SelfContainedAppTestProject\SelfContainedAppTestProject.csproj", "{7F85E9D0-7BCE-431D-B468-4F6104E52DFA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SelfContainedAppTestProject", "SelfContainedAppTestProject\SelfContainedAppTestProject.csproj", "{7F85E9D0-7BCE-431D-B468-4F6104E52DFA}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoverletCoverageTestProject", "..\CoverletCoverageTestProject\CoverletCoverageTestProject.csproj", "{0D4D59D7-C52F-4858-A220-EAC7484E3827}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoverletCoverageTestProject", "CoverletCoverageTestProject\CoverletCoverageTestProject.csproj", "{0D4D59D7-C52F-4858-A220-EAC7484E3827}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeCoverageTest", "..\CodeCoverageTest\CodeCoverageTest.csproj", "{23790570-66D2-4CD5-9CD0-F8787C5B61BF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeCoverageTest", "CodeCoverageTest\CodeCoverageTest.csproj", "{23790570-66D2-4CD5-9CD0-F8787C5B61BF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultitargetedNetFrameworkProject", "..\MultitargetedNetFrameworkProject\MultitargetedNetFrameworkProject.csproj", "{E2F1E03B-002A-4A3E-BAFC-8F2F0AB5B86F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MultitargetedNetFrameworkProject", "MultitargetedNetFrameworkProject\MultitargetedNetFrameworkProject.csproj", "{E2F1E03B-002A-4A3E-BAFC-8F2F0AB5B86F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "child-crash", "child-crash\child-crash.csproj", "{A716ED69-FBC8-4E3F-B728-589873A1540D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "child-hang", "child-hang\child-hang.csproj", "{F262678B-7CD8-43DD-B752-4E761BE9A0A3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "crash", "crash\crash.csproj", "{CA159C14-FCE9-4D65-815C-F5D7D79583DE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "hanging-child", "hanging-child\hanging-child.csproj", "{4393D63A-0C36-42F3-98A9-81440F213640}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "timeout", "timeout\timeout.csproj", "{135B06DB-1A0E-4DC3-93DA-8649AE3BDE19}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "problematic-child", "problematic-child\problematic-child.csproj", "{5FB9DFB8-2453-40EA-AAAD-D44677BCDF50}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -494,6 +506,78 @@ Global {E2F1E03B-002A-4A3E-BAFC-8F2F0AB5B86F}.Release|x64.Build.0 = Release|Any CPU {E2F1E03B-002A-4A3E-BAFC-8F2F0AB5B86F}.Release|x86.ActiveCfg = Release|Any CPU {E2F1E03B-002A-4A3E-BAFC-8F2F0AB5B86F}.Release|x86.Build.0 = Release|Any CPU + {A716ED69-FBC8-4E3F-B728-589873A1540D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A716ED69-FBC8-4E3F-B728-589873A1540D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A716ED69-FBC8-4E3F-B728-589873A1540D}.Debug|x64.ActiveCfg = Debug|Any CPU + {A716ED69-FBC8-4E3F-B728-589873A1540D}.Debug|x64.Build.0 = Debug|Any CPU + {A716ED69-FBC8-4E3F-B728-589873A1540D}.Debug|x86.ActiveCfg = Debug|Any CPU + {A716ED69-FBC8-4E3F-B728-589873A1540D}.Debug|x86.Build.0 = Debug|Any CPU + {A716ED69-FBC8-4E3F-B728-589873A1540D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A716ED69-FBC8-4E3F-B728-589873A1540D}.Release|Any CPU.Build.0 = Release|Any CPU + {A716ED69-FBC8-4E3F-B728-589873A1540D}.Release|x64.ActiveCfg = Release|Any CPU + {A716ED69-FBC8-4E3F-B728-589873A1540D}.Release|x64.Build.0 = Release|Any CPU + {A716ED69-FBC8-4E3F-B728-589873A1540D}.Release|x86.ActiveCfg = Release|Any CPU + {A716ED69-FBC8-4E3F-B728-589873A1540D}.Release|x86.Build.0 = Release|Any CPU + {F262678B-7CD8-43DD-B752-4E761BE9A0A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F262678B-7CD8-43DD-B752-4E761BE9A0A3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F262678B-7CD8-43DD-B752-4E761BE9A0A3}.Debug|x64.ActiveCfg = Debug|Any CPU + {F262678B-7CD8-43DD-B752-4E761BE9A0A3}.Debug|x64.Build.0 = Debug|Any CPU + {F262678B-7CD8-43DD-B752-4E761BE9A0A3}.Debug|x86.ActiveCfg = Debug|Any CPU + {F262678B-7CD8-43DD-B752-4E761BE9A0A3}.Debug|x86.Build.0 = Debug|Any CPU + {F262678B-7CD8-43DD-B752-4E761BE9A0A3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F262678B-7CD8-43DD-B752-4E761BE9A0A3}.Release|Any CPU.Build.0 = Release|Any CPU + {F262678B-7CD8-43DD-B752-4E761BE9A0A3}.Release|x64.ActiveCfg = Release|Any CPU + {F262678B-7CD8-43DD-B752-4E761BE9A0A3}.Release|x64.Build.0 = Release|Any CPU + {F262678B-7CD8-43DD-B752-4E761BE9A0A3}.Release|x86.ActiveCfg = Release|Any CPU + {F262678B-7CD8-43DD-B752-4E761BE9A0A3}.Release|x86.Build.0 = Release|Any CPU + {CA159C14-FCE9-4D65-815C-F5D7D79583DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CA159C14-FCE9-4D65-815C-F5D7D79583DE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CA159C14-FCE9-4D65-815C-F5D7D79583DE}.Debug|x64.ActiveCfg = Debug|Any CPU + {CA159C14-FCE9-4D65-815C-F5D7D79583DE}.Debug|x64.Build.0 = Debug|Any CPU + {CA159C14-FCE9-4D65-815C-F5D7D79583DE}.Debug|x86.ActiveCfg = Debug|Any CPU + {CA159C14-FCE9-4D65-815C-F5D7D79583DE}.Debug|x86.Build.0 = Debug|Any CPU + {CA159C14-FCE9-4D65-815C-F5D7D79583DE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CA159C14-FCE9-4D65-815C-F5D7D79583DE}.Release|Any CPU.Build.0 = Release|Any CPU + {CA159C14-FCE9-4D65-815C-F5D7D79583DE}.Release|x64.ActiveCfg = Release|Any CPU + {CA159C14-FCE9-4D65-815C-F5D7D79583DE}.Release|x64.Build.0 = Release|Any CPU + {CA159C14-FCE9-4D65-815C-F5D7D79583DE}.Release|x86.ActiveCfg = Release|Any CPU + {CA159C14-FCE9-4D65-815C-F5D7D79583DE}.Release|x86.Build.0 = Release|Any CPU + {4393D63A-0C36-42F3-98A9-81440F213640}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4393D63A-0C36-42F3-98A9-81440F213640}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4393D63A-0C36-42F3-98A9-81440F213640}.Debug|x64.ActiveCfg = Debug|Any CPU + {4393D63A-0C36-42F3-98A9-81440F213640}.Debug|x64.Build.0 = Debug|Any CPU + {4393D63A-0C36-42F3-98A9-81440F213640}.Debug|x86.ActiveCfg = Debug|Any CPU + {4393D63A-0C36-42F3-98A9-81440F213640}.Debug|x86.Build.0 = Debug|Any CPU + {4393D63A-0C36-42F3-98A9-81440F213640}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4393D63A-0C36-42F3-98A9-81440F213640}.Release|Any CPU.Build.0 = Release|Any CPU + {4393D63A-0C36-42F3-98A9-81440F213640}.Release|x64.ActiveCfg = Release|Any CPU + {4393D63A-0C36-42F3-98A9-81440F213640}.Release|x64.Build.0 = Release|Any CPU + {4393D63A-0C36-42F3-98A9-81440F213640}.Release|x86.ActiveCfg = Release|Any CPU + {4393D63A-0C36-42F3-98A9-81440F213640}.Release|x86.Build.0 = Release|Any CPU + {135B06DB-1A0E-4DC3-93DA-8649AE3BDE19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {135B06DB-1A0E-4DC3-93DA-8649AE3BDE19}.Debug|Any CPU.Build.0 = Debug|Any CPU + {135B06DB-1A0E-4DC3-93DA-8649AE3BDE19}.Debug|x64.ActiveCfg = Debug|Any CPU + {135B06DB-1A0E-4DC3-93DA-8649AE3BDE19}.Debug|x64.Build.0 = Debug|Any CPU + {135B06DB-1A0E-4DC3-93DA-8649AE3BDE19}.Debug|x86.ActiveCfg = Debug|Any CPU + {135B06DB-1A0E-4DC3-93DA-8649AE3BDE19}.Debug|x86.Build.0 = Debug|Any CPU + {135B06DB-1A0E-4DC3-93DA-8649AE3BDE19}.Release|Any CPU.ActiveCfg = Release|Any CPU + {135B06DB-1A0E-4DC3-93DA-8649AE3BDE19}.Release|Any CPU.Build.0 = Release|Any CPU + {135B06DB-1A0E-4DC3-93DA-8649AE3BDE19}.Release|x64.ActiveCfg = Release|Any CPU + {135B06DB-1A0E-4DC3-93DA-8649AE3BDE19}.Release|x64.Build.0 = Release|Any CPU + {135B06DB-1A0E-4DC3-93DA-8649AE3BDE19}.Release|x86.ActiveCfg = Release|Any CPU + {135B06DB-1A0E-4DC3-93DA-8649AE3BDE19}.Release|x86.Build.0 = Release|Any CPU + {5FB9DFB8-2453-40EA-AAAD-D44677BCDF50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5FB9DFB8-2453-40EA-AAAD-D44677BCDF50}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5FB9DFB8-2453-40EA-AAAD-D44677BCDF50}.Debug|x64.ActiveCfg = Debug|Any CPU + {5FB9DFB8-2453-40EA-AAAD-D44677BCDF50}.Debug|x64.Build.0 = Debug|Any CPU + {5FB9DFB8-2453-40EA-AAAD-D44677BCDF50}.Debug|x86.ActiveCfg = Debug|Any CPU + {5FB9DFB8-2453-40EA-AAAD-D44677BCDF50}.Debug|x86.Build.0 = Debug|Any CPU + {5FB9DFB8-2453-40EA-AAAD-D44677BCDF50}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5FB9DFB8-2453-40EA-AAAD-D44677BCDF50}.Release|Any CPU.Build.0 = Release|Any CPU + {5FB9DFB8-2453-40EA-AAAD-D44677BCDF50}.Release|x64.ActiveCfg = Release|Any CPU + {5FB9DFB8-2453-40EA-AAAD-D44677BCDF50}.Release|x64.Build.0 = Release|Any CPU + {5FB9DFB8-2453-40EA-AAAD-D44677BCDF50}.Release|x86.ActiveCfg = Release|Any CPU + {5FB9DFB8-2453-40EA-AAAD-D44677BCDF50}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/test/TestAssets/child-crash/UnitTest1.cs b/test/TestAssets/child-crash/UnitTest1.cs new file mode 100644 index 0000000000..f35ac67928 --- /dev/null +++ b/test/TestAssets/child-crash/UnitTest1.cs @@ -0,0 +1,35 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; + +namespace child_crash +{ + [TestClass] + public class UnitTest1 + { + [TestMethod] + public void TestMethod1() + { +#if DEBUG + var directory = "Debug"; +#else + var directory = "Release"; +#endif + // wait for two children to crash + var childProcess = Path.GetFullPath($@"../../../../problematic-child/bin/{directory}/net5.0/problematic-child{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : ".dll")}"); + if (!File.Exists(childProcess)) + { + throw new FileNotFoundException(childProcess); + } + // 2 chidren, that is 3 crashing processes + (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? Process.Start(childProcess, "2") : Process.Start("dotnet", $"{childProcess} 2")).WaitForExit(); + + // then crash self with stack overflow (+1 crash) + Span s = stackalloc byte[int.MaxValue]; + + // we should get 4 crash dumps in total from this test + } + } +} diff --git a/test/TestAssets/child-crash/child-crash.csproj b/test/TestAssets/child-crash/child-crash.csproj new file mode 100644 index 0000000000..86196d9554 --- /dev/null +++ b/test/TestAssets/child-crash/child-crash.csproj @@ -0,0 +1,28 @@ + + + + ..\..\..\ + true + + + + + + + net5.0 + child_crash + false + + + + + + + + + + + + + + diff --git a/test/TestAssets/child-hang/UnitTest1.cs b/test/TestAssets/child-hang/UnitTest1.cs new file mode 100644 index 0000000000..1c0f378c8e --- /dev/null +++ b/test/TestAssets/child-hang/UnitTest1.cs @@ -0,0 +1,50 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; +using System.Threading; + +namespace child_hang +{ + [TestClass] + public class UnitTest1 + { + [TestMethod] + public void TestMethod1() + { +# if DEBUG + var directory = "Debug"; +#else + var directory = "Release"; +#endif + // wait for two children to crash + var childProcess = Path.GetFullPath($@"../../../../hanging-child/bin/{directory}/net5.0/hanging-child{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : ".dll")}"); + // 2 chidren, that is 3 hanging processes + var process = (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? Process.Start(childProcess, "2") : Process.Start(GetFullPath("dotnet"), $"{childProcess} 2")); + process.WaitForExit(); + + // then hang self (+1 hang) + Thread.Sleep(30_000); + + // we should get 4 hang dumps in total from this test + } + + public static string GetFullPath(string fileName) + { + if (File.Exists(fileName)) + return Path.GetFullPath(fileName); + + var values = Environment.GetEnvironmentVariable("PATH"); + foreach (var path in values.Split(Path.PathSeparator)) + { + var fullPath = Path.Combine(path, fileName); + if (File.Exists(fullPath)) + return fullPath; + } + return null; + } + } + + +} diff --git a/test/TestAssets/child-hang/child-hang.csproj b/test/TestAssets/child-hang/child-hang.csproj new file mode 100644 index 0000000000..3a85ae0c98 --- /dev/null +++ b/test/TestAssets/child-hang/child-hang.csproj @@ -0,0 +1,29 @@ + + + + ..\..\..\ + true + + + + + + + net452;net461;net472;net48;netcoreapp2.1;netcoreapp3.1;net5.0 + child_hang + false + + + + + + + + + + + + + + + diff --git a/test/TestAssets/crash/UnitTest1.cs b/test/TestAssets/crash/UnitTest1.cs new file mode 100644 index 0000000000..c3e0e3a547 --- /dev/null +++ b/test/TestAssets/crash/UnitTest1.cs @@ -0,0 +1,16 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; + +namespace timeout +{ + [TestClass] + public class UnitTest1 + { + [TestMethod] + public void TestMethod1() + { + // stack overflow + Span s = stackalloc byte[int.MaxValue]; + } + } +} diff --git a/test/TestAssets/crash/crash.csproj b/test/TestAssets/crash/crash.csproj new file mode 100644 index 0000000000..1ed7040168 --- /dev/null +++ b/test/TestAssets/crash/crash.csproj @@ -0,0 +1,25 @@ + + + + ..\..\..\ + true + + + + + + + net452;net461;net472;net48;netcoreapp2.1;netcoreapp3.1;net5.0 + + false + + + + + + + + + + + diff --git a/test/TestAssets/hanging-child/Program.cs b/test/TestAssets/hanging-child/Program.cs new file mode 100644 index 0000000000..62719c9a47 --- /dev/null +++ b/test/TestAssets/hanging-child/Program.cs @@ -0,0 +1,49 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Threading; + +namespace hanging_child +{ + class Program + { + static void Main(string[] args) + { + if (args.Length > 0) + { + var val = int.Parse(args[0]); + if (val > 0) + { + // 2 chidren, that is 3 hanging processes + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + Process.Start(Process.GetCurrentProcess().MainModule.FileName, (val - 1).ToString()); + } + else + { + var dll = Assembly.GetCallingAssembly().Location; + Process.Start(GetFullPath("dotnet"), $"{dll} {val - 1}"); + } + } + } + + Thread.Sleep(30_000); + } + public static string GetFullPath(string fileName) + { + if (File.Exists(fileName)) + return Path.GetFullPath(fileName); + + var values = Environment.GetEnvironmentVariable("PATH"); + foreach (var path in values.Split(Path.PathSeparator)) + { + var fullPath = Path.Combine(path, fileName); + if (File.Exists(fullPath)) + return fullPath; + } + return null; + } + } +} diff --git a/test/TestAssets/hanging-child/hanging-child.csproj b/test/TestAssets/hanging-child/hanging-child.csproj new file mode 100644 index 0000000000..767cd7f2ea --- /dev/null +++ b/test/TestAssets/hanging-child/hanging-child.csproj @@ -0,0 +1,21 @@ + + + + ..\..\..\ + true + + + + + + + net5.0 + Exe + hanging_child + + + + + + + diff --git a/test/TestAssets/problematic-child/Program.cs b/test/TestAssets/problematic-child/Program.cs new file mode 100644 index 0000000000..882c6972b4 --- /dev/null +++ b/test/TestAssets/problematic-child/Program.cs @@ -0,0 +1,59 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Threading; + +namespace problematic_child +{ + class Program + { + static void Main(string[] args) + { + if (args.Length > 0) + { + var val = int.Parse(args[0]); + if (val > 0) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + Process.Start(Process.GetCurrentProcess().MainModule.FileName, (val - 1).ToString()); + } + else + { + var dll = Assembly.GetCallingAssembly().Location; + // Console.WriteLine(">>>> staring child process { }"); + Process.Start(GetFullPath("dotnet"), $"{dll} {val - 1}"); + } + } + } + + // Console.WriteLine("Hello World!"); + Recursive(); + // this won't trigger createdump + // Task.Run(() => Recursive()).GetAwaiter().GetResult(); + } + + static void Recursive() + { + Recursive(); + } + + + public static string GetFullPath(string fileName) + { + if (File.Exists(fileName)) + return Path.GetFullPath(fileName); + + var values = Environment.GetEnvironmentVariable("PATH"); + foreach (var path in values.Split(Path.PathSeparator)) + { + var fullPath = Path.Combine(path, fileName); + if (File.Exists(fullPath)) + return fullPath; + } + return null; + } + } +} diff --git a/test/TestAssets/problematic-child/problematic-child.csproj b/test/TestAssets/problematic-child/problematic-child.csproj new file mode 100644 index 0000000000..2a504e5180 --- /dev/null +++ b/test/TestAssets/problematic-child/problematic-child.csproj @@ -0,0 +1,21 @@ + + + + ..\..\..\ + true + + + + + + + net5.0 + Exe + problematic_child + + + + + + + diff --git a/test/TestAssets/timeout/UnitTest1.cs b/test/TestAssets/timeout/UnitTest1.cs new file mode 100644 index 0000000000..22cf1b532a --- /dev/null +++ b/test/TestAssets/timeout/UnitTest1.cs @@ -0,0 +1,15 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Threading; + +namespace timeout +{ + [TestClass] + public class UnitTest1 + { + [TestMethod] + public void TestMethod1() + { + Thread.Sleep(10_000); + } + } +} diff --git a/test/TestAssets/timeout/timeout.csproj b/test/TestAssets/timeout/timeout.csproj new file mode 100644 index 0000000000..ef9860b43f --- /dev/null +++ b/test/TestAssets/timeout/timeout.csproj @@ -0,0 +1,24 @@ + + + + ..\..\..\ + true + + + + + + + net452;net461;net472;net48;netcoreapp2.1;netcoreapp3.1;net5.0 + + false + + + + + + + + + +