tests / windows (push) Failing after 14m37s
tests / linux (push) Successful in 2m11s
tests / macos (push) Successful in 1m14s
tests / package-smoke-linux (push) Skipped
tests / package-smoke-windows (push) Skipped
tests / package-smoke-macos (push) Skipped
70 lines
3.4 KiB
PowerShell
70 lines
3.4 KiB
PowerShell
# Дымовая проверка установленного дерева (результат cmake --install) на Windows.
|
||
#
|
||
# powershell -File tests\scripts\smoke_installed.ps1 -Prefix C:\r\bl-smoke-stage
|
||
#
|
||
# Проверяет, что windeployqt положил всё нужное (DLL Qt, плагины платформ и QML),
|
||
# лаунчер запускается без окна и через 10 секунд ещё жив, а в логе нет ошибок
|
||
# загрузки модулей.
|
||
#
|
||
# QDir::homePath() на Windows берёт профиль у системы и USERPROFILE не читает,
|
||
# поэтому лаунчер запускается с BILAUNCHER_HOME на временную папку (см.
|
||
# launcherpaths.h) — настоящая %APPDATA%\BiLauncher раннера не трогается.
|
||
|
||
param(
|
||
[Parameter(Mandatory = $true)][string]$Prefix,
|
||
[int]$RunSeconds = 10
|
||
)
|
||
|
||
$ErrorActionPreference = "Stop"
|
||
function Fail($message) { Write-Host "SMOKE FAIL: $message"; exit 1 }
|
||
|
||
$bin = Join-Path $Prefix "bin\BiLauncher.exe"
|
||
if (-not (Test-Path $bin)) { Fail "нет $bin" }
|
||
foreach ($required in @("bin\Qt6Core.dll", "bin\Qt6Quick.dll", "bin\Qt6Network.dll",
|
||
"bin\platforms\qwindows.dll", "bin\qml\QtQuick\Controls")) {
|
||
if (-not (Test-Path (Join-Path $Prefix $required))) { Fail "нет $required" }
|
||
}
|
||
if (-not (Get-ChildItem (Join-Path $Prefix "bin\tls") -Filter "*.dll" -ErrorAction SilentlyContinue)) {
|
||
Fail "нет TLS-плагина (bin\tls) — лаунчер не сможет ходить по https"
|
||
}
|
||
|
||
$realProfile = Join-Path $env:APPDATA "BiLauncher"
|
||
$realExisted = Test-Path $realProfile
|
||
|
||
$sandbox = Join-Path $env:TEMP ("bilauncher-smoke-" + [guid]::NewGuid().ToString("N"))
|
||
$log = Join-Path $sandbox "log"
|
||
New-Item -ItemType Directory -Force $log | Out-Null
|
||
$stdout = Join-Path $log "stdout.log"
|
||
$stderr = Join-Path $log "stderr.log"
|
||
$profileRoot = Join-Path $sandbox "AppData\Roaming\BiLauncher"
|
||
|
||
$env:BILAUNCHER_HOME = $sandbox
|
||
$env:QT_QPA_PLATFORM = "offscreen"
|
||
$env:QT_FORCE_STDERR_LOGGING = "1"
|
||
$env:QTWEBENGINE_CHROMIUM_FLAGS = "--disable-gpu"
|
||
|
||
try {
|
||
$process = Start-Process -FilePath $bin -PassThru -NoNewWindow `
|
||
-RedirectStandardOutput $stdout -RedirectStandardError $stderr
|
||
Start-Sleep -Seconds $RunSeconds
|
||
$alive = -not $process.HasExited
|
||
if ($alive) { Stop-Process -Id $process.Id -Force; $process.WaitForExit(5000) | Out-Null }
|
||
|
||
$text = ""
|
||
if (Test-Path $stderr) { $text += Get-Content $stderr -Raw }
|
||
if (Test-Path $stdout) { $text += Get-Content $stdout -Raw }
|
||
Write-Host "----- лог запуска -----"
|
||
Write-Host $text
|
||
|
||
if (-not $alive) { Fail "лаунчер завершился раньше чем через $RunSeconds с (код $($process.ExitCode))" }
|
||
if ($text -match "is not installed|Cannot load library|could not find the Qt platform plugin|QQmlApplicationEngine failed") {
|
||
Fail "в логе ошибки загрузки модулей"
|
||
}
|
||
if (-not (Test-Path (Join-Path $profileRoot "settings.json"))) { Fail "лаунчер не создал $profileRoot\settings.json" }
|
||
if (-not $realExisted -and (Test-Path $realProfile)) { Fail "лаунчер создал настоящую $realProfile мимо BILAUNCHER_HOME" }
|
||
Write-Host "SMOKE OK: $bin"
|
||
}
|
||
finally {
|
||
Remove-Item -Recurse -Force $sandbox -ErrorAction SilentlyContinue
|
||
}
|