From 56af834e85ad408cf42ffa0ade7f5db7ab5e6ada Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Fri, 23 Apr 2021 11:12:03 -0700 Subject: [PATCH 1/2] Some RunTests fixups --- eng/helix/content/RunTests/ProcessUtil.cs | 5 +++++ eng/helix/content/RunTests/TestRunner.cs | 14 +++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/eng/helix/content/RunTests/ProcessUtil.cs b/eng/helix/content/RunTests/ProcessUtil.cs index 8ac00bf829c3..cf0d9be3adc5 100644 --- a/eng/helix/content/RunTests/ProcessUtil.cs +++ b/eng/helix/content/RunTests/ProcessUtil.cs @@ -59,6 +59,11 @@ public static Task CaptureDumpAsync(int pid, string dumpFilePath) return Task.CompletedTask; } + if (!File.Exists($"{Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT")}/dotnet-dump")) + { + return Task.CompletedTask; + } + return RunAsync($"{Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT")}/dotnet-dump", $"collect -p {pid} -o \"{dumpFilePath}\""); } diff --git a/eng/helix/content/RunTests/TestRunner.cs b/eng/helix/content/RunTests/TestRunner.cs index 94c1b9280212..ded89bd31352 100644 --- a/eng/helix/content/RunTests/TestRunner.cs +++ b/eng/helix/content/RunTests/TestRunner.cs @@ -125,6 +125,13 @@ public async Task InstallDotnetToolsAsync() { try { + await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet", + $"tool install dotnet-dump --tool-path {Options.HELIX_WORKITEM_ROOT} --version 5.0.0-*", + environmentVariables: EnvironmentVariables, + outputDataReceived: Console.WriteLine, + errorDataReceived: Console.Error.WriteLine, + throwOnError: false); + Console.WriteLine($"Adding current directory to nuget sources: {Options.HELIX_WORKITEM_ROOT}"); await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet", @@ -159,13 +166,6 @@ await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet", errorDataReceived: Console.Error.WriteLine, throwOnError: false, cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token); - - await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet", - $"tool install dotnet-dump --tool-path {Options.HELIX_WORKITEM_ROOT} --version 5.0.0-*", - environmentVariables: EnvironmentVariables, - outputDataReceived: Console.WriteLine, - errorDataReceived: Console.Error.WriteLine, - throwOnError: false); return true; } From b3c65cb0abb2cf15da9a434b9d6ae041de4e5498 Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Mon, 26 Apr 2021 12:38:42 -0700 Subject: [PATCH 2/2] fb --- eng/helix/content/RunTests/ProcessUtil.cs | 3 ++- eng/helix/content/RunTests/TestRunner.cs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/eng/helix/content/RunTests/ProcessUtil.cs b/eng/helix/content/RunTests/ProcessUtil.cs index cf0d9be3adc5..416ec05a9087 100644 --- a/eng/helix/content/RunTests/ProcessUtil.cs +++ b/eng/helix/content/RunTests/ProcessUtil.cs @@ -59,7 +59,8 @@ public static Task CaptureDumpAsync(int pid, string dumpFilePath) return Task.CompletedTask; } - if (!File.Exists($"{Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT")}/dotnet-dump")) + if (!File.Exists($"{Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT")}/dotnet-dump") && + !File.Exists($"{Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT")}/dotnet-dump.exe")) { return Task.CompletedTask; } diff --git a/eng/helix/content/RunTests/TestRunner.cs b/eng/helix/content/RunTests/TestRunner.cs index ded89bd31352..61eb3015d4d2 100644 --- a/eng/helix/content/RunTests/TestRunner.cs +++ b/eng/helix/content/RunTests/TestRunner.cs @@ -125,12 +125,14 @@ public async Task InstallDotnetToolsAsync() { try { + // Install dotnet-dump first so we can catch any failures from running dotnet after this (installing tools, running tests, etc.) await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet", $"tool install dotnet-dump --tool-path {Options.HELIX_WORKITEM_ROOT} --version 5.0.0-*", environmentVariables: EnvironmentVariables, outputDataReceived: Console.WriteLine, errorDataReceived: Console.Error.WriteLine, - throwOnError: false); + throwOnError: false, + cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token); Console.WriteLine($"Adding current directory to nuget sources: {Options.HELIX_WORKITEM_ROOT}");