From 4b6152a07b6046b44be8cb343e289979db13e047 Mon Sep 17 00:00:00 2001 From: vczh Date: Fri, 15 May 2026 04:51:26 -0700 Subject: [PATCH] Sync Copilot context --- .github/Guidelines/Running-UnitTest.md | 3 +++ .github/Scripts/.gitignore | 3 ++- .github/Scripts/copilotExecute.ps1 | 11 ++++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/Guidelines/Running-UnitTest.md b/.github/Guidelines/Running-UnitTest.md index 7f6750ac..5d4a6501 100644 --- a/.github/Guidelines/Running-UnitTest.md +++ b/.github/Guidelines/Running-UnitTest.md @@ -64,6 +64,9 @@ Ignore `LocalDebuggerCommandArgumentsHistory` in `*.vcxproj.user`. - When all test cases pass, the last several lines of `Execute.log` should be in the following pattern; otherwise it has crashed at the last shown test case: - "Passed test files: X/X" - "Passed test cases: Y/Y" +- On Windows Debug builds, memory leak detection runs after test cases finish. If memory leaks are found, the leak dump is appended at the end of `Execute.log` after the test summary. + - Passing test cases are necessary but not sufficient for success: memory leaks reported after the summary must always be fixed. + - Treat memory leak fixes as required work, especially after all test cases pass and the remaining failure signal is only the appended leak dump. - DO NOT delete the log file by yourself. ## Linux Specific diff --git a/.github/Scripts/.gitignore b/.github/Scripts/.gitignore index bf401213..3645f1b4 100644 --- a/.github/Scripts/.gitignore +++ b/.github/Scripts/.gitignore @@ -1,4 +1,5 @@ Build.log Build.log.unfinished Execute.log -Execute.log.unfinished \ No newline at end of file +Execute.log.unfinished +Execute.log.memoryleaks diff --git a/.github/Scripts/copilotExecute.ps1 b/.github/Scripts/copilotExecute.ps1 index 79c7d0e3..ba9cceb2 100644 --- a/.github/Scripts/copilotExecute.ps1 +++ b/.github/Scripts/copilotExecute.ps1 @@ -34,7 +34,8 @@ if ($Mode -eq "UnitTest") { # Remove log files $logFile = "$PSScriptRoot\Execute.log" $logFileUnfinished = "$logFile.unfinished" - Remove-Item -Path $logFile, $logFileUnfinished -Force -ErrorAction SilentlyContinue + $logFileMemoryLeaks = "$logFile.memoryleaks" + Remove-Item -Path $logFile, $logFileUnfinished, $logFileMemoryLeaks -Force -ErrorAction SilentlyContinue } # Ensure the executable name does not have the .exe extension @@ -47,7 +48,7 @@ $executableName = $Executable + ".exe" $solutionFolder = GetSolutionDir # Find the file with the latest modification time -if ($Configuration -eq $null) { +if ([string]::IsNullOrEmpty($Configuration)) { $latestFile = GetLatestModifiedExecutable $solutionFolder $executableName } else { $latestFile = GetSpecifiedExecutable $solutionFolder $executableName $Configuration $Platform @@ -59,9 +60,13 @@ $debugArgs = GetDebugArgs $solutionFolder $latestFile $Executable # Execute the selected executable with debug arguments and save output to log file if ($Mode -eq "UnitTest") { - $commandLine = "`"$($latestFile.Path)`" /C $debugArgs" + $commandLine = "`"$($latestFile.Path)`" /C /DebugOutput:`"$logFileMemoryLeaks`" $debugArgs" & { $commandLine; & cmd.exe /S /C $commandLine 2>&1 } | Tee-Object -FilePath $logFileUnfinished + if ((Test-Path $logFileMemoryLeaks) -and ((Get-Item $logFileMemoryLeaks).Length -gt 0)) { + Get-Content -Path $logFileMemoryLeaks | Add-Content -Path $logFileUnfinished + } Rename-Item -Path $logFileUnfinished -NewName $logFile -Force + Remove-Item -Path $logFileUnfinished, $logFileMemoryLeaks -Force -ErrorAction SilentlyContinue } else { $commandLine = "`"$($latestFile.Path)`" $debugArgs" & { $commandLine; & cmd.exe /S /C $commandLine 2>&1 }