Skip to content

Commit a4c6b5d

Browse files
Some RunTests fixups (#32111)
1 parent 96b107a commit a4c6b5d

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

eng/helix/content/RunTests/ProcessUtil.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ public static Task CaptureDumpAsync(int pid, string dumpFilePath)
5959
return Task.CompletedTask;
6060
}
6161

62+
if (!File.Exists($"{Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT")}/dotnet-dump") &&
63+
!File.Exists($"{Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT")}/dotnet-dump.exe"))
64+
{
65+
return Task.CompletedTask;
66+
}
67+
6268
return RunAsync($"{Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT")}/dotnet-dump", $"collect -p {pid} -o \"{dumpFilePath}\"");
6369
}
6470

eng/helix/content/RunTests/TestRunner.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,15 @@ public async Task<bool> InstallDotnetToolsAsync()
126126
{
127127
try
128128
{
129+
// Install dotnet-dump first so we can catch any failures from running dotnet after this (installing tools, running tests, etc.)
130+
await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet",
131+
$"tool install dotnet-dump --tool-path {Options.HELIX_WORKITEM_ROOT} --version 5.0.0-*",
132+
environmentVariables: EnvironmentVariables,
133+
outputDataReceived: Console.WriteLine,
134+
errorDataReceived: Console.Error.WriteLine,
135+
throwOnError: false,
136+
cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token);
137+
129138
Console.WriteLine($"Adding current directory to nuget sources: {Options.HELIX_WORKITEM_ROOT}");
130139

131140
await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet",
@@ -161,13 +170,6 @@ await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet",
161170
throwOnError: false,
162171
cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token);
163172

164-
await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet",
165-
$"tool install dotnet-dump --tool-path {Options.HELIX_WORKITEM_ROOT} --version 5.0.0-*",
166-
environmentVariables: EnvironmentVariables,
167-
outputDataReceived: Console.WriteLine,
168-
errorDataReceived: Console.Error.WriteLine,
169-
throwOnError: false);
170-
171173
return true;
172174
}
173175
catch (Exception e)

0 commit comments

Comments
 (0)