115 lines
3.8 KiB
PowerShell
115 lines
3.8 KiB
PowerShell
# PowerShell script to test dav1d decoder with detailed error reporting
|
|
Write-Host "=== DAV1D Decoder Error Analysis Test ===" -ForegroundColor Yellow
|
|
Write-Host
|
|
|
|
$appPath = ".\Vav1Player\bin\x64\Debug\net9.0-windows\Vav1Player.exe"
|
|
|
|
if (!(Test-Path $appPath)) {
|
|
Write-Host "Application not found at: $appPath" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
Write-Host "Starting application with console output capture..." -ForegroundColor Cyan
|
|
|
|
# Create a process with redirected output
|
|
$psi = New-Object System.Diagnostics.ProcessStartInfo
|
|
$psi.FileName = $appPath
|
|
$psi.UseShellExecute = $false
|
|
$psi.RedirectStandardOutput = $true
|
|
$psi.RedirectStandardError = $true
|
|
$psi.CreateNoWindow = $true
|
|
|
|
$process = New-Object System.Diagnostics.Process
|
|
$process.StartInfo = $psi
|
|
|
|
# Event handlers to capture output
|
|
$outputBuilder = New-Object System.Text.StringBuilder
|
|
$errorBuilder = New-Object System.Text.StringBuilder
|
|
|
|
$outputHandler = {
|
|
if (-not [String]::IsNullOrEmpty($Event.SourceEventArgs.Data)) {
|
|
$outputBuilder.AppendLine($Event.SourceEventArgs.Data)
|
|
Write-Host "STDOUT: $($Event.SourceEventArgs.Data)" -ForegroundColor Green
|
|
}
|
|
}
|
|
|
|
$errorHandler = {
|
|
if (-not [String]::IsNullOrEmpty($Event.SourceEventArgs.Data)) {
|
|
$errorBuilder.AppendLine($Event.SourceEventArgs.Data)
|
|
Write-Host "STDERR: $($Event.SourceEventArgs.Data)" -ForegroundColor Red
|
|
}
|
|
}
|
|
|
|
# Register event handlers
|
|
Register-ObjectEvent -InputObject $process -EventName OutputDataReceived -Action $outputHandler | Out-Null
|
|
Register-ObjectEvent -InputObject $process -EventName ErrorDataReceived -Action $errorHandler | Out-Null
|
|
|
|
try {
|
|
Write-Host "Launching application..." -ForegroundColor Yellow
|
|
$process.Start() | Out-Null
|
|
$process.BeginOutputReadLine()
|
|
$process.BeginErrorReadLine()
|
|
|
|
# Wait for the application to initialize (5 seconds should be enough)
|
|
$timeout = 5000
|
|
if ($process.WaitForExit($timeout)) {
|
|
Write-Host "Application exited with code: $($process.ExitCode)" -ForegroundColor $(if ($process.ExitCode -eq 0) { "Green" } else { "Red" })
|
|
} else {
|
|
Write-Host "Application still running after $($timeout/1000) seconds, terminating..." -ForegroundColor Yellow
|
|
$process.Kill()
|
|
$process.WaitForExit(2000)
|
|
}
|
|
|
|
} catch {
|
|
Write-Host "Error running application: $($_.Exception.Message)" -ForegroundColor Red
|
|
} finally {
|
|
# Clean up event handlers
|
|
Get-EventSubscriber | Where-Object { $_.SourceObject -eq $process } | Unregister-Event
|
|
|
|
if (!$process.HasExited) {
|
|
$process.Kill()
|
|
}
|
|
$process.Dispose()
|
|
}
|
|
|
|
Write-Host
|
|
Write-Host "=== Captured Output Summary ===" -ForegroundColor Yellow
|
|
|
|
$stdout = $outputBuilder.ToString().Trim()
|
|
$stderr = $errorBuilder.ToString().Trim()
|
|
|
|
if ($stdout) {
|
|
Write-Host "Standard Output:" -ForegroundColor Cyan
|
|
Write-Host $stdout
|
|
} else {
|
|
Write-Host "No standard output captured" -ForegroundColor Gray
|
|
}
|
|
|
|
if ($stderr) {
|
|
Write-Host "Standard Error:" -ForegroundColor Cyan
|
|
Write-Host $stderr
|
|
} else {
|
|
Write-Host "No standard error captured" -ForegroundColor Gray
|
|
}
|
|
|
|
# Look for specific DAV1D error patterns
|
|
Write-Host
|
|
Write-Host "=== Error Pattern Analysis ===" -ForegroundColor Yellow
|
|
|
|
$allOutput = "$stdout`n$stderr"
|
|
if ($allOutput -match "dav1d_open failed") {
|
|
Write-Host "✓ Found dav1d_open failure" -ForegroundColor Red
|
|
}
|
|
if ($allOutput -match "error code: (-?\d+)") {
|
|
$errorCode = $matches[1]
|
|
Write-Host "✓ Error code detected: $errorCode" -ForegroundColor Red
|
|
}
|
|
if ($allOutput -match "Description: (.+)") {
|
|
Write-Host "✓ Error description: $($matches[1])" -ForegroundColor Red
|
|
}
|
|
if ($allOutput -match "Suggestion: (.+)") {
|
|
Write-Host "✓ Troubleshooting: $($matches[1])" -ForegroundColor Yellow
|
|
}
|
|
|
|
Write-Host
|
|
Write-Host "Test completed!" -ForegroundColor Yellow |