Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/smoke.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ $logLine = ($stdout -split "`n" | Where-Object { $_ -match '^Log:\s+(.+)$' } | S
if (-not $logLine) { throw "XCL printed no log path; its output:`n$stdout" }
$log = ($logLine -replace '^Log:\s+', '').Trim()
$text = Get-Content $log -Raw -Encoding utf8
if ([string]::IsNullOrWhiteSpace($text)) { throw "XCL log is empty: $log" }

$frames = if ($text -match '\((\d+) frames shown, (\d+) PresentX calls\)') { "$($Matches[1]) (PresentX $($Matches[2]))" } else { 'none logged (the run did not reach its end)' }
$presents = [regex]::Matches($text, 'activity \(2 s\): (\d+) presents') | ForEach-Object { [int]$_.Groups[1].Value }
Expand Down
26 changes: 26 additions & 0 deletions scripts/test-smoke-empty-log.tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Run with powershell.exe or pwsh.exe. An empty log cannot support a smoke report.
$ErrorActionPreference = 'Stop'
$smoke = Join-Path $PSScriptRoot 'smoke.ps1'
$temp = (Resolve-Path -LiteralPath ([IO.Path]::GetTempPath())).Path
$fixture = Join-Path $temp ('xcl-smoke-empty-' + [guid]::NewGuid())
$null = New-Item -ItemType Directory -Path $fixture
try {
$xcl = Join-Path $fixture 'xcl.cmd'
$log = Join-Path $fixture 'xcl.log'
[IO.File]::WriteAllText($xcl, "@echo off`r`necho Log: %~dp0xcl.log`r`n")
[IO.File]::WriteAllText((Join-Path $fixture 'report.json'), '{"d3d12":{"adapter":"Fixture GPU"}}')

foreach ($content in @('', " `t`r`n")) {
[IO.File]::WriteAllText($log, $content)
$failure = $null
try { $null = & $smoke -Game $fixture -Xcl $xcl -Seconds 1 -Title 'Fixture' }
catch { $failure = $_.Exception.Message }
if ($failure -ne "XCL log is empty: $log") {
throw "Expected the empty log diagnostic, got '$failure'."
}
}
'smoke-empty-log: ok'
} finally {
$resolved = (Resolve-Path -LiteralPath $fixture).Path
if ((Split-Path -Parent $resolved) -eq $temp) { Remove-Item -LiteralPath $resolved -Recurse -Force }
}
Loading