diff --git a/scripts/smoke.ps1 b/scripts/smoke.ps1 index db296218b2..1ec6cda59c 100644 --- a/scripts/smoke.ps1 +++ b/scripts/smoke.ps1 @@ -30,6 +30,7 @@ if ($PSBoundParameters.ContainsKey('Title')) { } if (-not (Test-Path $Xcl)) { throw "no $Xcl - build it first (cargo build --release -p xcl)" } +$Xcl = (Resolve-Path -LiteralPath $Xcl).ProviderPath $root = Split-Path $PSScriptRoot -Parent $commit = (git -C $root rev-parse HEAD).Trim() $dirty = [bool](git -C $root status --porcelain --untracked-files=no -- crates Cargo.toml Cargo.lock) diff --git a/scripts/test-smoke-relative-xcl.tests.ps1 b/scripts/test-smoke-relative-xcl.tests.ps1 new file mode 100644 index 0000000000..eba9aff049 --- /dev/null +++ b/scripts/test-smoke-relative-xcl.tests.ps1 @@ -0,0 +1,23 @@ +# Run with powershell.exe or pwsh.exe. -Xcl paths are relative to the shell's location. +$ErrorActionPreference = 'Stop' +$smoke = Join-Path $PSScriptRoot 'smoke.ps1' +$temp = (Resolve-Path -LiteralPath ([IO.Path]::GetTempPath())).Path +$fixture = Join-Path $temp ('xcl-smoke-relative-' + [guid]::NewGuid()) +$null = New-Item -ItemType Directory -Path $fixture +try { + $xcl = Join-Path $fixture 'xcl.cmd' + [IO.File]::WriteAllText($xcl, "@echo off`r`necho Log: %~dp0xcl.log`r`n") + [IO.File]::WriteAllText((Join-Path $fixture 'xcl.log'), "(1 frames shown, 1 PresentX calls)`n") + [IO.File]::WriteAllText((Join-Path $fixture 'report.json'), '{"d3d12":{"adapter":"Fixture GPU"}}') + Push-Location -LiteralPath $fixture + try { + $block = & $smoke -Game $fixture -Xcl '.\xcl.cmd' -Seconds 1 -Title 'Fixture' + if (($block -join "`n") -notmatch 'frames shown: 1 \(PresentX 1\)') { + throw 'The relative launcher did not produce its smoke result.' + } + } finally { Pop-Location } + 'smoke-relative-xcl: ok' +} finally { + $resolved = (Resolve-Path -LiteralPath $fixture).Path + if ((Split-Path -Parent $resolved) -eq $temp) { Remove-Item -LiteralPath $resolved -Recurse -Force } +}