From 0859da3c930656377cb24c91f2d648e4c8e5de3a Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Fri, 31 Jul 2020 13:20:23 -0700 Subject: [PATCH] Improve crash/hang support in helix --- eng/helix/content/RunTests/TestRunner.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/eng/helix/content/RunTests/TestRunner.cs b/eng/helix/content/RunTests/TestRunner.cs index da4b4c228f0c..4eb8c903e2c5 100644 --- a/eng/helix/content/RunTests/TestRunner.cs +++ b/eng/helix/content/RunTests/TestRunner.cs @@ -247,7 +247,7 @@ public async Task RunTestsAsync() { // Timeout test run 5 minutes before the Helix job would timeout var cts = new CancellationTokenSource(Options.Timeout.Subtract(TimeSpan.FromMinutes(5))); - var commonTestArgs = $"vstest {Options.Target} --logger:xunit --logger:\"console;verbosity=normal\" --blame"; + var commonTestArgs = $"test {Options.Target} --logger:xunit --logger:\"console;verbosity=normal\" --blame \"CollectHangDump;TestTimeout=5m\""; if (Options.Quarantined) { Console.WriteLine("Running quarantined tests."); @@ -331,6 +331,22 @@ public void UploadResults() { Console.WriteLine("No logs found in artifacts/log"); } + Console.WriteLine($"Copying TestResults/**/*.dmp to {HELIX_WORKITEM_UPLOAD_ROOT}/"); + if (Directory.Exists("TestResults")) + { + foreach (var file in Directory.EnumerateFiles("TestResults", "*.dmp", SearchOption.AllDirectories)) + { + var fileName = Path.GetFileName(file); + Console.WriteLine($"Copying: {file} to {Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, fileName)}"); + // Need to copy to HELIX_WORKITEM_UPLOAD_ROOT and HELIX_WORKITEM_UPLOAD_ROOT/../ in order for Azure Devops attachments to link properly and for Helix to store the logs + File.Copy(file, Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, fileName)); + File.Copy(file, Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, "..", fileName)); + } + } + else + { + Console.WriteLine("No dmps found in TestResults"); + } } } }