Server 任务以 BUILD_TESTING=OFF 把引擎当库引入(避免 EXCLUDE_FROM_ALL 下的测试 找不到可执行文件),于是引擎的 23 组测试从来没在 CI 里跑过,只在开发机上跑。 server/tests 覆盖不到的行为——比如用户日志的连接管理、关闭它时要放开数据目录里 所有缓存句柄——只有这些测试能发现;#491 的一个回归就是这样在本地才测出来的。 新增 Engine 任务:按 engine/vcpkg.json 单独配置引擎、构建、再用 scripts/ci/test-engine.ps1 在与 Server 相同的锁定词库上跑 ctest。数据目录与 LOCALAPPDATA 都隔离到临时目录,布局与 test-server.ps1 一致。同步更新 server/CMakeLists.txt 里「引擎测试经 server/tests 覆盖」的旧说法。 本地按同样命令(不设 BOOST_ROOT,只靠 vcpkg 清单)配置、构建并运行:23/23 通过。
31 lines
1.9 KiB
PowerShell
31 lines
1.9 KiB
PowerShell
param(
|
|
[Parameter(Mandatory = $true)][string]$BuildDir,
|
|
[Parameter(Mandatory = $true)][string]$StagingRoot
|
|
)
|
|
# Runs the engine's own test suite against the product's exact dictionaries.
|
|
#
|
|
# The Server build pulls the engine in with BUILD_TESTING off (see server/CMakeLists.txt), so these
|
|
# tests never ran in CI. Some of them are the only coverage for behaviour the Server tests cannot
|
|
# see -- the user journal's connection handling and the data-directory cleanup contract among them.
|
|
# The data layout mirrors test-server.ps1.
|
|
$ErrorActionPreference = 'Stop'
|
|
$automationRoot = (Resolve-Path (Join-Path $PSScriptRoot '../..')).Path
|
|
$helpcodes = Join-Path $automationRoot 'engine/helpcode/helpcodes'
|
|
if (-not (Test-Path -LiteralPath $helpcodes -PathType Container)) {
|
|
throw "Helpcodes not found at $helpcodes; the engine is vendored in-tree, so this is an incomplete checkout"
|
|
}
|
|
python (Join-Path $automationRoot 'scripts/product_lock.py') fetch-dictionaries --staging-root $StagingRoot
|
|
if ($LASTEXITCODE -ne 0) { throw 'Could not provision locked dictionaries' }
|
|
$verified = (Resolve-Path (Join-Path $StagingRoot 'MetasequoiaImeDict/out')).Path
|
|
# Isolate LOCALAPPDATA as well, so no installed dictionary or user journal is ever touched.
|
|
$env:LOCALAPPDATA = Join-Path (Resolve-Path $StagingRoot).Path 'user-local'
|
|
$data = Join-Path $env:LOCALAPPDATA 'metasequoiaime'
|
|
New-Item -ItemType Directory -Force -Path $data | Out-Null
|
|
Copy-Item (Join-Path $verified '*') -Destination $data -Force
|
|
Copy-Item $helpcodes -Destination $data -Recurse -Force
|
|
Copy-Item (Join-Path $automationRoot 'server/assets/tables/*') -Destination $data -Force
|
|
Copy-Item (Join-Path $automationRoot 'server/assets/config/config.toml') -Destination $data -Force
|
|
$env:METASEQUOIA_IME_DATA_DIR = $data
|
|
ctest --no-tests=error --test-dir $BuildDir -C Release --output-on-failure --timeout 120
|
|
if ($LASTEXITCODE -ne 0) { throw 'Engine tests failed for the locked product' }
|