From b2a99b125f8e5e3af9d9ba96600891ff12e4e27c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Fri, 21 Aug 2020 14:16:59 +0200 Subject: [PATCH 01/11] Optionally force procdump (#2531) * Optionally force usage of ProcDump * Merge --- .../CrashDumperFactory.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/CrashDumperFactory.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/CrashDumperFactory.cs index 06d5eda6a4..2adb34df10 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/CrashDumperFactory.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/CrashDumperFactory.cs @@ -37,6 +37,20 @@ public ICrashDumper Create(string targetFramework) return new ProcDumpCrashDumper(); } + // On net5.0 we don't have the capability to crash dump on exit, which is useful in rare cases + // like when user exits the testhost process with a random exit code, adding this evn variable + // to force using procdump. This relies on netclient dumper actualy doing all it's work in blame collector + // where it sets all the environment variables, so in effect we will have two crash dumpers active at the same time. + // This proven to be working okay while net5.0 could not create dumps from Task.Run, and I was using this same technique + // to get dump of testhost. This needs PROCDUMP_PATH set to directory with procdump.exe, or having it in path. + var procdumpOverride = Environment.GetEnvironmentVariable("VSTEST_DUMP_FORCEPROCDUMP")?.Trim(); + var forceUsingProcdump = string.IsNullOrWhiteSpace(procdumpOverride) && procdumpOverride != "0"; + if (forceUsingProcdump) + { + EqtTrace.Info($"CrashDumperFactory: This is Windows on {targetFramework}. Forcing the use of ProcDumpCrashDumper that uses ProcDump utility, via VSTEST_DUMP_FORCEPROCDUMP={procdumpOverride}."); + return new ProcDumpCrashDumper(); + } + EqtTrace.Info($"CrashDumperFactory: This is Windows on {targetFramework}, returning the .NETClient dumper which uses env variables to collect crashdumps of testhost and any child process."); return new NetClientCrashDumper(); } From a632b49509ac31f3e8e4deb35b1203095b26cd81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Tue, 25 Aug 2020 13:21:10 +0200 Subject: [PATCH 02/11] Print version of the product in log (#2536) --- TestPlatform.sln | 1 + src/datacollector/DataCollectorMain.cs | 12 +++++++++++- src/testhost.x86/DefaultEngineInvoker.cs | 12 +++++++++++- .../Processors/EnableDiagArgumentProcessor.cs | 5 +++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/TestPlatform.sln b/TestPlatform.sln index 1fc804afa4..cd278af64a 100644 --- a/TestPlatform.sln +++ b/TestPlatform.sln @@ -815,6 +815,7 @@ Global {9EFCEFB5-253E-4DE2-8A70-821D7B8189DF} = {B27FAFDF-2DBA-4AB0-BA85-FD5F21D359D6} {3A8080FB-9C93-45B9-8EB5-828DDC31FDF0} = {B27FAFDF-2DBA-4AB0-BA85-FD5F21D359D6} {BFF7714C-E5A3-4EEB-B04B-5FA47F29AD03} = {020E15EA-731F-4667-95AF-226671E0C3AE} + {E344E0A2-7715-4C7F-BAF7-D64EA94CB19B} = {EE49F5DC-5835-4AE3-B3BA-8BDE0AD56330} {DD9382B5-5EC4-4B3D-BEB7-95423731AE29} = {46250E12-4CF1-4051-B4A7-80C8C06E0068} {156F8811-28BB-4EC7-87D9-434F10FB7DBE} = {46250E12-4CF1-4051-B4A7-80C8C06E0068} {A5B167ED-873A-4762-9326-5F43B8D3AFF6} = {595BE9C1-E10F-4E50-938A-E6C248D3F950} diff --git a/src/datacollector/DataCollectorMain.cs b/src/datacollector/DataCollectorMain.cs index 106cbda3c5..5e094459c9 100644 --- a/src/datacollector/DataCollectorMain.cs +++ b/src/datacollector/DataCollectorMain.cs @@ -6,7 +6,7 @@ namespace Microsoft.VisualStudio.TestPlatform.DataCollector using System; using System.Diagnostics; using System.Globalization; - + using System.Reflection; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection.Interfaces; @@ -79,6 +79,7 @@ public void Run(string[] args) // Initialize trace. EqtTrace.InitializeTrace(logFile, traceLevel); + // Log warning in case tracelevel passed in arg is invalid if (!isTraceLevelArgValid) { @@ -90,6 +91,15 @@ public void Run(string[] args) EqtTrace.DoNotInitailize = true; } + if (EqtTrace.IsVerboseEnabled) + { + var version = typeof(DataCollectorMain) + .GetTypeInfo() + .Assembly + .GetCustomAttribute()?.InformationalVersion; + EqtTrace.Verbose($"Version: { version }"); + } + SetCultureSpecifiedByUser(); EqtTrace.Info("DataCollectorMain.Run: Starting data collector run with args: {0}", string.Join(",", args)); diff --git a/src/testhost.x86/DefaultEngineInvoker.cs b/src/testhost.x86/DefaultEngineInvoker.cs index 7495aa848c..6538bba96c 100644 --- a/src/testhost.x86/DefaultEngineInvoker.cs +++ b/src/testhost.x86/DefaultEngineInvoker.cs @@ -7,6 +7,7 @@ namespace Microsoft.VisualStudio.TestPlatform.TestHost using System.Collections.Generic; using System.Globalization; using System.Net; + using System.Reflection; using System.Threading; using System.Threading.Tasks; using Microsoft.VisualStudio.TestPlatform.Common; @@ -73,6 +74,15 @@ public void Invoke(IDictionary argsDictionary) { DefaultEngineInvoker.InitializeEqtTrace(argsDictionary); + if (EqtTrace.IsVerboseEnabled) + { + var version = typeof(DefaultEngineInvoker) + .GetTypeInfo() + .Assembly + .GetCustomAttribute()?.InformationalVersion; + EqtTrace.Verbose($"Version: { version }"); + } + if (EqtTrace.IsInfoEnabled) { EqtTrace.Info("DefaultEngineInvoker.Invoke: Testhost process started with args :{0}", @@ -142,7 +152,7 @@ private static RequestData GetRequestData(IDictionary argsDictio { MetricsCollection = telemetryOptedIn - ? (IMetricsCollection) new MetricsCollection() + ? (IMetricsCollection)new MetricsCollection() : new NoOpMetricsCollection(), IsTelemetryOptedIn = telemetryOptedIn }; diff --git a/src/vstest.console/Processors/EnableDiagArgumentProcessor.cs b/src/vstest.console/Processors/EnableDiagArgumentProcessor.cs index 2656c0105c..045e7921ed 100644 --- a/src/vstest.console/Processors/EnableDiagArgumentProcessor.cs +++ b/src/vstest.console/Processors/EnableDiagArgumentProcessor.cs @@ -8,6 +8,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Processors using System.Globalization; using System.IO; using System.Linq; + using Microsoft.VisualStudio.TestPlatform.CommandLine.Internal; using Microsoft.VisualStudio.TestPlatform.CommandLine.Processors.Utilities; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.Utilities; @@ -153,6 +154,10 @@ public void Initialize(string argument) // Initialize diag logging. InitializeDiagLogging(diagFilePath, diagParameters); + + // Write version to the log here, because that is the + // first place where we know if we log or not. + EqtTrace.Verbose($"Version: {Product.Version}"); } /// From 6ba6af0cb11482425a5eae72e4bb2b4fbf0bdb69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Tue, 25 Aug 2020 13:25:27 +0200 Subject: [PATCH 03/11] Merge rel16.7 into master (#2534) * Hide -release in console * Add param block * Match on whole branch name * Set var * Change assertion * Trim version * Update dependencies from https://github.com/dotnet/arcade build 20200602.3 (#2456) Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.SignTool , Microsoft.DotNet.SwaggerGenerator.MSBuild From Version 5.0.0-beta.20052.1 -> To Version 1.0.0-beta.20302.3 Co-authored-by: dotnet-maestro[bot] * Update feeds * Revert to previous dotnet version * Added new exception handling (#2461) * Test space added * Exception handler was added to catch AccessDeniedException while trying to create TestResults folder * Remove unnecessary space * Deleted unnecessary test. Changed console message and corrected folder path in that message * Remove unnecessary dot * Removed unnecessary lines and usings and coreccted exception message * Removed unnecessary line * Updating resource files * New exception handling was added * Formatted exception message * Adding test run attachments processing (#2463) * v1 * Merging v1 * Rename to MultiTestRunsFinalization * New version * More changes * More changes * Next changes * Fix * test * More changes * Dmc chagnes * next * small changes * compiled * More changes * acceptance tests green * Review comments #1 * Resolving more comments * Tests for design mode client * Tests for events handler * revert not related changes * More changes * Compiling OK, tests OK * Unit tests for manager * More changes * More tests * tests for reqeust sender * more tests * Tests for cancelling * Acceptance tests done * Remove not used stuff * Fix comments * Fix race condition in test * Fix another race condition * Fix converting to xml * fix next test * fix test * Next changes * Review changes #1 * Fixing multi test finalization manager tests * Fixes * Fix last unit test * Fix acceptance tests * Progress feature, compiling + unit tests * acceptance tests changes * More changes * Fixing resources accesability * Fix test * Fix race conditions in acceptance tests * RFC changes merged * Log warning in case of unexpected message id * Fix spelling * Additional comment * Restore some stuff in interfaces * Big renaming * Added processingSettings * Fix naming * Move explanation to * Fixed code coverage compatibility issue (#2527) Fixed code coverage compatibility issue Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: dotnet-maestro[bot] Co-authored-by: Sanan Yuzbashiyev Co-authored-by: Jakub Chocholowicz <59966772+jakubch1@users.noreply.github.com> Co-authored-by: Codrin-Victor Poienaru --- scripts/verify-nupkgs.ps1 | 3 ++- scripts/vsts-prebuild.ps1 | 17 ++++++++++++++--- src/vstest.console/CommandLine/Executor.cs | 18 ++++++++++++++---- .../ExecutorUnitTests.cs | 14 ++++++++------ 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/scripts/verify-nupkgs.ps1 b/scripts/verify-nupkgs.ps1 index ca37e0fffb..de298b360c 100644 --- a/scripts/verify-nupkgs.ps1 +++ b/scripts/verify-nupkgs.ps1 @@ -12,7 +12,8 @@ function Unzip function Verify-Nuget-Packages($packageDirectory) { Write-Log "Starting Verify-Nuget-Packages." - $expectedNumOfFiles = @{"Microsoft.CodeCoverage" = 29; + $expectedNumOfFiles = @{ + "Microsoft.CodeCoverage" = 29; "Microsoft.NET.Test.Sdk" = 13; "Microsoft.TestPlatform" = 469; "Microsoft.TestPlatform.Build" = 19; diff --git a/scripts/vsts-prebuild.ps1 b/scripts/vsts-prebuild.ps1 index f49ad135a2..ba170867ad 100644 --- a/scripts/vsts-prebuild.ps1 +++ b/scripts/vsts-prebuild.ps1 @@ -1,7 +1,13 @@ # Sets variables which are used across the build tasks. -$buildSuffix = $args[0] -$IsRtmBuild = $args[1] +param ( + [Parameter(Mandatory)] + [string] $BuildSuffix, + [Parameter(Mandatory)] + [string] $IsRtmBuild, + [Parameter(Mandatory)] + $Branch +) $TP_ROOT_DIR = (Get-Item (Split-Path $MyInvocation.MyCommand.Path)).Parent.FullName @@ -11,9 +17,14 @@ $buildPrefix = $TpVersion.Trim() if ($IsRtmBuild.ToLower() -eq "false") { + if ($null -ne $Branch -and $Branch -like "refs/heads/rel/*") + { + $BuildSuffix = $BuildSuffix -replace "preview", "release" + } + $packageVersion = $buildPrefix+"-"+$buildSuffix } -else +else { $packageVersion = $buildPrefix $buildSuffix = [string]::Empty diff --git a/src/vstest.console/CommandLine/Executor.cs b/src/vstest.console/CommandLine/Executor.cs index 52beddf73e..7c4b033d30 100644 --- a/src/vstest.console/CommandLine/Executor.cs +++ b/src/vstest.console/CommandLine/Executor.cs @@ -99,7 +99,8 @@ internal int Execute(params string[] args) } else { - this.PrintSplashScreen(); + var isDiag = args != null && args.Any(arg => arg.StartsWith("--diag", StringComparison.OrdinalIgnoreCase)); + this.PrintSplashScreen(isDiag); } int exitCode = 0; @@ -375,10 +376,19 @@ private bool ExecuteArgumentProcessor(IArgumentProcessor processor, ref int exit /// /// Displays the Company and Copyright splash title info immediately after launch /// - private void PrintSplashScreen() + private void PrintSplashScreen(bool isDiag) { - string assemblyVersion = string.Empty; - assemblyVersion = Product.Version; + string assemblyVersion = Product.Version; + if (!isDiag) + { + var end = Product.Version?.IndexOf("-release"); + + if (end >= 0) + { + assemblyVersion = Product.Version?.Substring(0, end.Value); + } + } + string commandLineBanner = string.Format(CultureInfo.CurrentUICulture, CommandLineResources.MicrosoftCommandLineTitle, assemblyVersion); this.Output.WriteLine(commandLineBanner, OutputLevel.Information); this.Output.WriteLine(CommandLineResources.CopyrightCommandLineTitle, OutputLevel.Information); diff --git a/test/vstest.console.UnitTests/ExecutorUnitTests.cs b/test/vstest.console.UnitTests/ExecutorUnitTests.cs index 0585398afb..3fe3820b8f 100644 --- a/test/vstest.console.UnitTests/ExecutorUnitTests.cs +++ b/test/vstest.console.UnitTests/ExecutorUnitTests.cs @@ -50,12 +50,14 @@ public void ExecutorPrintsSplashScreenTest() Assert.IsNotNull(mockOutput.Messages.First().Message, "First Printed Message cannot be null or empty"); // Just check first 20 characters - don't need to check whole thing as assembly version is variable - Assert.IsTrue( - mockOutput.Messages.First() - .Message.Contains(CommandLineResources.MicrosoftCommandLineTitle.Substring(0, 20)), - "First Printed message must be Microsoft Copyright"); - - Assert.IsTrue(mockOutput.Messages.First().Message.EndsWith(assemblyVersion)); + // "First Printed message must be Microsoft Copyright"); + StringAssert.Contains(mockOutput.Messages.First().Message, + CommandLineResources.MicrosoftCommandLineTitle.Substring(0, 20)); + + var suffixIndex = assemblyVersion.IndexOf("-"); + var version = suffixIndex == -1 ? assemblyVersion : assemblyVersion.Substring(0, suffixIndex); + StringAssert.Contains(mockOutput.Messages.First().Message, + version); } [TestMethod] From b5f1b2645b677344a31aaed0b7460623ce94e2d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 26 Aug 2020 17:43:10 +0200 Subject: [PATCH 04/11] Trigger dumps asynchronously (#2542) * Trigger dumps asynchronously (#2533) * Run each dump in a task in netclient dumper * More reasonable timeout * Formatting fixed --- .../NetClientHangDumper.cs | 59 +++++++++++-------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/NetClientHangDumper.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/NetClientHangDumper.cs index 2a7d0e16d6..3d0d52d6a6 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/NetClientHangDumper.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/NetClientHangDumper.cs @@ -4,9 +4,12 @@ namespace Microsoft.TestPlatform.Extensions.BlameDataCollector { using System; + using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; + using System.Threading; + using System.Threading.Tasks; using Microsoft.Diagnostics.NETCore.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.Utilities; @@ -40,35 +43,45 @@ public void Dump(int processId, string outputDirectory, DumpTypeOption type) var bottomUpTree = processTree.OrderByDescending(t => t.Level).Select(t => t.Process); + // Do not suspend processes with NetClient dumper it stops the diagnostic thread running in + // them and hang dump request will get stuck forever, because the process is not co-operating. + // Instead we start one task per dump asynchronously, and hope that the parent process will start dumping + // before the child process is done dumping. This way if the parent is waiting for the children to exit, + // we will be dumping it before it observes the child exiting and we get a more accurate results. If we did not + // do this, then parent that is awaiting child might exit before we get to dumping it. + var tasks = new List(); + var timeout = new CancellationTokenSource(); + timeout.CancelAfter(TimeSpan.FromMinutes(5)); foreach (var p in bottomUpTree) { - try - { - p.Suspend(); - } - catch (Exception ex) + tasks.Add(Task.Run( + () => { - EqtTrace.Error($"NetClientHangDumper.Dump: Error suspending process {p.Id} - {p.ProcessName}: {ex}."); - } - } + try + { + var outputFile = Path.Combine(outputDirectory, $"{p.ProcessName}_{p.Id}_{DateTime.Now:yyyyMMddTHHmmss}_hangdump.dmp"); + EqtTrace.Verbose($"NetClientHangDumper.CollectDump: Selected dump type {type}. Dumping {process.Id} - {process.ProcessName} in {outputFile}. "); - foreach (var p in bottomUpTree) - { - try - { - var outputFile = Path.Combine(outputDirectory, $"{p.ProcessName}_{p.Id}_{DateTime.Now:yyyyMMddTHHmmss}_hangdump.dmp"); - EqtTrace.Verbose($"NetClientHangDumper.CollectDump: Selected dump type {type}. Dumping {process.Id} - {process.ProcessName} in {outputFile}. "); + var client = new DiagnosticsClient(p.Id); - var client = new DiagnosticsClient(p.Id); + // Connecting the dump generation logging to verbose output to avoid changing the interfaces again -> EqtTrace.IsVerboseEnabled + // before we test this on some big repo. + client.WriteDump(type == DumpTypeOption.Full ? DumpType.Full : DumpType.Normal, outputFile, logDumpGeneration: false); + } + catch (Exception ex) + { + EqtTrace.Error($"NetClientHangDumper.Dump: Error dumping process {p.Id} - {p.ProcessName}: {ex}."); + } + }, timeout.Token)); + } - // Connecting the dump generation logging to verbose output to avoid changing the interfaces again -> EqtTrace.IsVerboseEnabled - // before we test this on some big repo. - client.WriteDump(type == DumpTypeOption.Full ? DumpType.Full : DumpType.Normal, outputFile, logDumpGeneration: false); - } - catch (Exception ex) - { - EqtTrace.Error($"NetClientHangDumper.Dump: Error dumping process {p.Id} - {p.ProcessName}: {ex}."); - } + try + { + Task.WhenAll(tasks).GetAwaiter().GetResult(); + } + catch (TaskCanceledException) + { + EqtTrace.Error($"NetClientHangDumper.Dump: Hang dump timed out."); } foreach (var p in bottomUpTree) From 84db4e8db8425e164feff233c6f5ac6a7db42cd8 Mon Sep 17 00:00:00 2001 From: Vritant Bhardwaj Date: Wed, 26 Aug 2020 14:53:33 -0700 Subject: [PATCH 05/11] Add binaries to enable running Fakes in Net Core (#2529) * added testrunnerharness consumption for fakes * added new package version * fixed x86 config --- scripts/build.ps1 | 2 +- scripts/build/TestPlatform.Dependencies.props | 2 +- scripts/verify-nupkgs.ps1 | 2 +- scripts/vsts-prebuild.ps1 | 2 +- src/package/external/external.csproj | 2 +- .../nuspec/Microsoft.TestPlatform.nuspec | 17 ++++++++++++++--- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index f5beb59f84..a2bf383069 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -717,7 +717,7 @@ function Create-NugetPackages # Additional external dependency folders $microsoftFakesVersion = ([xml](Get-Content $env:TP_ROOT_DIR\scripts\build\TestPlatform.Dependencies.props)).Project.PropertyGroup.MicrosoftFakesVersion - $FakesPackageDir = Join-Path $env:TP_PACKAGES_DIR "Microsoft.VisualStudio.TestPlatform.Fakes\$microsoftFakesVersion\lib" + $FakesPackageDir = Join-Path $env:TP_PACKAGES_DIR "Microsoft.QualityTools.Testing.Fakes.TestRunnerHarness\$microsoftFakesVersion\contentFiles" # package them from stagingDir foreach ($file in $nuspecFiles) { diff --git a/scripts/build/TestPlatform.Dependencies.props b/scripts/build/TestPlatform.Dependencies.props index 6c775999d0..e324c3fe1d 100644 --- a/scripts/build/TestPlatform.Dependencies.props +++ b/scripts/build/TestPlatform.Dependencies.props @@ -32,7 +32,7 @@ 9.0.1 4.7.63 16.8.0-preview-3968212 - 16.6.3-beta.20221.2 + 16.8.0-beta.20420.2 16.0.461 $(MicrosoftBuildPackageVersion) diff --git a/scripts/verify-nupkgs.ps1 b/scripts/verify-nupkgs.ps1 index de298b360c..ca4fe4fbf0 100644 --- a/scripts/verify-nupkgs.ps1 +++ b/scripts/verify-nupkgs.ps1 @@ -15,7 +15,7 @@ function Verify-Nuget-Packages($packageDirectory) $expectedNumOfFiles = @{ "Microsoft.CodeCoverage" = 29; "Microsoft.NET.Test.Sdk" = 13; - "Microsoft.TestPlatform" = 469; + "Microsoft.TestPlatform" = 477; "Microsoft.TestPlatform.Build" = 19; "Microsoft.TestPlatform.CLI" = 350; "Microsoft.TestPlatform.Extensions.TrxLogger" = 33; diff --git a/scripts/vsts-prebuild.ps1 b/scripts/vsts-prebuild.ps1 index ba170867ad..9fe4025d54 100644 --- a/scripts/vsts-prebuild.ps1 +++ b/scripts/vsts-prebuild.ps1 @@ -41,5 +41,5 @@ $JsonNetVersion = ([xml](Get-Content $TP_ROOT_DIR\scripts\build\TestPlatform.Dep Write-Host "##vso[task.setvariable variable=JsonNetVersion;]$JsonNetVersion" $microsoftFakesVersion = ([xml](Get-Content $TP_ROOT_DIR\scripts\build\TestPlatform.Dependencies.props)).Project.PropertyGroup.MicrosoftFakesVersion -$FakesPackageDir = Join-Path $TP_ROOT_DIR "packages\Microsoft.VisualStudio.TestPlatform.Fakes\$microsoftFakesVersion\lib" +$FakesPackageDir = Join-Path $TP_ROOT_DIR "packages\Microsoft.QualityTools.Testing.Fakes.TestRunnerHarness\$microsoftFakesVersion\contentFiles" Write-Host "##vso[task.setvariable variable=FakesPackageDir;]$FakesPackageDir" diff --git a/src/package/external/external.csproj b/src/package/external/external.csproj index 9224602d52..87a409c7b2 100644 --- a/src/package/external/external.csproj +++ b/src/package/external/external.csproj @@ -89,7 +89,7 @@ 16.3.23 All - + $(MicrosoftFakesVersion) All diff --git a/src/package/nuspec/Microsoft.TestPlatform.nuspec b/src/package/nuspec/Microsoft.TestPlatform.nuspec index c473e1bcd5..61a9b3531e 100644 --- a/src/package/nuspec/Microsoft.TestPlatform.nuspec +++ b/src/package/nuspec/Microsoft.TestPlatform.nuspec @@ -245,7 +245,7 @@ - + @@ -404,7 +404,7 @@ - + @@ -489,6 +489,17 @@ - + + + + + + + + + + + + From fc406ab92490c368d569dfafbb7106903bda5b2e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 28 Aug 2020 13:59:06 +0200 Subject: [PATCH 06/11] Update dependencies from https://github.com/dotnet/arcade build 20200827.2 (#2546) Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.SignTool , Microsoft.DotNet.SwaggerGenerator.MSBuild From Version 1.0.0-beta.20411.9 -> To Version 1.0.0-beta.20427.2 Co-authored-by: dotnet-maestro[bot] --- NuGet.config | 1 + eng/Version.Details.xml | 20 ++++++++++---------- eng/Versions.props | 6 +++--- eng/common/darc-init.sh | 30 ++++++++++++++++++++++-------- global.json | 4 ++-- 5 files changed, 38 insertions(+), 23 deletions(-) diff --git a/NuGet.config b/NuGet.config index 87909589d8..12ce55053a 100644 --- a/NuGet.config +++ b/NuGet.config @@ -23,4 +23,5 @@ + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0bd729be70..060c0b8bc5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,25 +3,25 @@ - + https://github.com/dotnet/arcade - 2e804f8d57972faf64a19a7295728dc7bfcb5fce + 5f8175b1d50da9a718c81824d65d3935b4c9446a - + https://github.com/dotnet/arcade - 2e804f8d57972faf64a19a7295728dc7bfcb5fce + 5f8175b1d50da9a718c81824d65d3935b4c9446a - + https://github.com/dotnet/arcade - 2e804f8d57972faf64a19a7295728dc7bfcb5fce + 5f8175b1d50da9a718c81824d65d3935b4c9446a - + https://github.com/dotnet/arcade - 2e804f8d57972faf64a19a7295728dc7bfcb5fce + 5f8175b1d50da9a718c81824d65d3935b4c9446a - + https://github.com/dotnet/arcade - 2e804f8d57972faf64a19a7295728dc7bfcb5fce + 5f8175b1d50da9a718c81824d65d3935b4c9446a https://github.com/dotnet/arcade-services diff --git a/eng/Versions.props b/eng/Versions.props index c154fd1efd..f91658b23f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -60,8 +60,8 @@ 2.4.1 2.0.3 2.4.1 - 2.2.0-beta.20411.9 - 1.0.0-beta.20411.9 + 2.2.0-beta.20427.2 + 1.0.0-beta.20427.2 1.22.0 1.1.2 2.0.0 @@ -73,7 +73,7 @@ 1.7.0 1.1.0-beta.19556.4 1.0.0-beta2-19554-01 - 1.0.0-beta.20411.9 + 1.0.0-beta.20427.2 1.0.0-beta.20055.1 diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh index 242429bca6..06b6534252 100644 --- a/eng/common/darc-init.sh +++ b/eng/common/darc-init.sh @@ -2,8 +2,8 @@ source="${BASH_SOURCE[0]}" darcVersion='' -versionEndpoint="https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16" -verbosity=m +versionEndpoint='https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16' +verbosity='minimal' while [[ $# > 0 ]]; do opt="$(echo "$1" | awk '{print tolower($0)}')" @@ -20,6 +20,10 @@ while [[ $# > 0 ]]; do verbosity=$2 shift ;; + --toolpath) + toolpath=$2 + shift + ;; *) echo "Invalid argument: $1" usage @@ -52,17 +56,27 @@ function InstallDarcCli { InitializeDotNetCli local dotnet_root=$_InitializeDotNetCli - local uninstall_command=`$dotnet_root/dotnet tool uninstall $darc_cli_package_name -g` - local tool_list=$($dotnet_root/dotnet tool list -g) - if [[ $tool_list = *$darc_cli_package_name* ]]; then - echo $($dotnet_root/dotnet tool uninstall $darc_cli_package_name -g) + if [ -z "$toolpath" ]; then + local tool_list=$($dotnet_root/dotnet tool list -g) + if [[ $tool_list = *$darc_cli_package_name* ]]; then + echo $($dotnet_root/dotnet tool uninstall $darc_cli_package_name -g) + fi + else + local tool_list=$($dotnet_root/dotnet tool list --tool-path "$toolpath") + if [[ $tool_list = *$darc_cli_package_name* ]]; then + echo $($dotnet_root/dotnet tool uninstall $darc_cli_package_name --tool-path "$toolpath") + fi fi - local arcadeServicesSource="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" + local arcadeServicesSource="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" echo "Installing Darc CLI version $darcVersion..." echo "You may need to restart your command shell if this is the first dotnet tool you have installed." - echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g) + if [ -z "$toolpath" ]; then + echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g) + else + echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath") + fi } InstallDarcCli diff --git a/global.json b/global.json index c43398e67e..9218ec224e 100644 --- a/global.json +++ b/global.json @@ -9,7 +9,7 @@ "dotnet": "5.0.100-rc.1.20380.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20411.9", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.20411.9" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20427.2", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.20427.2" } } From 2f27b25ad700b5cfacebdea334a5a5d8388a72bc Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 29 Aug 2020 20:47:59 +0200 Subject: [PATCH 07/11] Update dependencies from https://github.com/dotnet/arcade build 20200827.6 (#2547) Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.SignTool , Microsoft.DotNet.SwaggerGenerator.MSBuild From Version 1.0.0-beta.20411.9 -> To Version 1.0.0-beta.20427.6 Co-authored-by: dotnet-maestro[bot] Co-authored-by: nohwnd --- eng/Version.Details.xml | 20 ++++++++++---------- eng/Versions.props | 6 +++--- global.json | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 060c0b8bc5..bb37ef4000 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,25 +3,25 @@ - + https://github.com/dotnet/arcade - 5f8175b1d50da9a718c81824d65d3935b4c9446a + 84cd401ce792220bdb17c5587f9b39265170c03f - + https://github.com/dotnet/arcade - 5f8175b1d50da9a718c81824d65d3935b4c9446a + 84cd401ce792220bdb17c5587f9b39265170c03f - + https://github.com/dotnet/arcade - 5f8175b1d50da9a718c81824d65d3935b4c9446a + 84cd401ce792220bdb17c5587f9b39265170c03f - + https://github.com/dotnet/arcade - 5f8175b1d50da9a718c81824d65d3935b4c9446a + 84cd401ce792220bdb17c5587f9b39265170c03f - + https://github.com/dotnet/arcade - 5f8175b1d50da9a718c81824d65d3935b4c9446a + 84cd401ce792220bdb17c5587f9b39265170c03f https://github.com/dotnet/arcade-services diff --git a/eng/Versions.props b/eng/Versions.props index f91658b23f..cf2f683048 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -60,8 +60,8 @@ 2.4.1 2.0.3 2.4.1 - 2.2.0-beta.20427.2 - 1.0.0-beta.20427.2 + 2.2.0-beta.20427.6 + 1.0.0-beta.20427.6 1.22.0 1.1.2 2.0.0 @@ -73,7 +73,7 @@ 1.7.0 1.1.0-beta.19556.4 1.0.0-beta2-19554-01 - 1.0.0-beta.20427.2 + 1.0.0-beta.20427.6 1.0.0-beta.20055.1 diff --git a/global.json b/global.json index 9218ec224e..ee8ab86fd2 100644 --- a/global.json +++ b/global.json @@ -9,7 +9,7 @@ "dotnet": "5.0.100-rc.1.20380.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20427.2", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.20427.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20427.6", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.20427.6" } } From 327c4282bd92f48862077bf8f0dac5d1115f945c Mon Sep 17 00:00:00 2001 From: Codrin-Victor Poienaru Date: Tue, 1 Sep 2020 11:29:17 +0200 Subject: [PATCH 08/11] Changes to allow special characters in parameter names (#2481) Allow separators on parameter names. --- .../RunSettingsProviderExtensions.cs | 2 +- .../RunSettingsProviderExtensionsTests.cs | 45 ++++++++++++++++--- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsProviderExtensions.cs b/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsProviderExtensions.cs index 99f6909bdd..c6e981289d 100644 --- a/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsProviderExtensions.cs +++ b/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsProviderExtensions.cs @@ -95,7 +95,7 @@ public static void UpdateRunSettingsNode(this IRunSettingsProvider runSettingsPr /// public static Match GetTestRunParameterNodeMatch(this IRunSettingsProvider runSettingsProvider, string node) { - var attrName = $"(?<{AttributeNameString}>\\w+)"; + var attrName = $"(?<{AttributeNameString}>[\\w.:-]+)"; var attrValue = $"(?<{AttributeValueString}>.+)"; Regex regex = new Regex($"{Constants.TestRunParametersName}.{ParameterString}\\(name\\s*=\\s*\"{attrName}\"\\s*,\\s*value\\s*=\\s*\"{attrValue}\"\\)"); Match match = regex.Match(node); diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/RunSettingsProviderExtensionsTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/RunSettingsProviderExtensionsTests.cs index 82e834be78..ffb741dbed 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/RunSettingsProviderExtensionsTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/RunSettingsProviderExtensionsTests.cs @@ -134,13 +134,7 @@ public void UpdateRunSettingsNodeShouldAddNewKeyIfNotPresent() [TestMethod] public void UpdateTestRunParameterSettingsNodeShouldAddNewKeyIfNotPresent() { - var match = this.runSettingsProvider.GetTestRunParameterNodeMatch("TestRunParameters.Parameter(name=\"weburl\",value=\"http://localhost//abc\")"); - var runSettingsWithTestRunParameters = "\r\n\r\n \r\n \r\n \r\n"; - - this.runSettingsProvider.UpdateRunSettings("\r\n "); - this.runSettingsProvider.UpdateTestRunParameterSettingsNode(match); - - Assert.AreEqual(runSettingsWithTestRunParameters, this.runSettingsProvider.ActiveRunSettings.SettingsXml); + this.CheckRunSettingsAreUpdated("weburl", @"http://localhost//abc"); } [TestMethod] @@ -156,6 +150,24 @@ public void UpdateTetsRunParameterSettingsNodeShouldOverrideValueIfKeyIsAlreadyP Assert.AreEqual(runSettingsWithTestRunParametersOverrode, this.runSettingsProvider.ActiveRunSettings.SettingsXml); } + [TestMethod] + public void TestRunParameterSettingsNodeCanContainSpecialCharacters() + { + this.CheckRunSettingsAreUpdated("weburl:name", @"http://localhost//abc"); + } + + [TestMethod] + public void TestRunParameterSettingsNodeCanBeJustASingleCharacter() + { + this.CheckRunSettingsAreUpdated("a", @"http://localhost//abc"); + } + + [TestMethod] + public void TestRunParameterSettingsNodeCanMixSpecialCharacters() + { + this.CheckRunSettingsAreUpdated("___this_Should:be-valid.2", @"http://localhost//abc"); + } + [TestMethod] public void UpdateRunSettingsNodeShouldUpdateKeyIfAlreadyPresent() { @@ -230,6 +242,25 @@ public void QueryRunSettingsNodeShouldReturnCorrectValue() Assert.AreEqual("x86", this.runSettingsProvider.QueryRunSettingsNode("RunConfiguration.TargetPlatform")); } + private void CheckRunSettingsAreUpdated(string parameterName, string parameterValue) + { + var match = this.runSettingsProvider.GetTestRunParameterNodeMatch( + $@"TestRunParameters.Parameter(name=""{parameterName}"",value=""{parameterValue}"")"); + var runSettingsWithTestRunParameters = string.Join( + Environment.NewLine, + $@"", + $@"", + $@" ", + $@" ", + $@" ", + $@""); + + this.runSettingsProvider.UpdateRunSettings("\r\n "); + this.runSettingsProvider.UpdateTestRunParameterSettingsNode(match); + + Assert.AreEqual(runSettingsWithTestRunParameters, this.runSettingsProvider.ActiveRunSettings.SettingsXml); + } + private class TestableRunSettingsProvider : IRunSettingsProvider { public RunSettings ActiveRunSettings From ddda5905bb5429fb26abbb856ad2b60535b5d0df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Tue, 1 Sep 2020 14:25:28 +0200 Subject: [PATCH 09/11] Improve blame (#2552) * Hide -release in console * Add param block * Match on whole branch name * Set var * Change assertion * Trim version * Update dependencies from https://github.com/dotnet/arcade build 20200602.3 (#2456) Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.SignTool , Microsoft.DotNet.SwaggerGenerator.MSBuild From Version 5.0.0-beta.20052.1 -> To Version 1.0.0-beta.20302.3 Co-authored-by: dotnet-maestro[bot] * Update feeds * Revert to previous dotnet version * Added new exception handling (#2461) * Test space added * Exception handler was added to catch AccessDeniedException while trying to create TestResults folder * Remove unnecessary space * Deleted unnecessary test. Changed console message and corrected folder path in that message * Remove unnecessary dot * Removed unnecessary lines and usings and coreccted exception message * Removed unnecessary line * Updating resource files * New exception handling was added * Formatted exception message * Adding test run attachments processing (#2463) * v1 * Merging v1 * Rename to MultiTestRunsFinalization * New version * More changes * More changes * Next changes * Fix * test * More changes * Dmc chagnes * next * small changes * compiled * More changes * acceptance tests green * Review comments #1 * Resolving more comments * Tests for design mode client * Tests for events handler * revert not related changes * More changes * Compiling OK, tests OK * Unit tests for manager * More changes * More tests * tests for reqeust sender * more tests * Tests for cancelling * Acceptance tests done * Remove not used stuff * Fix comments * Fix race condition in test * Fix another race condition * Fix converting to xml * fix next test * fix test * Next changes * Review changes #1 * Fixing multi test finalization manager tests * Fixes * Fix last unit test * Fix acceptance tests * Progress feature, compiling + unit tests * acceptance tests changes * More changes * Fixing resources accesability * Fix test * Fix race conditions in acceptance tests * RFC changes merged * Log warning in case of unexpected message id * Fix spelling * Additional comment * Restore some stuff in interfaces * Big renaming * Added processingSettings * Fix naming * Move explanation to * Add environment variables to enable MacOS dump * Fixed code coverage compatibility issue (#2527) Fixed code coverage compatibility issue * Print version of the product in log (#2535) * Trigger dumps asynchronously (#2533) * Run each dump in a task in netclient dumper * More reasonable timeout * Revert "Trigger dumps asynchronously (#2533)" (#2541) This reverts commit 3454261faa4cf39d03758f339ad010dc0a8a3c8f. * Remove env variables * Remove sleeps and extra process dumps from blame * Update message and remove delays Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: dotnet-maestro[bot] Co-authored-by: Sanan Yuzbashiyev Co-authored-by: Jakub Chocholowicz <59966772+jakubch1@users.noreply.github.com> Co-authored-by: Codrin-Victor Poienaru --- .../BlameLogger.cs | 4 +--- .../Resources/Resources.Designer.cs | 5 ++++- .../Resources/Resources.resx | 6 +++++- .../Resources/xlf/Resources.cs.xlf | 9 ++++++--- .../Resources/xlf/Resources.de.xlf | 9 ++++++--- .../Resources/xlf/Resources.es.xlf | 9 ++++++--- .../Resources/xlf/Resources.fr.xlf | 9 ++++++--- .../Resources/xlf/Resources.it.xlf | 9 ++++++--- .../Resources/xlf/Resources.ja.xlf | 9 ++++++--- .../Resources/xlf/Resources.ko.xlf | 9 ++++++--- .../Resources/xlf/Resources.pl.xlf | 9 ++++++--- .../Resources/xlf/Resources.pt-BR.xlf | 9 ++++++--- .../Resources/xlf/Resources.ru.xlf | 9 ++++++--- .../Resources/xlf/Resources.tr.xlf | 9 ++++++--- .../Resources/xlf/Resources.xlf | 7 +++++-- .../Resources/xlf/Resources.zh-Hans.xlf | 9 ++++++--- .../Resources/xlf/Resources.zh-Hant.xlf | 9 ++++++--- .../WindowsHangDumper.cs | 2 -- src/vstest.console/Program.cs | 5 +---- test/vstest.console.UnitTests/ExecutorUnitTests.cs | 1 + 20 files changed, 95 insertions(+), 52 deletions(-) diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameLogger.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameLogger.cs index 255e4451ae..3874282614 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameLogger.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameLogger.cs @@ -112,15 +112,13 @@ private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) return; } - this.output.Error(false, Resources.Resources.AbortedTestRun); - StringBuilder sb = new StringBuilder(); foreach (var tcn in testCaseNames) { sb.Append(tcn).Append(Environment.NewLine); } - this.output.Error(false, sb.ToString()); + this.output.Error(false, Resources.Resources.AbortedTestRun, sb.ToString()); } #endregion diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/Resources.Designer.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/Resources.Designer.cs index 53cf4ade1e..e34c6b30ba 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/Resources.Designer.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/Resources.Designer.cs @@ -61,7 +61,10 @@ internal class Resources { } /// - /// Looks up a localized string similar to The active Test Run was aborted because the host process exited unexpectedly while executing following test(s):. + /// Looks up a localized string similar to The active Test Run was aborted because the host process exited unexpectedly. Please inspect the call stack above, if available, to get more information about where the exception originated from. + ///The test running when the crash occurred: + ///{0} + ///This test may, or may not be the source of the crash.. /// internal static string AbortedTestRun { get { diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/Resources.resx b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/Resources.resx index a500d52c84..4d5c69c20d 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/Resources.resx +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/Resources.resx @@ -118,7 +118,11 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - The active Test Run was aborted because the host process exited unexpectedly while executing following test(s): + The active Test Run was aborted because the host process exited unexpectedly. Please inspect the call stack above, if available, to get more information about where the exception originated from. +The test running when the crash occurred: +{0} +This test may, or may not be the source of the crash. + {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. The blame parameter key specified {0} is not valid. Ignoring this key. diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.cs.xlf index 7f9f38e301..e70ff548d3 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.cs.xlf @@ -21,9 +21,12 @@ - The active Test Run was aborted because the host process exited unexpectedly while executing following test(s): - Aktivní testovací běh byl přerušen, protože hostitelský proces byl neočekávaně ukončen při provádění následujících testů: - + The active Test Run was aborted because the host process exited unexpectedly. Please inspect the call stack above, if available, to get more information about where the exception originated from. +The test running when the crash occurred: +{0} +This test may, or may not be the source of the crash. + Aktivní testovací běh byl přerušen, protože hostitelský proces byl neočekávaně ukončen při provádění následujících testů: + {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. Required environment variable PROCDUMP_PATH was null or empty. Set PROCDUMP_PATH to path of folder containing appropriate procdump executable. diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.de.xlf index 9df340f2a0..a1235bf501 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.de.xlf @@ -21,9 +21,12 @@ - The active Test Run was aborted because the host process exited unexpectedly while executing following test(s): - Der aktive Testlauf wurde abgebrochen, weil der Hostprozess beim Ausführen der folgenden Tests unerwartet beendet wurde: - + The active Test Run was aborted because the host process exited unexpectedly. Please inspect the call stack above, if available, to get more information about where the exception originated from. +The test running when the crash occurred: +{0} +This test may, or may not be the source of the crash. + Der aktive Testlauf wurde abgebrochen, weil der Hostprozess beim Ausführen der folgenden Tests unerwartet beendet wurde: + {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. Required environment variable PROCDUMP_PATH was null or empty. Set PROCDUMP_PATH to path of folder containing appropriate procdump executable. diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.es.xlf index 7f7b152970..2774c34d0f 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.es.xlf @@ -21,9 +21,12 @@ - The active Test Run was aborted because the host process exited unexpectedly while executing following test(s): - La serie de pruebas activa se anuló porque el proceso del host se cerró inesperadamente al ejecutar las pruebas siguientes: - + The active Test Run was aborted because the host process exited unexpectedly. Please inspect the call stack above, if available, to get more information about where the exception originated from. +The test running when the crash occurred: +{0} +This test may, or may not be the source of the crash. + La serie de pruebas activa se anuló porque el proceso del host se cerró inesperadamente al ejecutar las pruebas siguientes: + {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. Required environment variable PROCDUMP_PATH was null or empty. Set PROCDUMP_PATH to path of folder containing appropriate procdump executable. diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.fr.xlf index 4b02e78d1c..7f13e124fb 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.fr.xlf @@ -21,9 +21,12 @@ - The active Test Run was aborted because the host process exited unexpectedly while executing following test(s): - La série de tests active a été abandonnée, car le processus hôte s'est arrêté de manière inattendue durant l'exécution du ou des tests suivants : - + The active Test Run was aborted because the host process exited unexpectedly. Please inspect the call stack above, if available, to get more information about where the exception originated from. +The test running when the crash occurred: +{0} +This test may, or may not be the source of the crash. + La série de tests active a été abandonnée, car le processus hôte s'est arrêté de manière inattendue durant l'exécution du ou des tests suivants : + {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. Required environment variable PROCDUMP_PATH was null or empty. Set PROCDUMP_PATH to path of folder containing appropriate procdump executable. diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.it.xlf index f7c63ec22f..e16e7fb09c 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.it.xlf @@ -21,9 +21,12 @@ - The active Test Run was aborted because the host process exited unexpectedly while executing following test(s): - L'esecuzione dei test attiva è stata interrotta perché il processo host è stato terminato in modo imprevisto durante l'esecuzione del test o dei test seguenti: - + The active Test Run was aborted because the host process exited unexpectedly. Please inspect the call stack above, if available, to get more information about where the exception originated from. +The test running when the crash occurred: +{0} +This test may, or may not be the source of the crash. + L'esecuzione dei test attiva è stata interrotta perché il processo host è stato terminato in modo imprevisto durante l'esecuzione del test o dei test seguenti: + {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. Required environment variable PROCDUMP_PATH was null or empty. Set PROCDUMP_PATH to path of folder containing appropriate procdump executable. diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ja.xlf index f72bb9bcb9..c2d6bd1575 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ja.xlf @@ -21,9 +21,12 @@ - The active Test Run was aborted because the host process exited unexpectedly while executing following test(s): - 以下のテストの実行中にホスト プロセスが予期せず終了したため、アクティブなテスト実行が中止されました: - + The active Test Run was aborted because the host process exited unexpectedly. Please inspect the call stack above, if available, to get more information about where the exception originated from. +The test running when the crash occurred: +{0} +This test may, or may not be the source of the crash. + 以下のテストの実行中にホスト プロセスが予期せず終了したため、アクティブなテスト実行が中止されました: + {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. Required environment variable PROCDUMP_PATH was null or empty. Set PROCDUMP_PATH to path of folder containing appropriate procdump executable. diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ko.xlf index 921bebc97b..cbc85432d1 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ko.xlf @@ -21,9 +21,12 @@ - The active Test Run was aborted because the host process exited unexpectedly while executing following test(s): - 다음 테스트를 실행하는 동안 호스트 프로세스가 예기치 않게 종료되어 활성 테스트 실행이 중단되었습니다. - + The active Test Run was aborted because the host process exited unexpectedly. Please inspect the call stack above, if available, to get more information about where the exception originated from. +The test running when the crash occurred: +{0} +This test may, or may not be the source of the crash. + 다음 테스트를 실행하는 동안 호스트 프로세스가 예기치 않게 종료되어 활성 테스트 실행이 중단되었습니다. + {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. Required environment variable PROCDUMP_PATH was null or empty. Set PROCDUMP_PATH to path of folder containing appropriate procdump executable. diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.pl.xlf index 5f6203d752..6e0651cf89 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.pl.xlf @@ -21,9 +21,12 @@ - The active Test Run was aborted because the host process exited unexpectedly while executing following test(s): - Aktywny przebieg testu został przerwany, ponieważ proces hosta nieoczekiwanie zakończył działanie podczas wykonywania następujących testów: - + The active Test Run was aborted because the host process exited unexpectedly. Please inspect the call stack above, if available, to get more information about where the exception originated from. +The test running when the crash occurred: +{0} +This test may, or may not be the source of the crash. + Aktywny przebieg testu został przerwany, ponieważ proces hosta nieoczekiwanie zakończył działanie podczas wykonywania następujących testów: + {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. Required environment variable PROCDUMP_PATH was null or empty. Set PROCDUMP_PATH to path of folder containing appropriate procdump executable. diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.pt-BR.xlf index 4f074f78ff..6aa314fdc7 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.pt-BR.xlf @@ -21,9 +21,12 @@ - The active Test Run was aborted because the host process exited unexpectedly while executing following test(s): - A Execução de Teste ativa foi anulada pois o processo do host saiu inesperadamente ao executar os seguintes testes: - + The active Test Run was aborted because the host process exited unexpectedly. Please inspect the call stack above, if available, to get more information about where the exception originated from. +The test running when the crash occurred: +{0} +This test may, or may not be the source of the crash. + A Execução de Teste ativa foi anulada pois o processo do host saiu inesperadamente ao executar os seguintes testes: + {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. Required environment variable PROCDUMP_PATH was null or empty. Set PROCDUMP_PATH to path of folder containing appropriate procdump executable. diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ru.xlf index 31dc3a8f86..0a710dd9c9 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.ru.xlf @@ -21,9 +21,12 @@ - The active Test Run was aborted because the host process exited unexpectedly while executing following test(s): - Активный тестовый запуск прерван, так как хост-процесс завершил работу непредвиденным образом при выполнении следующих тестов: - + The active Test Run was aborted because the host process exited unexpectedly. Please inspect the call stack above, if available, to get more information about where the exception originated from. +The test running when the crash occurred: +{0} +This test may, or may not be the source of the crash. + Активный тестовый запуск прерван, так как хост-процесс завершил работу непредвиденным образом при выполнении следующих тестов: + {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. Required environment variable PROCDUMP_PATH was null or empty. Set PROCDUMP_PATH to path of folder containing appropriate procdump executable. diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.tr.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.tr.xlf index fda57e82e4..23c3668e97 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.tr.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.tr.xlf @@ -21,9 +21,12 @@ - The active Test Run was aborted because the host process exited unexpectedly while executing following test(s): - Aşağıdaki testler yürütülürken konak işleminden beklenmedik bir şekilde çıkıldığından etkin Test Çalıştırması iptal edildi: - + The active Test Run was aborted because the host process exited unexpectedly. Please inspect the call stack above, if available, to get more information about where the exception originated from. +The test running when the crash occurred: +{0} +This test may, or may not be the source of the crash. + Aşağıdaki testler yürütülürken konak işleminden beklenmedik bir şekilde çıkıldığından etkin Test Çalıştırması iptal edildi: + {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. Required environment variable PROCDUMP_PATH was null or empty. Set PROCDUMP_PATH to path of folder containing appropriate procdump executable. diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.xlf index adde775921..9667764550 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.xlf @@ -3,9 +3,12 @@ - The active Test Run was aborted because the host process exited unexpectedly while executing following test(s): + The active Test Run was aborted because the host process exited unexpectedly. Please inspect the call stack above, if available, to get more information about where the exception originated from. +The test running when the crash occurred: +{0} +This test may, or may not be the source of the crash. The active Test Run was aborted because the host process exited unexpectedly while executing test - + {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. Required environment variable PROCDUMP_PATH was null or empty. Set PROCDUMP_PATH to path of folder containing appropriate procdump executable. diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.zh-Hans.xlf index 5bdd34c08c..55fd327124 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.zh-Hans.xlf @@ -21,9 +21,12 @@ - The active Test Run was aborted because the host process exited unexpectedly while executing following test(s): - 执行以下测试时主机进程意外退出,活动的测试运行已中止: - + The active Test Run was aborted because the host process exited unexpectedly. Please inspect the call stack above, if available, to get more information about where the exception originated from. +The test running when the crash occurred: +{0} +This test may, or may not be the source of the crash. + 执行以下测试时主机进程意外退出,活动的测试运行已中止: + {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. Required environment variable PROCDUMP_PATH was null or empty. Set PROCDUMP_PATH to path of folder containing appropriate procdump executable. diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.zh-Hant.xlf index c5cf368aa6..9be9aec885 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Resources/xlf/Resources.zh-Hant.xlf @@ -21,9 +21,12 @@ - The active Test Run was aborted because the host process exited unexpectedly while executing following test(s): - 因為主機處理序在執行下列測試時未預期地結束,所以使用中的測試回合已中止: - + The active Test Run was aborted because the host process exited unexpectedly. Please inspect the call stack above, if available, to get more information about where the exception originated from. +The test running when the crash occurred: +{0} +This test may, or may not be the source of the crash. + 因為主機處理序在執行下列測試時未預期地結束,所以使用中的測試回合已中止: + {0} is a single test (or in rare cases multiple tests) that were running when test host crashed. Required environment variable PROCDUMP_PATH was null or empty. Set PROCDUMP_PATH to path of folder containing appropriate procdump executable. diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/WindowsHangDumper.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/WindowsHangDumper.cs index c1912b5fb1..c0aeed16c2 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/WindowsHangDumper.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/WindowsHangDumper.cs @@ -68,12 +68,10 @@ public void Dump(int processId, string outputDirectory, DumpTypeOption type) } } - Thread.Sleep(1300); foreach (var p in bottomUpTree) { try { - Thread.Sleep(500); var outputFile = Path.Combine(outputDirectory, $"{p.ProcessName}_{p.Id}_{DateTime.Now:yyyyMMddTHHmmss}_hangdump.dmp"); CollectDump(p, outputFile, type); } diff --git a/src/vstest.console/Program.cs b/src/vstest.console/Program.cs index abe4ca5eed..484f9f9a7a 100644 --- a/src/vstest.console/Program.cs +++ b/src/vstest.console/Program.cs @@ -18,10 +18,7 @@ public static class Program /// Arguments provided on the command line. /// 0 if everything was successful and 1 otherwise. public static int Main(string[] args) - { - Environment.SetEnvironmentVariable("COMPlus_DbgEnableElfDumpOnMacOS", "1"); - Environment.SetEnvironmentVariable("COMPlus_DbgEnableMiniDump", "1"); - + { var debugEnabled = Environment.GetEnvironmentVariable("VSTEST_RUNNER_DEBUG"); if (!string.IsNullOrEmpty(debugEnabled) && debugEnabled.Equals("1", StringComparison.Ordinal)) { diff --git a/test/vstest.console.UnitTests/ExecutorUnitTests.cs b/test/vstest.console.UnitTests/ExecutorUnitTests.cs index 3fe3820b8f..f5748b8c49 100644 --- a/test/vstest.console.UnitTests/ExecutorUnitTests.cs +++ b/test/vstest.console.UnitTests/ExecutorUnitTests.cs @@ -21,6 +21,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests using Utilities; using CommandLineResources = Microsoft.VisualStudio.TestPlatform.CommandLine.Resources.Resources; + using System; [TestClass] public class ExecutorUnitTests From deb218eec4556baf830025399d2c901f6dee906f Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Wed, 2 Sep 2020 00:14:13 -0700 Subject: [PATCH 10/11] Fix errors reported by StyleCop Analyzers (#2555) --- .../Communication/CommunicationException.cs | 12 ++++++------ .../Interfaces/System/IEnvironment.cs | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/Interfaces/Communication/CommunicationException.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/Interfaces/Communication/CommunicationException.cs index c9a11aeada..4dcfebff5d 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/Interfaces/Communication/CommunicationException.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/Interfaces/Communication/CommunicationException.cs @@ -11,28 +11,28 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces public class CommunicationException : Exception { /// - /// Initializes a new instance of class. + /// Initializes a new instance of the class. /// public CommunicationException() { } /// - /// Initializes a new instance of class with provided + /// Initializes a new instance of the class with provided /// message. /// - /// Message describing the error. + /// Message describing the error. public CommunicationException(string message) : base(message) { } /// - /// Initializes a new instance of class with provided + /// Initializes a new instance of the class with provided /// message and inner exception. /// - /// Message describing the error. - /// Inner exception. + /// Message describing the error. + /// Inner exception. public CommunicationException(string message, Exception inner) : base(message, inner) { diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IEnvironment.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IEnvironment.cs index 950b7218a0..5ddff59101 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IEnvironment.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IEnvironment.cs @@ -9,17 +9,17 @@ namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces public interface IEnvironment { /// - /// Operating System architecture. + /// Gets the Operating System architecture. /// PlatformArchitecture Architecture { get; } /// - /// Operating System name. + /// Gets the Operating System name. /// PlatformOperatingSystem OperatingSystem { get; } /// - /// Operating System Version + /// Gets the Operating System Version /// string OperatingSystemVersion { get; } From 95cb80f7a278fc47a65fc3f51e629b5581754c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 2 Sep 2020 11:56:25 +0200 Subject: [PATCH 11/11] Blame upload on crash even if hang dump started (#2553) * Upload on session end when HangDump started In rare cases where we have a crashing tests and short hang timeout, we get into situation where hang dumper started dumping, but then session ends because of the crash, and dumps are not uploaded because the session end is only uploading when there is crash dump enabled. After this change we look for any dump in any case and upload all the dumps that hang dumper was able to create. * Fix procdump condition * Remove test, because we want to upload all dumps on session end when hangdump and crash dump run into each other, otherwise hang dumps would not get uploaded and the process would just end, leaving them on the local disk. --- .../BlameCollector.cs | 60 ++++++++----------- .../CrashDumperFactory.cs | 2 +- .../BlameCollectorTests.cs | 27 --------- 3 files changed, 25 insertions(+), 64 deletions(-) diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs index 834b410510..3f8ad9bcd3 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs @@ -46,7 +46,6 @@ public class BlameCollector : DataCollector, ITestExecutionEnvironmentSpecifier private IInactivityTimer inactivityTimer; private TimeSpan inactivityTimespan = TimeSpan.FromMinutes(DefaultInactivityTimeInMinutes); private int testHostProcessId; - private bool dumpWasCollectedByHangDumper; private string targetFramework; private List> environmentVariables = new List>(); private bool uploadDumpFiles; @@ -223,7 +222,7 @@ private void CollectDumpAndAbortTesthost() } catch (Exception ex) { - ConsoleOutput.Instance.Error(true, $"Blame: Creating hang dump failed with error {ex}."); + this.logger.LogError(this.context.SessionDataCollectionContext, $"Blame: Creating hang dump failed with error.", ex); } if (this.collectProcessDumpOnTrigger) @@ -244,7 +243,6 @@ private void CollectDumpAndAbortTesthost() { if (!string.IsNullOrEmpty(dumpFile)) { - this.dumpWasCollectedByHangDumper = true; var fileTransferInformation = new FileTransferInformation(this.context.SessionDataCollectionContext, dumpFile, true, this.fileHelper); this.dataCollectionSink.SendFileAsync(fileTransferInformation); } @@ -263,7 +261,7 @@ private void CollectDumpAndAbortTesthost() } catch (Exception ex) { - ConsoleOutput.Instance.Error(true, $"Blame: Collecting hang dump failed with error {ex}."); + this.logger.LogError(this.context.SessionDataCollectionContext, $"Blame: Collecting hang dump failed with error.", ex); } } else @@ -452,47 +450,37 @@ private void SessionEndedHandler(object sender, SessionEndEventArgs args) this.logger.LogWarning(this.context.SessionDataCollectionContext, Resources.Resources.NotGeneratingSequenceFile); } - if (this.collectProcessDumpOnTrigger) + if (this.uploadDumpFiles) { - // If there was a test case crash or if we need to collect dump on process exit. - // - // Do not try to collect dump when we already collected one from the hang dump - // we won't dump the killed process again and that would just show a warning on the command line - if ((this.testStartCount > this.testEndCount || this.collectDumpAlways) && !this.dumpWasCollectedByHangDumper) + try { - if (this.uploadDumpFiles) + var dumpFiles = this.processDumpUtility.GetDumpFiles(); + foreach (var dumpFile in dumpFiles) { - try + if (!string.IsNullOrEmpty(dumpFile)) { - var dumpFiles = this.processDumpUtility.GetDumpFiles(); - foreach (var dumpFile in dumpFiles) + try { - if (!string.IsNullOrEmpty(dumpFile)) - { - try - { - var fileTranferInformation = new FileTransferInformation(this.context.SessionDataCollectionContext, dumpFile, true); - this.dataCollectionSink.SendFileAsync(fileTranferInformation); - } - catch (FileNotFoundException ex) - { - EqtTrace.Warning(ex.ToString()); - this.logger.LogWarning(args.Context, ex.ToString()); - } - } + var fileTranferInformation = new FileTransferInformation(this.context.SessionDataCollectionContext, dumpFile, true); + this.dataCollectionSink.SendFileAsync(fileTranferInformation); + } + catch (FileNotFoundException ex) + { + EqtTrace.Warning(ex.ToString()); + this.logger.LogWarning(args.Context, ex.ToString()); } } - catch (FileNotFoundException ex) - { - EqtTrace.Warning(ex.ToString()); - this.logger.LogWarning(args.Context, ex.ToString()); - } - } - else - { - EqtTrace.Info("BlameCollector.CollectDumpAndAbortTesthost: Custom path to dump directory was provided via VSTEST_DUMP_PATH. Skipping attachment upload, the caller is responsible for collecting and uploading the dumps themselves."); } } + catch (FileNotFoundException ex) + { + EqtTrace.Warning(ex.ToString()); + this.logger.LogWarning(args.Context, ex.ToString()); + } + } + else + { + EqtTrace.Info("BlameCollector.CollectDumpAndAbortTesthost: Custom path to dump directory was provided via VSTEST_DUMP_PATH. Skipping attachment upload, the caller is responsible for collecting and uploading the dumps themselves."); } } finally diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/CrashDumperFactory.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/CrashDumperFactory.cs index 2adb34df10..469885579b 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/CrashDumperFactory.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/CrashDumperFactory.cs @@ -44,7 +44,7 @@ public ICrashDumper Create(string targetFramework) // This proven to be working okay while net5.0 could not create dumps from Task.Run, and I was using this same technique // to get dump of testhost. This needs PROCDUMP_PATH set to directory with procdump.exe, or having it in path. var procdumpOverride = Environment.GetEnvironmentVariable("VSTEST_DUMP_FORCEPROCDUMP")?.Trim(); - var forceUsingProcdump = string.IsNullOrWhiteSpace(procdumpOverride) && procdumpOverride != "0"; + var forceUsingProcdump = !string.IsNullOrWhiteSpace(procdumpOverride) && procdumpOverride != "0"; if (forceUsingProcdump) { EqtTrace.Info($"CrashDumperFactory: This is Windows on {targetFramework}. Forcing the use of ProcDumpCrashDumper that uses ProcDump utility, via VSTEST_DUMP_FORCEPROCDUMP={procdumpOverride}."); diff --git a/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/BlameCollectorTests.cs b/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/BlameCollectorTests.cs index fffd563384..880e742290 100644 --- a/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/BlameCollectorTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/BlameCollectorTests.cs @@ -403,33 +403,6 @@ public void TriggerSessionEndedHandlerShouldEnsureProcDumpProcessIsTerminated() this.mockProcessDumpUtility.Verify(x => x.DetachFromTargetProcess(It.IsAny()), Times.Once); } - /// - /// The trigger session ended handler should not dump files if proc dump was enabled and test host did not crash - /// - [TestMethod] - public void TriggerSessionEndedHandlerShouldNotGetDumpFileIfNoCrash() - { - // Initializing Blame Data Collector - this.blameDataCollector.Initialize( - this.GetDumpConfigurationElement(), - this.mockDataColectionEvents.Object, - this.mockDataCollectionSink.Object, - this.mockLogger.Object, - this.context); - - // Setup - this.mockProcessDumpUtility.Setup(x => x.GetDumpFiles()).Returns(new[] { this.filepath }); - this.mockBlameReaderWriter.Setup(x => x.WriteTestSequence(It.IsAny>(), It.IsAny>(), It.IsAny())) - .Returns(this.filepath); - - // Raise - this.mockDataColectionEvents.Raise(x => x.TestHostLaunched += null, new TestHostLaunchedEventArgs(this.dataCollectionContext, 1234)); - this.mockDataColectionEvents.Raise(x => x.SessionEnd += null, new SessionEndEventArgs(this.dataCollectionContext)); - - // Verify GetDumpFiles Call - this.mockProcessDumpUtility.Verify(x => x.GetDumpFiles(), Times.Never); - } - /// /// The trigger session ended handler should get dump files if collect dump on exit was enabled irrespective of completed test case count ///