From a9d11d6c6f85367c10c77e3b5275987405b50904 Mon Sep 17 00:00:00 2001 From: luckyteagirl <290248872+luckyteagirl@users.noreply.github.com> Date: Wed, 25 Nov 2026 22:12:07 -0800 Subject: [PATCH] Resolve relative game path in smoke runs --- scripts/smoke.ps1 | 5 +++ scripts/test-smoke-relative-game.tests.ps1 | 38 ++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 scripts/test-smoke-relative-game.tests.ps1 diff --git a/scripts/smoke.ps1 b/scripts/smoke.ps1 index db296218b2..7aa4dd2c25 100644 --- a/scripts/smoke.ps1 +++ b/scripts/smoke.ps1 @@ -18,6 +18,11 @@ param( ) $ErrorActionPreference = 'Stop' +# A native child can have a different current directory from the PowerShell location. +if ($Game -notmatch '^(?:[a-zA-Z]:[\\/]|[\\/]{2})') { + $Game = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Game) +} + if ($PSBoundParameters.ContainsKey('Title')) { $Title = $Title.Trim() # control, format and line/paragraph separator characters would split the line for pr_check.py diff --git a/scripts/test-smoke-relative-game.tests.ps1 b/scripts/test-smoke-relative-game.tests.ps1 new file mode 100644 index 0000000000..639fcffaa9 --- /dev/null +++ b/scripts/test-smoke-relative-game.tests.ps1 @@ -0,0 +1,38 @@ +# Run with powershell.exe or pwsh.exe. A stand-in launcher resolves the game argument. +$ErrorActionPreference = 'Stop' +$smoke = Join-Path $PSScriptRoot 'smoke.ps1' +$temp = (Resolve-Path -LiteralPath ([IO.Path]::GetTempPath())).Path +$fixture = Join-Path $temp ('xcl-smoke-game-' + [guid]::NewGuid()) +$game = Join-Path $fixture 'Game With Spaces' +$null = New-Item -ItemType Directory -Path $game -Force +try { + $xcl = Join-Path $fixture 'xcl.cmd' + @' +@echo off +if not exist "%~2\sentinel.txt" exit /b 51 +echo Log: %~dp0xcl.log +'@ | Set-Content -LiteralPath $xcl -Encoding ascii + [IO.File]::WriteAllText((Join-Path $game 'sentinel.txt'), 'fixture') + [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"}}') + + $absolute = & $smoke -Game $game -Xcl $xcl -Seconds 1 + Push-Location -LiteralPath $fixture + try { $relative = & $smoke -Game '.\Game With Spaces' -Xcl $xcl -Seconds 1 } + finally { Pop-Location } + Push-Location -LiteralPath $game + try { $dot = & $smoke -Game '.' -Xcl $xcl -Seconds 1 } + finally { Pop-Location } + + $title = $absolute -split "`n" | Where-Object { $_ -like 'title:*' } + foreach ($block in @($relative, $dot)) { + if (($block -split "`n" | Where-Object { $_ -like 'title:*' }) -ne $title) { + throw 'The same game folder produced a different title hash.' + } + if ($block -notmatch 'frames shown: 1 \(PresentX 1\)') { throw 'Missing smoke result.' } + } + 'smoke-relative-game: ok' +} finally { + $resolved = (Resolve-Path -LiteralPath $fixture).Path + if ((Split-Path -Parent $resolved) -eq $temp) { Remove-Item -LiteralPath $resolved -Recurse -Force } +}