Browse Source

Disable ServerManager and minimize all open windows on test machines. (#8936)

* Disable ServerManager and minimize all open windows on test machines.

* Clean script and remove admin mode section.

* Move to script.

* Clean code.

* Remove unchanged file.
pull/8941/head
Devendar Reddy Adulla 2 years ago
committed by GitHub
parent
commit
7b7953d839
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 56
      eng/custom-cibuild.ps1

56
eng/custom-cibuild.ps1

@ -4,20 +4,21 @@ Param(
[Parameter(ValueFromRemainingArguments=$true)][String[]]$properties
)
function _kill($processName) {
Write-Host "killing process ${processName}."
function _endProcess($processName) {
try {
# Redirect stderr to stdout to avoid big red blocks of output in Azure Pipeline logging
# when there are no instances of the process
& cmd /c "taskkill /T /F /IM ${processName} 2>&1"
if (Get-Process -Name ${processName} -ErrorAction SilentlyContinue) {
Write-Host "Ending process ${processName}."
# Redirect stderr to stdout to avoid big red blocks of output in Azure Pipeline logging.
& cmd /c "taskkill /T /F /IM ${processName}.exe 2>&1"
}
else {
Write-Host "${processName} process is not running"
}
} catch {
Write-Host "Failed to kill ${processName}."
Write-Host "Failed to end process ${processName}"
}
}
# kill server manager process if running on build agents.
_kill severmanager.exe
# How long to wait before we consider a build/test run to be unresponsive
$WaitSeconds = 900 # 15 min
@ -31,8 +32,6 @@ $WaitSeconds = 900 # 15 min
[bool]$integrationTest = $properties.Contains('-integrationTest')
[bool]$performanceTest = $properties.Contains('-performanceTest')
$screenshotsModuleLocation = Resolve-Path "$PSScriptRoot\Screenshots.win.psm1"
$initScreenshotsModule = [scriptblock]::Create("Import-Module $screenshotsModuleLocation")
$memDumpModuleLocation = Resolve-Path "$PSScriptRoot\MemDump.win.psm1"
$initMemDumpModule = [scriptblock]::Create("Import-Module $memDumpModuleLocation")
@ -42,19 +41,6 @@ if ($CollectDebugInfo) {
dotnet tool install dotnet-dump --tool-path .\.tools
# Collect screenshots
# -----------------------------------------------------------
$ImageLogs = Join-Path $LogDir 'screenshots'
Create-Directory $ImageLogs
[ScriptBlock] $ScreenshotCaptureScript = {
param($ImageLogs, $WaitSeconds)
Start-CaptureScreenshots -TargetDir $ImageLogs -WaitSeconds $WaitSeconds
};
$job = Start-Job -InitializationScript $initScreenshotsModule `
-ScriptBlock $ScreenshotCaptureScript `
-ArgumentList @( $ImageLogs, $WaitSeconds );
# Collect memory dump
# -----------------------------------------------------------
[ScriptBlock] $MemDumpScript = {
@ -67,6 +53,16 @@ if ($CollectDebugInfo) {
}
if ($ci -and $integrationTest) {
# Minimize all windows to avoid interference during integration test runs
$shell = New-Object -ComObject "Shell.Application"
$shell.MinimizeAll()
Write-Host "Minimized all windows"
# end server manager process if running on build agents.
_endProcess ServerManager
}
try {
# Run the build script that does the actual work
@ -78,17 +74,7 @@ try {
}
finally {
if ($CollectDebugInfo) {
# Stop collecting screenshots
# -----------------------------------------------------------
[ScriptBlock] $ScreenshotCaptureScript = {
param($ImageLogs)
Stop-CaptureScreenshots -TargetDir $ImageLogs
};
Start-Job -InitializationScript $initScreenshotsModule `
-ScriptBlock $ScreenshotCaptureScript `
-ArgumentList $ImageLogs | Receive-Job -AutoRemoveJob -Wait;
# Stop collect memory dumps
# -----------------------------------------------------------
[ScriptBlock] $MemDumpScript = {

Loading…
Cancel
Save