Skip to content

Commit 8b8f77a

Browse files
[Infra] trialling memory management tweaks for linux on test steps (#28557)
1 parent efdb836 commit 8b8f77a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.azure-pipelines/PipelineSteps/test-steps.ps1

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,19 @@ if ($PowerShellPlatform) {
3131
$preference = $ErrorActionPreference
3232
$ErrorActionPreference = 'Continue'
3333
$buildProjPath = Join-Path $RepoRoot 'build.proj'
34-
dotnet msbuild $buildProjPath /t:Test "/p:Configuration=$Configuration;TestFramework=$TestFramework"
34+
35+
$buildArgs = "/p:Configuration=$Configuration;TestFramework=$TestFramework"
36+
37+
if ($IsLinux) {
38+
# Applying various parallelism/heap restriction behaviors to prevent OOM issues on Ubuntu 24.04
39+
Write-Host -ForegroundColor Yellow "Detected Linux agent – applying memory tuning for tests"
40+
$env:DOTNET_gcServer = "0"
41+
$env:DOTNET_gcHeapCount = "2"
42+
$buildArgs += ";RunConfiguration.MaxCpuCount=2"
43+
}
44+
45+
dotnet msbuild $buildProjPath /t:Test $buildArgs
46+
3547
Write-Host -ForegroundColor DarkGreen "-------------------- End testing ... --------------------`n`n`n`n`n"
3648

3749
# Test AutoGen Modules With PowerShell Core

0 commit comments

Comments
 (0)