Files
msime-windows/scripts/ci/test-server.ps1
T
fanlusky f91dae7644 fix(ci): stop the pipe probe from handshaking with a leftover Server
release.yml runs the Server job on a persistent self-hosted runner while
ci.yml runs it on a fresh windows-2025 image, so only the release path
kept a MetasequoiaImeServer.exe alive between jobs. That leftover holds
Local\MetasequoiaImeServer_SingleInstance, the Server started by
probe-server.ps1 returns 0 straight out of the guard, and the probe then
completes its handshakes against the older build. Probes 1-4 pass because
they do not ask for CharacterSetShortcut; probe 5 does, the pre-6ff1cff
Server never advertises it, and the run dies on a capability mismatch that
nothing in the tree can explain. v0.6.3 and v0.6.4 both failed this way.

Stop any Server and Watchdog before starting one, and fail loudly if the
Server this script starts exits on its own.

Also stop test-server.ps1 from reporting every non-zero verify-contracts
exit as a lock mismatch. A dubious-ownership git failure on the same
runner surfaced as "The engine submodule does not match the product lock"
while the lock was correct.

Also ignore installer/LICENSE.txt, which Prepare-PackageFiles.ps1
generates from the repository LICENSE on every local packaging run.
2026-09-09 01:29:29 +08:00

37 lines
2.4 KiB
PowerShell

param(
[Parameter(Mandatory = $true)][string]$ServerRoot,
[Parameter(Mandatory = $true)][string]$StagingRoot,
[string]$BuildDir = 'build'
)
$ErrorActionPreference = 'Stop'
$automationRoot = (Resolve-Path (Join-Path $PSScriptRoot '../..')).Path
$server = (Resolve-Path $ServerRoot).Path
# The helpcodes moved into the engine, so the gitlink that pins the contracts pins the tables too.
# verify-contracts is what keeps that gitlink and the lock from drifting apart.
$helpcodes = Join-Path $automationRoot 'vendor/MetasequoiaImeEngine/helpcode/helpcodes'
if (-not (Test-Path -LiteralPath $helpcodes -PathType Container)) {
throw "Helpcodes not found at $helpcodes; run git submodule update --init"
}
python (Join-Path $automationRoot 'scripts/product_lock.py') verify-contracts $automationRoot
# A non-zero exit also covers git or python failing outright, which reads nothing
# like a contract mismatch. Point at the output instead of naming a cause.
if ($LASTEXITCODE -ne 0) { throw "verify-contracts exited $LASTEXITCODE; see the output above" }
python (Join-Path $automationRoot 'scripts/product_lock.py') verify-checkout engine (Join-Path $automationRoot 'vendor/MetasequoiaImeEngine')
if ($LASTEXITCODE -ne 0) { throw 'The Engine checkout does not match the product lock' }
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
# Some Windows-only helpers still resolve LOCALAPPDATA; isolate those and the
# cross-platform engine under the same root so no installed dictionary is used.
$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 $server 'assets/tables/*') -Destination $data -Force
Copy-Item (Join-Path $server 'assets/config/config.toml') -Destination $data -Force
$env:METASEQUOIA_IME_DATA_DIR = $data
ctest --test-dir (Join-Path $server $BuildDir) -C Release --output-on-failure --timeout 120
if ($LASTEXITCODE -ne 0) { throw 'Server integration tests failed for the locked product' }
& (Join-Path $PSScriptRoot 'probe-server.ps1') -ServerRoot $server -BuildDir $BuildDir