diff --git a/src/Tools/Source/RunTests/ProcessTestExecutor.cs b/src/Tools/Source/RunTests/ProcessTestExecutor.cs index c4c391fb2a30fae1cc4f06dbafb5c4cd8c3822da..2a1058a04f8e799f4d8658547758829dd6504d8c 100644 --- a/src/Tools/Source/RunTests/ProcessTestExecutor.cs +++ b/src/Tools/Source/RunTests/ProcessTestExecutor.cs @@ -94,22 +94,26 @@ private async Task RunTestAsyncInternal(AssemblyInfo assemblyInfo, b // NOTE: xUnit doesn't always create the log directory Directory.CreateDirectory(resultsDir); - // NOTE: xUnit seems to have an occasional issue creating logs create - // an empty log just in case, so our runner will still fail. - File.Create(resultsFilePath).Close(); - // Define environment variables for processes started via ProcessRunner. var environmentVariables = new Dictionary(); Options.ProcDumpInfo?.WriteEnvironmentVariables(environmentVariables); if (retry) { + // Copy the results file path, since the new xunit run will overwrite it + var backupResultsFilePath = Path.ChangeExtension(resultsFilePath, ".old"); + File.Copy(resultsFilePath, backupResultsFilePath, overwrite: true); + ConsoleUtil.WriteLine("Starting a retry. It will run once again tests failed."); // If running the process with this varialbe added, we assume that this file contains // xml logs from the first attempt. - environmentVariables.Add("OutputXmlFilePath", GetResultsFilePath(assemblyInfo)); + environmentVariables.Add("OutputXmlFilePath", backupResultsFilePath); } + // NOTE: xUnit seems to have an occasional issue creating logs create + // an empty log just in case, so our runner will still fail. + File.Create(resultsFilePath).Close(); + var start = DateTime.UtcNow; var xunitProcessInfo = ProcessRunner.CreateProcess( ProcessRunner.CreateProcessStartInfo(