Files
rougeGame/Tools/Unreal/RunPerformanceAcceptance.ps1

28 lines
2.7 KiB
PowerShell

param([ValidateSet('Full','UI','Restart','Manual')][string]$Suite='Full',[ValidateSet('1280x720','1920x1080','2560x1440','3440x1440')][string]$Resolution='1920x1080',[string]$ResumeFrom,[switch]$Interactive)
$ErrorActionPreference='Stop'
$root=(Resolve-Path (Join-Path $PSScriptRoot '../..')).Path
$exe=Join-Path $root 'Builds/Windows/x64/ueRouge/Binaries/Win64/ueRouge.exe'
if(-not(Test-Path -LiteralPath $exe)){throw 'Build the Windows archive first'}
if(Get-Process UnrealEditor -ErrorAction SilentlyContinue){throw 'Close editor instances before standalone acceptance'}
if(Get-Process ueRouge -ErrorAction SilentlyContinue){throw 'Close the previous game before acceptance'}
$stamp=Get-Date -Format 'yyyyMMdd-HHmmss'
$folder=Join-Path $root "Docs/QA/PerformanceOverlay/Windows/$stamp-$Suite-$Resolution"
$dataRoot=Join-Path $root "Saved/QA/PerformanceOverlay/$stamp-$Resolution"
if($Suite -eq 'Restart'){
if(-not $ResumeFrom){throw 'Restart requires a completed Full evidence directory'}
$previous=(Resolve-Path -LiteralPath $ResumeFrom).Path
if(-not $previous.StartsWith((Join-Path $root 'Docs/QA/PerformanceOverlay/Windows/'),[StringComparison]::OrdinalIgnoreCase)){throw 'Resume must belong to this task evidence root'}
$previousLaunch=Get-Content -LiteralPath (Join-Path $previous 'launch.json') -Raw | ConvertFrom-Json
$dataRoot=[IO.Path]::GetFullPath($previousLaunch.dataRoot)
if(-not $dataRoot.StartsWith((Join-Path $root 'Saved/QA/PerformanceOverlay/'),[StringComparison]::OrdinalIgnoreCase)){throw 'QA data root escaped target project'}
}
New-Item -ItemType Directory -Force $folder | Out-Null
$scenario=switch($Suite){'Full'{'performance'}'UI'{'performance-ui'}'Restart'{'performance-restart'}'Manual'{'manual'}}
$width,$height=$Resolution.Split('x')
$arguments=@('-windowed','-ForceRes',('-ResX='+$width),('-ResY='+$height),'-NoSplash','-IronsporeQA',('-IronsporeQAScenario='+$scenario),('-IronsporeDataRoot="'+$dataRoot.Replace('\','/')+'"'),('-IronsporeQAEvidence="'+$folder.Replace('\','/')+'"'))
if(-not $Interactive){$arguments+='-unattended'}
$style=if($Interactive){'Normal'}else{'Hidden'}
$process=Start-Process -FilePath $exe -ArgumentList $arguments -WorkingDirectory (Split-Path $exe) -WindowStyle $style -PassThru
[ordered]@{processId=$process.Id;executable=$exe;binarySha256=(Get-FileHash -LiteralPath $exe -Algorithm SHA256).Hash.ToLowerInvariant();suite=$Suite;requestedResolution=$Resolution;dataRoot=$dataRoot;evidence=$folder;visibleWindow=[bool]$Interactive;environment='Packaged Windows Development; DX12; actual native screenshots; isolated progress and preferences'} | ConvertTo-Json | Set-Content -Encoding utf8 (Join-Path $folder 'launch.json')
Write-Output ($folder+' PID '+$process.Id)