test: add renderer phase regression entrypoint
This commit is contained in:
156
scripts/Run-RendererPhaseRegression.ps1
Normal file
156
scripts/Run-RendererPhaseRegression.ps1
Normal file
@@ -0,0 +1,156 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string]$BuildDir = "build",
|
||||
[string]$Config = "Debug",
|
||||
[string]$RepoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path,
|
||||
[int]$SmokeSeconds = 5,
|
||||
[switch]$SkipBuild,
|
||||
[switch]$SkipSmoke,
|
||||
[switch]$CleanBuild
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Invoke-Step {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Label,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[scriptblock]$Action
|
||||
)
|
||||
|
||||
Write-Host "==> $Label"
|
||||
& $Action
|
||||
}
|
||||
|
||||
function Invoke-Native {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$FilePath,
|
||||
[Parameter()]
|
||||
[string[]]$Arguments = @(),
|
||||
[string]$WorkingDirectory = $RepoRoot
|
||||
)
|
||||
|
||||
Push-Location $WorkingDirectory
|
||||
try {
|
||||
& $FilePath @Arguments
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw ("Command failed with exit code {0}: {1} {2}" -f $LASTEXITCODE, $FilePath, ($Arguments -join ' '))
|
||||
}
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
|
||||
function Get-ExePath {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string[]]$Parts
|
||||
)
|
||||
|
||||
$path = $BuildDir
|
||||
foreach ($part in $Parts) {
|
||||
$path = Join-Path $path $part
|
||||
}
|
||||
|
||||
$resolved = if ([System.IO.Path]::IsPathRooted($path)) {
|
||||
$path
|
||||
}
|
||||
else {
|
||||
Join-Path $RepoRoot $path
|
||||
}
|
||||
if (-not (Test-Path $resolved)) {
|
||||
throw "Expected executable does not exist: $resolved"
|
||||
}
|
||||
|
||||
return $resolved
|
||||
}
|
||||
|
||||
$RepoRoot = [System.IO.Path]::GetFullPath($RepoRoot)
|
||||
$BuildDir = if ([System.IO.Path]::IsPathRooted($BuildDir)) {
|
||||
[System.IO.Path]::GetFullPath($BuildDir)
|
||||
}
|
||||
else {
|
||||
[System.IO.Path]::GetFullPath((Join-Path $RepoRoot $BuildDir))
|
||||
}
|
||||
|
||||
$msbuildArguments = @(
|
||||
"--", "/m:1",
|
||||
"/p:UseMultiToolTask=false",
|
||||
"/p:CL_MPCount=1"
|
||||
)
|
||||
|
||||
if (-not $SkipBuild) {
|
||||
if ($CleanBuild) {
|
||||
Invoke-Step "Clean rebuild XCEngine" {
|
||||
Invoke-Native -FilePath "cmake" -Arguments (@(
|
||||
"--build", $BuildDir,
|
||||
"--config", $Config,
|
||||
"--target", "XCEngine",
|
||||
"--clean-first"
|
||||
) + $msbuildArguments)
|
||||
}
|
||||
}
|
||||
|
||||
Invoke-Step "Build rendering regression targets" {
|
||||
Invoke-Native -FilePath "cmake" -Arguments (@(
|
||||
"--build", $BuildDir,
|
||||
"--config", $Config,
|
||||
"--target", "rendering_phase_regression_build"
|
||||
) + $msbuildArguments)
|
||||
}
|
||||
}
|
||||
|
||||
$executables = @(
|
||||
(Get-ExePath -Parts @("tests", "Rendering", "unit", $Config, "rendering_unit_tests.exe")),
|
||||
(Get-ExePath -Parts @("tests", "Rendering", "integration", "textured_quad_scene", $Config, "rendering_integration_textured_quad_scene.exe")),
|
||||
(Get-ExePath -Parts @("tests", "Rendering", "integration", "backpack_scene", $Config, "rendering_integration_backpack_scene.exe")),
|
||||
(Get-ExePath -Parts @("tests", "Rendering", "integration", "backpack_lit_scene", $Config, "rendering_integration_backpack_lit_scene.exe")),
|
||||
(Get-ExePath -Parts @("tests", "Rendering", "integration", "camera_stack_scene", $Config, "rendering_integration_camera_stack_scene.exe")),
|
||||
(Get-ExePath -Parts @("tests", "Rendering", "integration", "transparent_material_scene", $Config, "rendering_integration_transparent_material_scene.exe")),
|
||||
(Get-ExePath -Parts @("tests", "Rendering", "integration", "cull_material_scene", $Config, "rendering_integration_cull_material_scene.exe")),
|
||||
(Get-ExePath -Parts @("tests", "Rendering", "integration", "depth_sort_scene", $Config, "rendering_integration_depth_sort_scene.exe")),
|
||||
(Get-ExePath -Parts @("tests", "Rendering", "integration", "material_state_scene", $Config, "rendering_integration_material_state_scene.exe")),
|
||||
(Get-ExePath -Parts @("tests", "Rendering", "integration", "offscreen_scene", $Config, "rendering_integration_offscreen_scene.exe")),
|
||||
(Get-ExePath -Parts @("tests", "Editor", $Config, "editor_tests.exe"))
|
||||
)
|
||||
|
||||
foreach ($executable in $executables) {
|
||||
$label = [System.IO.Path]::GetFileName($executable)
|
||||
$workingDirectory = Split-Path -Parent $executable
|
||||
Invoke-Step "Run $label" {
|
||||
Invoke-Native -FilePath $executable -WorkingDirectory $workingDirectory
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $SkipSmoke) {
|
||||
$editorExe = Join-Path $RepoRoot "editor\bin\$Config\XCEngine.exe"
|
||||
if (-not (Test-Path $editorExe)) {
|
||||
throw "Expected editor executable does not exist: $editorExe"
|
||||
}
|
||||
|
||||
Invoke-Step "Smoke launch XCEditor ($SmokeSeconds seconds)" {
|
||||
$process = Start-Process -FilePath $editorExe -WorkingDirectory $RepoRoot -PassThru
|
||||
try {
|
||||
Start-Sleep -Seconds $SmokeSeconds
|
||||
if ($process.HasExited) {
|
||||
if ($process.ExitCode -ne 0) {
|
||||
throw "XCEditor exited early with code $($process.ExitCode)"
|
||||
}
|
||||
}
|
||||
else {
|
||||
Stop-Process -Id $process.Id -Force
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if (-not $process.HasExited) {
|
||||
Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Renderer phase regression passed."
|
||||
Reference in New Issue
Block a user