更新
This commit is contained in:
@@ -9,8 +9,12 @@ $ProjectRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
|
||||
$CompanionRoot = Join-Path $ProjectRoot "video_companion"
|
||||
$Spec = Join-Path $ProjectRoot "packaging\doctor_workstation.spec"
|
||||
|
||||
function Invoke-FrozenSmokeTest {
|
||||
param([Parameter(Mandatory = $true)][string]$Executable)
|
||||
function Invoke-FrozenGate {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)][string]$Executable,
|
||||
[Parameter(Mandatory = $true)][string]$Argument,
|
||||
[Parameter(Mandatory = $true)][string]$GateName
|
||||
)
|
||||
|
||||
$TempRoot = [System.IO.Path]::GetFullPath([System.IO.Path]::GetTempPath())
|
||||
$SmokeRoot = Join-Path $TempRoot ("doctor-workstation-smoke-" + [guid]::NewGuid().ToString("N"))
|
||||
@@ -59,7 +63,7 @@ function Invoke-FrozenSmokeTest {
|
||||
# and lets us drain redirected streams without risking a pipe deadlock.
|
||||
$ProcessInfo = New-Object System.Diagnostics.ProcessStartInfo
|
||||
$ProcessInfo.FileName = $Executable
|
||||
$ProcessInfo.Arguments = "--smoke-test"
|
||||
$ProcessInfo.Arguments = $Argument
|
||||
$ProcessInfo.UseShellExecute = $false
|
||||
$ProcessInfo.CreateNoWindow = $true
|
||||
$ProcessInfo.RedirectStandardOutput = $true
|
||||
@@ -87,15 +91,15 @@ function Invoke-FrozenSmokeTest {
|
||||
$Diagnostics = ($DiagnosticFiles | Where-Object { Test-Path -LiteralPath $_ } |
|
||||
ForEach-Object { Get-Content -LiteralPath $_ -Raw -ErrorAction SilentlyContinue }) -join "`n"
|
||||
if ($TimedOut) {
|
||||
throw "Frozen application smoke test timed out after 30 seconds`n$Diagnostics"
|
||||
throw "$GateName timed out after 30 seconds`n$Diagnostics"
|
||||
}
|
||||
if ($Process.ExitCode -ne 0) {
|
||||
throw "Frozen application smoke test failed with exit code $($Process.ExitCode)`n$Diagnostics"
|
||||
throw "$GateName failed with exit code $($Process.ExitCode)`n$Diagnostics"
|
||||
}
|
||||
if ($Diagnostics -match "(?im)traceback \(most recent call last\)|unhandled exception|uncaught exception|fatal python error") {
|
||||
throw "Frozen application smoke-test logs contain an unhandled exception"
|
||||
throw "$GateName logs contain an unhandled exception"
|
||||
}
|
||||
Write-Host "Frozen entry smoke test passed (--smoke-test, isolated demo mode)."
|
||||
Write-Host "$GateName passed ($Argument, isolated offscreen mode)."
|
||||
}
|
||||
finally {
|
||||
foreach ($Name in $Environment.Keys) {
|
||||
@@ -107,6 +111,42 @@ function Invoke-FrozenSmokeTest {
|
||||
}
|
||||
}
|
||||
|
||||
function Assert-FrozenMultimedia {
|
||||
param([Parameter(Mandatory = $true)][string]$Artifact)
|
||||
|
||||
foreach ($RequiredName in @(
|
||||
"QtMultimedia.pyd",
|
||||
"QtMultimediaWidgets.pyd",
|
||||
"Qt6Multimedia.dll",
|
||||
"Qt6MultimediaWidgets.dll"
|
||||
)) {
|
||||
$RequiredFile = Get-ChildItem -LiteralPath $Artifact -Recurse -Filter $RequiredName -File |
|
||||
Where-Object { $_.FullName -like "*\PySide6\*" } |
|
||||
Select-Object -First 1
|
||||
if (-not $RequiredFile) {
|
||||
throw "Frozen Qt multimedia component is missing: $RequiredName"
|
||||
}
|
||||
}
|
||||
|
||||
$PluginDirectories = @(Get-ChildItem -LiteralPath $Artifact -Recurse -Directory |
|
||||
Where-Object { $_.Name -eq "multimedia" -and $_.Parent.Name -eq "plugins" })
|
||||
if ($PluginDirectories.Count -eq 0) {
|
||||
throw "Frozen PySide6 plugins/multimedia directory is missing"
|
||||
}
|
||||
foreach ($BackendName in @("ffmpegmediaplugin.dll", "windowsmediaplugin.dll")) {
|
||||
$Backend = $PluginDirectories |
|
||||
ForEach-Object {
|
||||
Get-ChildItem -LiteralPath $_.FullName -Filter $BackendName -File -ErrorAction SilentlyContinue
|
||||
} |
|
||||
Select-Object -First 1
|
||||
if (-not $Backend) {
|
||||
throw "Frozen Qt multimedia backend is missing: $BackendName"
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Frozen Qt multimedia file gate passed."
|
||||
}
|
||||
|
||||
if (-not [System.IO.Path]::IsPathRooted($Python)) {
|
||||
$Python = Join-Path $ProjectRoot $Python
|
||||
}
|
||||
@@ -162,7 +202,15 @@ try {
|
||||
if (-not (Test-Path -LiteralPath $Executable -PathType Leaf)) {
|
||||
throw "Frozen application entry point is missing: $Executable"
|
||||
}
|
||||
Invoke-FrozenSmokeTest -Executable $Executable
|
||||
Assert-FrozenMultimedia -Artifact $Artifact
|
||||
Invoke-FrozenGate `
|
||||
-Executable $Executable `
|
||||
-Argument "--media-smoke-test" `
|
||||
-GateName "Frozen Qt multimedia smoke gate"
|
||||
Invoke-FrozenGate `
|
||||
-Executable $Executable `
|
||||
-Argument "--smoke-test" `
|
||||
-GateName "Frozen application entry smoke gate"
|
||||
|
||||
Write-Host "Build complete: $Artifact"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user