From f3c2c1c5b36c5a43f1ae91930f4b5da4edf3f31b Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Thu, 16 Apr 2020 22:30:55 -0700 Subject: [PATCH] [Helix] Capture more output/errors in test runner (#20919) --- eng/helix/content/RunTests/ProcessUtil.cs | 2 +- eng/helix/content/RunTests/TestRunner.cs | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/eng/helix/content/RunTests/ProcessUtil.cs b/eng/helix/content/RunTests/ProcessUtil.cs index 8c25f9fb5d..0ce0b2c571 100644 --- a/eng/helix/content/RunTests/ProcessUtil.cs +++ b/eng/helix/content/RunTests/ProcessUtil.cs @@ -98,7 +98,7 @@ namespace RunTests Console.WriteLine($"'{process.StartInfo.FileName} {process.StartInfo.Arguments}' completed with exit code '{process.ExitCode}'"); if (throwOnError && process.ExitCode != 0) { - processLifetimeTask.TrySetException(new InvalidOperationException($"Command {filename} {arguments} returned exit code {process.ExitCode}")); + processLifetimeTask.TrySetException(new InvalidOperationException($"Command {filename} {arguments} returned exit code {process.ExitCode} output: {outputBuilder.ToString()}")); } else { diff --git a/eng/helix/content/RunTests/TestRunner.cs b/eng/helix/content/RunTests/TestRunner.cs index 92f6bf065a..65dd451036 100644 --- a/eng/helix/content/RunTests/TestRunner.cs +++ b/eng/helix/content/RunTests/TestRunner.cs @@ -120,22 +120,28 @@ namespace RunTests await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet", $"nuget add source {Options.HELIX_WORKITEM_ROOT} --configfile NuGet.config", - environmentVariables: EnvironmentVariables); + environmentVariables: EnvironmentVariables, + outputDataReceived: Console.WriteLine, + errorDataReceived: Console.Error.WriteLine); await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet", "nuget add source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --configfile NuGet.config", - environmentVariables: EnvironmentVariables); + environmentVariables: EnvironmentVariables, + outputDataReceived: Console.WriteLine, + errorDataReceived: Console.Error.WriteLine); // Write nuget sources to console, useful for debugging purposes await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet", "nuget list source", environmentVariables: EnvironmentVariables, outputDataReceived: Console.WriteLine, - errorDataReceived: Console.WriteLine); + errorDataReceived: Console.Error.WriteLine); await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet", $"tool install dotnet-ef --global --version {Options.EfVersion}", - environmentVariables: EnvironmentVariables); + environmentVariables: EnvironmentVariables, + outputDataReceived: Console.WriteLine, + errorDataReceived: Console.Error.WriteLine); // ';' is the path separator on Windows, and ':' on Unix Options.Path += RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ";" : ":"; @@ -219,7 +225,7 @@ namespace RunTests commonTestArgs + " --TestCaseFilter:\"Quarantined=true\"", environmentVariables: EnvironmentVariables, outputDataReceived: Console.WriteLine, - errorDataReceived: Console.WriteLine, + errorDataReceived: Console.Error.WriteLine, throwOnError: false); if (result.ExitCode != 0)