# Runs an ALREADY BUILT desktop test executable. This script never invokes Cargo. # Supply the matching runtime DLL environment prepared by the compiler owner. [CmdletBinding()] param( [Parameter(Mandatory=$true)][string]$TestExecutable, [Parameter(Mandatory=$true)][ValidatePattern('^[0-9a-fA-F]{64}$')][string]$ExpectedSha256, [Parameter(Mandatory=$true)][string]$RunDirectory, [ValidateSet('behavior::scenario_label::tests::actual_font_load_rejects_retained_label_and_old_session', 'scenario_label::tests::actual_font_load_rejects_retained_label_and_old_session')] [string]$TestName = 'behavior::scenario_label::tests::actual_font_load_rejects_retained_label_and_old_session' ) $ErrorActionPreference = 'Stop' $fontTestName = $TestName $fontTestExe = (Resolve-Path -LiteralPath $TestExecutable).Path $fontTestHash = (Get-FileHash -LiteralPath $fontTestExe -Algorithm SHA256).Hash if ($fontTestHash -ne $ExpectedSha256) { throw 'Test executable SHA256 differs from the supplied compiler receipt' } if (Test-Path -LiteralPath $RunDirectory) { throw 'Use a fresh evidence directory; refusing to overwrite a previous run' } $fontTestOutput = (New-Item -ItemType Directory -Path $RunDirectory).FullName # Listing is a separate process and runs no test. Refuse zero/multiple matches # before launching the one process that will mutate global font state. $fontTestList = & $fontTestExe --list --ignored --exact $fontTestName 2>&1 $fontTestListExit = $LASTEXITCODE $fontTestListText = $fontTestList | Out-String $fontTestListText | Set-Content -LiteralPath (Join-Path $fontTestOutput 'selection.log') -Encoding utf8 $fontTestSelected = $fontTestListExit -eq 0 -and $fontTestListText -match ('(?m)^' + [regex]::Escape($fontTestName) + ': test\s*$') -and $fontTestListText -match '(?m)^1 test, 0 benchmarks\s*$' if (-not $fontTestSelected) { throw 'The exact ignored-test selection did not list exactly one test; inspect selection.log' } # Fresh dedicated executable invocation; no normal/other ignored test is chosen. $fontTestStarted = (Get-Date).ToUniversalTime().ToString('o') $fontTestRun = & $fontTestExe --ignored --exact $fontTestName --nocapture --test-threads=1 2>&1 $fontTestExit = $LASTEXITCODE $fontTestRunText = $fontTestRun | Out-String $fontTestRunText | Set-Content -LiteralPath (Join-Path $fontTestOutput 'test.log') -Encoding utf8 $fontTestPassed = $fontTestExit -eq 0 -and $fontTestRunText -match 'test result: ok\. 1 passed; 0 failed; 0 ignored;' @{ test = $fontTestName executable = $fontTestExe sha256 = $fontTestHash exactSelection = $fontTestSelected startedUtc = $fontTestStarted finishedUtc = (Get-Date).ToUniversalTime().ToString('o') exitCode = $fontTestExit passedExactlyOne = $fontTestPassed scope = 'Actual global font Version invalidation and artifact rejection; no WGPU dynamic cache recovery claim' } | ConvertTo-Json | Set-Content -LiteralPath (Join-Path $fontTestOutput 'receipt.json') -Encoding utf8 Write-Output $fontTestRunText if (-not $fontTestPassed) { throw 'Isolated font-version test did not pass exactly one test; inspect test.log and receipt.json' }