Add M9.8e reproducible Windows client package

Static-runtime client-package preset with /Brepro and a build identity printed by
evo-client --version (ADR-0086). tools/client packages an explicit allowlist with
licence texts from the verified sources, BUILD-INFO and SHA256SUMS into a
deterministic ZIP, refusing credentials, profile paths and non-system imports;
verification runs the extracted client without Visual Studio, and a self-test
proves each guard. Publication via Gitea Actions waits for a Windows runner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-02 16:48:12 -04:00
co-authored by Claude Opus 5.5
parent 582d4baa20
commit 6262c778c7
19 changed files with 682 additions and 14 deletions
+13
View File
@@ -28,6 +28,19 @@ option(EVO_BUILD_UI_PROBE "Build the isolated M9.8a Dear ImGui compatibility pro
option(EVO_BUILD_CLIENT_PROBE "Build the isolated M9.1 SDL dependency probe" OFF)
option(EVO_BUILD_CLIENT "Build the native M9 engineering client" OFF)
option(EVO_BUILD_NETWORK "Build the M9.6 dev session protocol and TLS adapter (explicit Mbed TLS preparation required)" OFF)
# M9.8e Windows package (ADR-0086): identity printed by `evo-client --version`, set by
# tools/client/package-windows.ps1; deterministic MSVC objects/binaries for packaging.
set(EVO_BUILD_IDENTITY "unpackaged" CACHE STRING "evo-client build identity")
string(LENGTH "${EVO_BUILD_IDENTITY}" evo_identity_length)
if(NOT EVO_BUILD_IDENTITY MATCHES "^[0-9A-Za-z.+-]+$" OR evo_identity_length GREATER 64)
message(FATAL_ERROR "EVO_BUILD_IDENTITY must be 1-64 characters of [0-9A-Za-z.+-]")
endif()
option(EVO_REPRODUCIBLE "MSVC: deterministic objects and binaries (/Brepro)" OFF)
if(MSVC AND EVO_REPRODUCIBLE)
# Before any dependency is added, so SDL, Mbed TLS and Dear ImGui are covered too.
add_compile_options(/Brepro)
add_link_options(/Brepro)
endif()
set(EVO_SANITIZER "none" CACHE STRING "none, address (ASan/UBSan), or thread")
set_property(CACHE EVO_SANITIZER PROPERTY STRINGS none address thread)
include(cmake/ProjectOptions.cmake)
+6 -3
View File
@@ -11,7 +11,8 @@
{"name": "client", "inherits": "release", "cacheVariables": {"EVO_BUILD_CLIENT": "ON"}},
{"name": "client-probe", "inherits": "release", "cacheVariables": {"EVO_BUILD_CLIENT_PROBE": "ON"}},
{"name": "network", "inherits": "release", "cacheVariables": {"EVO_BUILD_NETWORK": "ON"}},
{"name": "client-network", "inherits": "release", "cacheVariables": {"EVO_BUILD_CLIENT": "ON", "EVO_BUILD_NETWORK": "ON"}}
{"name": "client-network", "inherits": "release", "cacheVariables": {"EVO_BUILD_CLIENT": "ON", "EVO_BUILD_NETWORK": "ON"}},
{"name": "client-package", "inherits": "client-network", "cacheVariables": {"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded", "EVO_REPRODUCIBLE": "ON"}}
],
"buildPresets": [
{"name": "debug", "configurePreset": "debug"},
@@ -22,7 +23,8 @@
{"name": "client", "configurePreset": "client", "targets": ["evo-client-state-tests", "evo-client", "evo-client-lifecycle-tests", "evo-client-environment-tests", "evo-client-organism-tests", "evo-client-ui-model-tests", "evo-client-panel-tests", "evo-client-bindings-tests"]},
{"name": "client-probe", "configurePreset": "client-probe", "targets": ["evo-client-probe"]},
{"name": "network", "configurePreset": "network", "targets": ["evo-client-state-tests", "evo-network-tests", "evo-dev-session"]},
{"name": "client-network", "configurePreset": "client-network", "targets": ["evo-client-state-tests", "evo-client", "evo-client-lifecycle-tests", "evo-client-environment-tests", "evo-client-organism-tests", "evo-client-ui-model-tests", "evo-client-panel-tests", "evo-client-bindings-tests", "evo-network-tests", "evo-dev-session"]}
{"name": "client-network", "configurePreset": "client-network", "targets": ["evo-client-state-tests", "evo-client", "evo-client-lifecycle-tests", "evo-client-environment-tests", "evo-client-organism-tests", "evo-client-ui-model-tests", "evo-client-panel-tests", "evo-client-bindings-tests", "evo-network-tests", "evo-dev-session"]},
{"name": "client-package", "configurePreset": "client-package", "targets": ["evo-client-state-tests", "evo-client", "evo-client-lifecycle-tests", "evo-client-environment-tests", "evo-client-organism-tests", "evo-client-ui-model-tests", "evo-client-panel-tests", "evo-client-bindings-tests", "evo-network-tests", "evo-dev-session"]}
],
"testPresets": [
{"name": "debug", "configurePreset": "debug", "output": {"outputOnFailure": true}},
@@ -33,6 +35,7 @@
{"name": "client", "configurePreset": "client", "filter": {"include": {"label": "client"}}, "output": {"outputOnFailure": true}},
{"name": "client-probe", "configurePreset": "client-probe", "filter": {"include": {"label": "client"}}, "output": {"outputOnFailure": true}},
{"name": "network", "configurePreset": "network", "filter": {"include": {"label": "network"}}, "output": {"outputOnFailure": true}},
{"name": "client-network", "configurePreset": "client-network", "filter": {"include": {"label": "client|network"}}, "output": {"outputOnFailure": true}}
{"name": "client-network", "configurePreset": "client-network", "filter": {"include": {"label": "client|network"}}, "output": {"outputOnFailure": true}},
{"name": "client-package", "configurePreset": "client-package", "filter": {"include": {"label": "client|network"}}, "output": {"outputOnFailure": true}}
]
}
+6 -2
View File
@@ -206,5 +206,9 @@ ctest --test-dir build/client-probe -R ui-probe --output-on-failure
```
Use an MSVC developer shell on Windows. See ADR-0084 and
[the M9.8 plan](docs/engineering/M9_8_DELIVERY_PLAN.md) for the remaining UI,
local Windows packaging and low-spec qualification work.
[the M9.8 plan](docs/engineering/M9_8_DELIVERY_PLAN.md) for the remaining
low-spec qualification work.
M9.8e Windows x64 tester ZIP (static runtime, notices, identity, checksums; ADR-0086):
`tools\client\package-windows.ps1`, then `tools\client\verify-windows-package.ps1
-Zip build\packages\<name>.zip`. See [CLIENT_PACKAGING](docs/engineering/CLIENT_PACKAGING.md).
+9 -1
View File
@@ -223,6 +223,13 @@ int main(int argc, char** argv) try {
bool connect_now = false;
for (int i = 1; i < argc; ++i) {
const std::string_view arg{argv[i]};
if (arg == "--version") { // Build identity for tester reports (ADR-0086).
std::printf("evo-client %s (Aeternalis Evolution engineering client; remote "
"sessions %s)\n",
EVO_BUILD_IDENTITY,
evo::client_app::remote_available ? "available" : "unavailable");
return 0;
}
if (arg == "--hidden")
config.hidden = true;
else if (arg == "--fixture")
@@ -262,7 +269,8 @@ int main(int argc, char** argv) try {
} else if (arg == "--show-controls") { // Engineering review: open the panel.
show_controls = true;
} else {
std::fputs("usage: evo-client [--renderer NAME] [--hidden] [--frames 1..100000]\n"
std::fputs("usage: evo-client [--version] [--renderer NAME] [--hidden] "
"[--frames 1..100000]\n"
" [--fixture | --connect HOST:PORT --server-name NAME "
"--ca FILE --grants FILE]\n"
" [--layer water|nitrogen|...|heat|moisture]\n"
+1
View File
@@ -68,6 +68,7 @@ if(EVO_BUILD_CLIENT)
evo_owned_target(evo_client_platform)
add_executable(evo-client apps/evo-client/main.cpp apps/evo-client/panels.cpp)
target_link_libraries(evo-client PRIVATE evo_client_platform evo_client_ui evo_imgui)
target_compile_definitions(evo-client PRIVATE EVO_BUILD_IDENTITY="${EVO_BUILD_IDENTITY}")
if(EVO_BUILD_NETWORK)
# M9.7 remote dev session mode (ADR-0083).
target_link_libraries(evo-client PRIVATE evo_network_session)
+2 -2
View File
@@ -457,8 +457,8 @@ terrain meshing or procedural creature animation is required.
**M9.8a (2026-10-02):** isolated Dear ImGui 1.92.9b probe qualified on Windows/Linux;
M9.8b adds bounded UI state, protected external input capture and bounded session
event delivery. M9.8c integrates the launcher, legend, labelled inspector, click
selection and session panel. M9.8d adds rebindable controls (ADR-0085). ADR-0084
records the toolkit scopes.
selection and session panel. M9.8d adds rebindable controls (ADR-0085). M9.8e
packages a local Windows x64 ZIP (ADR-0086). ADR-0084 records the toolkit scopes.
**M9.8 planning (2026-10-02):** user-confirmed Windows ZIP, temporary Gitea Actions
artifacts, labelled engineering UI/launcher and control rebinding. See the
+4 -2
View File
@@ -8,10 +8,12 @@ external input capture and bounded session events with disconnect/drain/reconnec
backpressure. M9.8c adds the launcher (labelled local fixture vs dev region,
bounded errors, Retry/Cancel), legend, labelled inspector, click selection, session
panel with the intention outcome record, and visible notifications/dialog. M9.8d
adds rebindable controls (ADR-0085) with conflict checks and a validated file. Tests,
adds rebindable controls (ADR-0085) with conflict checks and a validated file. M9.8e
builds a static-runtime Windows x64 ZIP locally with notices, identity, checksums and
credential guards (ADR-0086); Actions publication needs a Windows runner. Tests,
visual review and limits are recorded in engineering/VALIDATION.md.
Next: M9.8e reproducible Windows ZIP, then route design and qualification (9.8f-g).
Next: M9.8f dev TCP route design, then M9.8g qualification on the low-spec VM.
Windows packages will be built locally until a Windows runner exists. Testing is internal; 172.10.1.160 is the
RKE2 control-plane address. VM qualification and the cluster restart drill remain
outstanding, as agreed. See engineering/M9_8_DELIVERY_PLAN.md.
+53
View File
@@ -0,0 +1,53 @@
# ADR-0086: Windows client package
## Status
Accepted for M9.8e (2026-10-02). Local packaging on the Windows development host;
Gitea Actions publication waits for a Windows runner. Internal test builds only.
## Context
Testers need a Windows x64 ZIP of the engineering client that runs on a clean
machine, says exactly which build it is, carries third-party notices, and cannot
leak development credentials. No Windows CI runner exists yet; the Linux runner
must not silently build Windows packages and no untested cross-compile is assumed.
## Decision
- Preset `client-package` (client + network) links the **static MSVC runtime**
(`CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded`) for the client, SDL, Mbed TLS and
Dear ImGui, so no Visual C++ redistributable or Microsoft runtime DLL is shipped
or required. Executables may import only listed Windows system DLLs and the
bundled `SDL3.dll`; the scripts check this from the PE import tables.
- `EVO_REPRODUCIBLE` adds `/Brepro` to every MSVC compile and link, before any
dependency is added. ZIP entries are sorted, under one top folder, stamped with
the commit time. A rebuild of the same commit on the same toolchain should give
the same ZIP; this is verified, not assumed (see VALIDATION.md).
- Identity `g<12 hex of commit>[-dirty]` is configured as `EVO_BUILD_IDENTITY`
and printed by `evo-client --version`. Packaging refuses uncommitted tracked
changes unless `-AllowDirty`, which marks the identity dirty.
- `tools/client/package-windows.ps1` builds and runs the client/network CTest
suite in that preset, then stages an explicit allowlist: `evo-client.exe`,
`SDL3.dll`, README, BUILD-INFO (commit, toolchain, dependency versions and
source checksums, test summary), THIRD-PARTY-NOTICES and LICENSES copied from the
checksum-verified sources (SDL with its compiled HIDAPI, yuv2rgb, stb_image and
Khronos headers; Mbed TLS under Apache-2.0; Dear ImGui with embedded fonts and
stb headers), and SHA256SUMS. It refuses any other file, credential file types,
PEM private keys or certificates, and embedded user-profile paths.
- `tools/client/verify-windows-package.ps1` needs no Visual Studio: it checks the
ZIP digest, content and checksums, imports and secrets, then runs the extracted
client with only system directories on PATH (version, usage error, fixture and
launcher with the dummy driver, credential-file failure; optionally a window).
- The README states an internal engineering test build: no licence is granted and
it must not be redistributed. Third-party licences are reproduced in full.
- Publication: none automated yet. The ZIP and `.sha256` are produced locally; a
Gitea Actions job will be added only with a registered Windows runner.
## Alternatives considered
- App-local VC++ runtime DLLs: redistributes Microsoft binaries and their terms.
- Requiring the VC++ redistributable: a setup step that testers can miss.
- CPack: adds a generator layer for a single ZIP with custom checks.
- A gated Windows workflow job now: unexecuted and untested until a runner exists.
## Consequences
Static runtime: each image has its own CRT state; SDL's C API passes no CRT objects
across the DLL boundary. Package and verification scripts change with the file
list. Clean-machine/VM runs and minimum hardware remain M9.8g qualification.
The notice inventory is an engineering record, not a legal review.
+1
View File
@@ -97,4 +97,5 @@ design. No unadopted candidate is a link dependency of the proof.
- [ADR-0083: Dev region sessions](0083-dev-region-sessions.md) - session server in evo-server, durable no-effect intentions on synthetic carriers, empty organism presentation, reconnect with fresh baselines, loopback-only drill-time dev deployment.
- [ADR-0084: Engineering UI toolkit](0084-engineering-ui-toolkit.md) - Dear ImGui 1.92.9b pinned (M9.8a) and integrated as the engineering client overlay with toolkit-first input routing (M9.8c).
- [ADR-0086: Windows client package](0086-windows-client-package.md) - static-runtime Windows x64 ZIP with explicit allowlist, licence texts, build identity, SHA256 manifest, credential guards and deterministic layout; local packaging until a Windows runner exists.
- [ADR-0085: Rebindable engineering controls](0085-rebindable-engineering-controls.md) - SDL-free action/HID-key bindings, conflict validation, versioned all-or-nothing controls file, binding capture before toolkit/world.
+2
View File
@@ -51,6 +51,8 @@ Controls are saved to `controls-v1.txt` in the per-user settings directory
(Windows: `%APPDATA%\Aeternalis Games\Evolution Engineering Client`); `--controls
FILE` uses another file and `--show-controls` opens the Controls panel at start.
An invalid file is reported, left unchanged, and defaults apply.
`--version` prints the build identity (`unpackaged` outside packaging; ADR-0086,
[packaging](CLIENT_PACKAGING.md)).
`--pick X,Y` performs one scripted world click at window coordinates and
`--screenshot FILE.bmp` (requires `--frames`) saves the last frame; both exist for
unattended visual review.
+45
View File
@@ -0,0 +1,45 @@
# Windows client package (M9.8e)
Decision: [ADR-0086](../adr/0086-windows-client-package.md). Windows development host
only; requires Visual Studio 2022 C++ tools and prepared SDL, Dear ImGui and Mbed TLS
sources (`cmake -P tools/prepare-sdl3.cmake`, `prepare-imgui.cmake`,
`prepare-mbedtls.cmake`).
## Build a package
```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File tools\client\package-windows.ps1
```
It refuses uncommitted tracked changes (`-AllowDirty` packages them with a `-dirty`
identity), configures `client-package` with `EVO_BUILD_IDENTITY=g<12 hex>`, builds,
runs the client/network CTest suite, stages the allowlisted files and writes
`build/packages/evo-client-windows-x64-<identity>.zip` and `.zip.sha256`. The staged
folder stays next to the ZIP. `-Clean` deletes `build/client-package` first; the
build log is `build/client-package.log` (+ `.err`).
Package content (exact): `evo-client.exe`, `SDL3.dll`, `README.txt`,
`BUILD-INFO.txt`, `THIRD-PARTY-NOTICES.txt`, `SHA256SUMS.txt` and `LICENSES/`
(SDL3, its HIDAPI, yuv2rgb, stb_image and Khronos notices, Apache-2.0, Mbed TLS,
Dear ImGui with fonts and stb notices). The tester README template is
`tools/client/README-package.txt`; the notice index is
`tools/client/THIRD-PARTY-NOTICES.txt`. No credentials, grant bundles, CA files or
settings are ever packaged; dev CA and grants are issued to testers separately.
## Verify a package
```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File tools\client\verify-windows-package.ps1 -Zip build\packages\<name>.zip [-Interactive]
powershell -NoProfile -ExecutionPolicy Bypass -File tools\client\package-selftest.ps1 -Staged build\packages\<name> -DynamicRuntimeImage build\client-network\evo-client.exe
```
Verification works without Visual Studio (copy `tools/client` with the ZIP): digest,
exact content and SHA256SUMS, PE imports limited to system DLLs plus `SDL3.dll`,
credential and profile-path scan, then the extracted client runs with only the
Windows system directories on PATH. `-Interactive` opens a real window for 3 s.
The self-test proves each guard refuses its defect.
## Not yet covered
- Gitea Actions publication: needs a Windows runner (none registered).
- A clean Windows VM run and hardware/DPI qualification: M9.8g.
- Code signing: none; Windows SmartScreen may warn on first run.
+3 -1
View File
@@ -2,7 +2,9 @@
Status: M9.8a probe, M9.8b owned state/capture/event bounds, M9.8c launcher,
legend, labelled inspector and click selection, and M9.8d rebindable controls
complete, 2026-10-02; remaining segments planned.
complete, 2026-10-02. M9.8e local Windows ZIP complete (ADR-0086); its Gitea
Actions publication waits for a Windows runner and its clean-VM run for M9.8g.
Remaining segments planned.
No application UI or deployment completion is claimed. See ADR-0084 for the toolkit boundary.
## Confirmed scope
+41
View File
@@ -0,0 +1,41 @@
Aeternalis Evolution - engineering client {{IDENTITY}}
=====================================================
Internal engineering test build. No licence is granted for this software; do not
redistribute it. Third-party components keep their own licences: see
THIRD-PARTY-NOTICES.txt and the LICENSES folder.
Built from commit {{COMMIT}} ({{COMMIT_TIME}} UTC). BUILD-INFO.txt lists the
toolchain and dependency versions; SHA256SUMS.txt lists every file's checksum.
Please quote the identity printed by `evo-client --version` in every report.
Requirements
------------
Windows 10 or 11, x64. No installer and no Visual C++ redistributable is needed:
the client uses the static Microsoft C++ runtime and only Windows system DLLs plus
the bundled SDL3.dll. Minimum hardware is not yet qualified.
Running
-------
Extract the whole folder anywhere and run evo-client.exe. A launcher opens:
* Local fixture - an in-memory stand-in for an environment with static organisms.
It is not a server, not an ecosystem and not authoritative.
* Connect to a dev region - needs an endpoint, the server name, the dev CA file
(dev-ca.pem) and a grant bundle file. These are issued separately by the
development team and are never part of this package. Files are read when you
press Connect; nothing is saved. Do not share grant bundles.
Controls (defaults, rebindable in Controls...): W A S D move, arrow keys pan,
mouse wheel zooms, left click selects, Tab toggles UI capture. Key names refer to
US-layout key positions. Changed controls are saved in
%APPDATA%\Aeternalis Games\Evolution Engineering Client\controls-v1.txt.
No other settings, logs or credentials are written by the client.
Useful options: --version, --fixture, --renderer software, --controls FILE.
Any unknown option prints the full usage.
Verifying the download
----------------------
The .zip is accompanied by a .zip.sha256 file. Inside the folder, every file's
SHA-256 is listed in SHA256SUMS.txt (for example: Get-FileHash -Algorithm SHA256).
+33
View File
@@ -0,0 +1,33 @@
Third-party notices - Aeternalis Evolution engineering client (Windows x64)
==========================================================================
This package contains or statically links the following third-party software.
The full licence texts, copied unchanged from the pinned, checksum-verified
upstream sources, are in the LICENSES folder. Versions and source checksums are
listed in BUILD-INFO.txt.
SDL 3 (SDL3.dll) zlib License LICENSES/SDL3.txt
Bundled components compiled into SDL3.dll:
- HIDAPI (src/hidapi), used under BSD-style licence LICENSES/SDL3-hidapi.txt
the BSD option offered by its licence
- yuv2rgb (src/video/yuv2rgb) BSD 3-Clause LICENSES/SDL3-yuv2rgb.txt
- stb_image (src/video) MIT or public domain LICENSES/SDL3-stb_image.txt
- Khronos Vulkan, EGL and OpenGL ES API headers
Apache-2.0 / Khronos MIT-style
LICENSES/Khronos.txt,
LICENSES/Apache-2.0.txt
Mbed TLS (statically linked) Apache-2.0 (chosen from Apache-2.0 OR
GPL-2.0-or-later) LICENSES/MbedTLS.txt,
LICENSES/Apache-2.0.txt
Dear ImGui (statically linked) MIT License LICENSES/DearImGui.txt
- Embedded fonts ProggyClean and ProggyForever (MIT)
LICENSES/DearImGui-embedded-fonts.txt,
LICENSES/DearImGui-FONTS.md
- imstb_rectpack, imstb_textedit, imstb_truetype (MIT or public domain)
LICENSES/DearImGui-stb.txt
The Microsoft C/C++ runtime is linked statically by the Microsoft compiler; it is
not redistributed as separate files. No other third-party code is included.
This inventory is an engineering record, not a legal review.
+137
View File
@@ -0,0 +1,137 @@
# Shared by package-windows.ps1 and verify-windows-package.ps1 (ADR-0086).
# Windows PowerShell 5.1 compatible; no Visual Studio needed for verification.
Set-StrictMode -Version Latest
# Exact package content (relative paths). Anything else fails packaging/verification.
$script:PackageFiles = @(
'BUILD-INFO.txt',
'LICENSES/Apache-2.0.txt',
'LICENSES/DearImGui-FONTS.md',
'LICENSES/DearImGui-embedded-fonts.txt',
'LICENSES/DearImGui-stb.txt',
'LICENSES/DearImGui.txt',
'LICENSES/Khronos.txt',
'LICENSES/MbedTLS.txt',
'LICENSES/SDL3-hidapi.txt',
'LICENSES/SDL3-stb_image.txt',
'LICENSES/SDL3-yuv2rgb.txt',
'LICENSES/SDL3.txt',
'README.txt',
'SDL3.dll',
'SHA256SUMS.txt',
'THIRD-PARTY-NOTICES.txt',
'evo-client.exe'
)
# Imports allowed for the executables: Windows system DLLs and the bundled SDL3.dll.
# The C/C++ runtime is static (no MSVCP/VCRUNTIME/api-ms-win-crt/ucrtbase).
$script:AllowedImports = @(
'advapi32.dll', 'bcrypt.dll', 'gdi32.dll', 'imm32.dll', 'kernel32.dll', 'ole32.dll',
'oleaut32.dll', 'sdl3.dll', 'setupapi.dll', 'shell32.dll', 'user32.dll', 'version.dll',
'winmm.dll', 'ws2_32.dll'
)
function Get-Sha256([string]$Path) {
(Get-FileHash -Algorithm SHA256 -LiteralPath $Path).Hash.ToLowerInvariant()
}
function Get-RelativeFiles([string]$Root) {
$prefix = (Resolve-Path -LiteralPath $Root).Path.TrimEnd('\') + '\'
Get-ChildItem -LiteralPath $Root -Recurse -File -Force | ForEach-Object {
$_.FullName.Substring($prefix.Length).Replace('\', '/')
} | Sort-Object -CaseSensitive
}
# Names of DLLs in the import and delay-import tables of a PE32+ image.
function Get-PeImports([string]$Path) {
$bytes = [IO.File]::ReadAllBytes($Path)
$pe = [BitConverter]::ToInt32($bytes, 0x3C)
if ([BitConverter]::ToUInt32($bytes, $pe) -ne 0x4550) { throw "Not a PE image: $Path" }
$sections = [BitConverter]::ToUInt16($bytes, $pe + 6)
$optionalSize = [BitConverter]::ToUInt16($bytes, $pe + 20)
$optional = $pe + 24
if ([BitConverter]::ToUInt16($bytes, $optional) -ne 0x20B) { throw "Not PE32+ (x64): $Path" }
$table = $optional + $optionalSize
$toOffset = {
param([uint32]$rva)
for ($i = 0; $i -lt $sections; ++$i) {
$s = $table + 40 * $i
$size = [Math]::Max([BitConverter]::ToUInt32($bytes, $s + 8), [BitConverter]::ToUInt32($bytes, $s + 16))
$address = [BitConverter]::ToUInt32($bytes, $s + 12)
if ($rva -ge $address -and $rva -lt $address + $size) {
return [int]($rva - $address + [BitConverter]::ToUInt32($bytes, $s + 20))
}
}
throw "RVA outside sections in $Path"
}
$readName = {
param([uint32]$rva)
$start = & $toOffset $rva
$end = [Array]::IndexOf($bytes, [byte]0, $start)
[Text.Encoding]::ASCII.GetString($bytes, $start, $end - $start)
}
$names = New-Object System.Collections.Generic.List[string]
# Data directories start at optional+112 (PE32+): [1] imports, [13] delay imports.
foreach ($entry in @(@{ Index = 1; Stride = 20; Name = 12 }, @{ Index = 13; Stride = 32; Name = 4 })) {
$rva = [BitConverter]::ToUInt32($bytes, $optional + 112 + 8 * $entry.Index)
if ($rva -eq 0) { continue }
$at = & $toOffset $rva
$n = 0
while ($true) {
if (++$n -gt 4096) { throw "Unterminated import table in $Path" }
$nameRva = [BitConverter]::ToUInt32($bytes, $at + $entry.Name)
if ($nameRva -eq 0) { break }
$names.Add((& $readName $nameRva).ToLowerInvariant())
$at += $entry.Stride
}
}
$names | Sort-Object -Unique
}
function Assert-AllowedImports([string]$Path) {
foreach ($name in (Get-PeImports $Path)) {
if ($script:AllowedImports -notcontains $name) {
throw "$([IO.Path]::GetFileName($Path)) imports $name, which is not an allowed system DLL"
}
}
}
# Refuses credential material and developer profile paths in any staged file.
function Assert-NoSecrets([string]$Root) {
$forbidden = @('.pem', '.key', '.crt', '.cer', '.der', '.p12', '.pfx', '.bin', '.env', '.ini', '.json')
foreach ($relative in (Get-RelativeFiles $Root)) {
if ($forbidden -contains [IO.Path]::GetExtension($relative).ToLowerInvariant()) {
throw "Credential-like file type staged: $relative"
}
$text = [Text.Encoding]::GetEncoding(28591).GetString([IO.File]::ReadAllBytes((Join-Path $Root $relative)))
if ($text -match '-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----\s*[A-Za-z0-9+/=]{32}') {
throw "Private key material found in $relative"
}
if ($text -match '-----BEGIN CERTIFICATE-----\s*[A-Za-z0-9+/=]{32}') {
throw "Certificate found in $relative"
}
if ($text -match '(?i)[A-Z]:[\\/]Users[\\/]') {
throw "A user profile path is embedded in $relative"
}
}
}
# Checks SHA256SUMS.txt against the folder and that the folder holds exactly the
# expected files.
function Assert-PackageContent([string]$Root) {
$files = @(Get-RelativeFiles $Root)
$expected = @($script:PackageFiles | Sort-Object -CaseSensitive)
if (Compare-Object $files $expected -CaseSensitive) {
throw "Package content differs from the allowlist: $((Compare-Object $files $expected -CaseSensitive | ForEach-Object { $_.InputObject }) -join ', ')"
}
$listed = @{}
foreach ($line in [IO.File]::ReadAllLines((Join-Path $Root 'SHA256SUMS.txt'))) {
if ($line -notmatch '^([0-9a-f]{64}) (\S+)$') { throw "Malformed SHA256SUMS line: $line" }
$listed[$matches[2]] = $matches[1]
}
foreach ($relative in $expected) {
if ($relative -eq 'SHA256SUMS.txt') { continue }
if (!$listed.ContainsKey($relative)) { throw "Not in SHA256SUMS.txt: $relative" }
if ((Get-Sha256 (Join-Path $Root $relative)) -ne $listed[$relative]) { throw "Checksum mismatch: $relative" }
}
if ($listed.Count -ne $expected.Count - 1) { throw 'SHA256SUMS.txt lists unexpected files' }
}
+50
View File
@@ -0,0 +1,50 @@
# M9.8e negative checks for the package guards (ADR-0086). Copies a staged package
# folder, applies one defect at a time and requires each guard to refuse it.
# Usage: package-selftest.ps1 -Staged build\packages\<name> [-DynamicRuntimeImage FILE]
param(
[Parameter(Mandatory = $true)][string]$Staged,
# An image linked against the dynamic MSVC runtime (e.g. build\client-network\evo-client.exe).
[string]$DynamicRuntimeImage = ''
)
$ErrorActionPreference = 'Stop'
. (Join-Path $PSScriptRoot 'package-common.ps1')
$utf8 = New-Object Text.UTF8Encoding $false
$failures = 0
function Expect-Refused([string]$Label, [scriptblock]$Mutate, [scriptblock]$Check) {
$copy = Join-Path ([IO.Path]::GetTempPath()) ("evo-package-selftest-" + [Guid]::NewGuid().ToString('N'))
Copy-Item -LiteralPath $Staged -Destination $copy -Recurse
try {
& $Mutate $copy
$refused = $false
try { & $Check $copy } catch { $refused = $true; Write-Output "refused ($Label): $($_.Exception.Message)" }
if (!$refused) { Write-Output "NOT REFUSED: $Label"; $script:failures++ }
} finally { Remove-Item -LiteralPath $copy -Recurse -Force }
}
$content = { param($p) Assert-PackageContent $p }
$secrets = { param($p) Assert-NoSecrets $p }
# Baseline: the untouched copy passes every guard.
Assert-PackageContent $Staged
Assert-NoSecrets $Staged
foreach ($binary in @('evo-client.exe', 'SDL3.dll')) { Assert-AllowedImports (Join-Path $Staged $binary) }
Expect-Refused 'extra file' { param($p) [IO.File]::WriteAllText((Join-Path $p 'notes.txt'), 'x', $utf8) } $content
Expect-Refused 'missing file' { param($p) Remove-Item -LiteralPath (Join-Path $p 'LICENSES\SDL3.txt') } $content
Expect-Refused 'checksum mismatch' { param($p) [IO.File]::AppendAllText((Join-Path $p 'README.txt'), ' ', $utf8) } $content
Expect-Refused 'credential file type' { param($p) [IO.File]::WriteAllText((Join-Path $p 'dev-ca.pem'), 'x', $utf8) } $secrets
Expect-Refused 'grant bundle file type' { param($p) [IO.File]::WriteAllBytes((Join-Path $p 'client-grants.bin'), [byte[]]::new(108)) } $secrets
Expect-Refused 'private key text' {
param($p) [IO.File]::AppendAllText((Join-Path $p 'README.txt'),
"-----BEGIN EC PRIVATE KEY-----`nMHcCAQEEIBbF0p3l9QpKl2+abcdefghijklmnopqrstuvwxyzABCDEFG`n", $utf8) } $secrets
Expect-Refused 'certificate text' {
param($p) [IO.File]::AppendAllText((Join-Path $p 'BUILD-INFO.txt'),
"-----BEGIN CERTIFICATE-----`nMIIBkTCB+wIJAKHBfpE7d1cRMA0GCSqGSIb3DQEBCwUAMBExDzANBgNVBAMM`n", $utf8) } $secrets
Expect-Refused 'user profile path' {
param($p) [IO.File]::AppendAllText((Join-Path $p 'BUILD-INFO.txt'), "C:\Users\someone\build`n", $utf8) } $secrets
if ($DynamicRuntimeImage) {
$refused = $false
try { Assert-AllowedImports $DynamicRuntimeImage } catch { $refused = $true; Write-Output "refused (dynamic runtime): $($_.Exception.Message)" }
if (!$refused) { Write-Output 'NOT REFUSED: dynamic runtime image'; $failures++ }
}
if ($failures -ne 0) { throw "$failures package guard(s) did not refuse a defect" }
Write-Output 'package guard self-test passed'
+196
View File
@@ -0,0 +1,196 @@
# M9.8e reproducible Windows x64 package of the engineering client (ADR-0086).
# Builds the client-package preset (static MSVC runtime, /Brepro) at the current
# commit, runs its client/network tests, stages an explicit allowlist with licence
# texts, build identity and SHA256SUMS, refuses credentials and profile paths, and
# writes a deterministic ZIP plus its .sha256. Publication is a separate step.
param(
[string]$OutputDirectory = '',
# Package uncommitted tracked changes; the identity is then marked "-dirty".
[switch]$AllowDirty,
# Delete build/client-package first (reproducibility checks).
[switch]$Clean
)
$ErrorActionPreference = 'Stop'
. (Join-Path $PSScriptRoot 'package-common.ps1')
$root = Split-Path -Parent (Split-Path -Parent $PSScriptRoot)
if (!$OutputDirectory) { $OutputDirectory = Join-Path $root 'build\packages' }
$utf8 = New-Object Text.UTF8Encoding $false
function Invoke-Git([string[]]$Arguments) {
$output = & git -C $root @Arguments
if ($LASTEXITCODE -ne 0) { throw "git $($Arguments -join ' ') failed" }
$output
}
function Write-Text([string]$Path, [string[]]$Lines) {
[IO.File]::WriteAllText($Path, (($Lines -join "`r`n") + "`r`n"), $utf8)
}
# Lines from the first line matching $From up to and including the first later line
# matching $To (or the end of the file when $To is empty).
function Get-Block([string]$Path, [string]$From, [string]$To = '') {
$lines = [IO.File]::ReadAllLines($Path)
$start = -1
for ($i = 0; $i -lt $lines.Length; ++$i) { if ($lines[$i] -match $From) { $start = $i; break } }
if ($start -lt 0) { throw "Notice not found in $Path" }
$end = $lines.Length - 1
if ($To) {
$end = -1
for ($i = $start; $i -lt $lines.Length; ++$i) { if ($lines[$i] -match $To) { $end = $i; break } }
if ($end -lt 0) { throw "Notice end not found in $Path" }
}
$lines[$start..$end]
}
function Read-Pin([string]$File, [string]$Name) {
$text = [IO.File]::ReadAllText((Join-Path $root "tools\$File"))
if ($text -notmatch "set\($Name `"([^`"]+)`"\)") { throw "$Name not found in $File" }
$matches[1]
}
$commit = (Invoke-Git @('rev-parse', 'HEAD')).Trim()
$dirty = [bool](Invoke-Git @('status', '--porcelain', '--untracked-files=no'))
if ($dirty -and !$AllowDirty) {
throw 'Tracked files have uncommitted changes: commit them, or pass -AllowDirty (identity marked dirty).'
}
$epoch = [long](Invoke-Git @('show', '-s', '--format=%ct', 'HEAD')).Trim()
$commitTime = [DateTimeOffset]::FromUnixTimeSeconds($epoch)
$identity = 'g' + $commit.Substring(0, 12) + $(if ($dirty) { '-dirty' } else { '' })
$name = "evo-client-windows-x64-$identity"
$build = Join-Path $root 'build\client-package'
if ($Clean -and (Test-Path -LiteralPath $build)) { Remove-Item -LiteralPath $build -Recurse -Force }
$log = Join-Path $root 'build\client-package.log'
New-Item -ItemType Directory -Force (Split-Path -Parent $log) | Out-Null
# A separate process (stderr in its own file): Windows PowerShell 5.1 would turn
# harmless native stderr lines into terminating errors here.
$check = Start-Process -FilePath 'powershell.exe' -NoNewWindow -Wait -PassThru `
-RedirectStandardOutput $log -RedirectStandardError "$log.err" -ArgumentList @(
'-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', "`"$(Join-Path $root 'tools\windows-check.ps1')`"",
'-Preset', 'client-package', '-Action', 'check', '-Define', "EVO_BUILD_IDENTITY=$identity")
if ($check.ExitCode -ne 0) { throw "Package build or tests failed; see $log and $log.err" }
$summary = Select-String -LiteralPath $log -Pattern '(\d+)% tests passed, (\d+) tests failed out of (\d+)' | Select-Object -Last 1
if (!$summary -or $summary.Matches[0].Groups[2].Value -ne '0') { throw "No passing test summary in $log" }
$tests = "client-package CTest (labels client|network): $($summary.Matches[0].Groups[3].Value) passed, 0 failed"
$exe = Join-Path $build 'evo-client.exe'
$version = (& $exe --version | Out-String).Trim()
if ($LASTEXITCODE -ne 0 -or $version -notmatch [regex]::Escape("evo-client $identity ")) {
throw "evo-client --version does not report $identity"
}
$cache = [IO.File]::ReadAllText((Join-Path $build 'CMakeCache.txt'))
if ($cache -notmatch 'CMAKE_MSVC_RUNTIME_LIBRARY:[A-Z]+=MultiThreaded\r?\n') { throw 'Package build is not using the static runtime' }
if ($cache -notmatch 'CMAKE_COMMAND:INTERNAL=(.+?)\r?\n') { throw 'CMAKE_COMMAND not in the cache' }
$cmakeVersion = ((& $matches[1] --version | Select-Object -First 1) -replace '^cmake version ', '').Trim()
$compilerFile = Get-ChildItem -LiteralPath (Join-Path $build 'CMakeFiles') -Recurse -Filter CMakeCXXCompiler.cmake | Select-Object -First 1
$compilerText = if ($compilerFile) { [IO.File]::ReadAllText($compilerFile.FullName) } else { '' }
if ($compilerText -notmatch 'set\(CMAKE_CXX_COMPILER_ID "MSVC"\)' -or
$compilerText -notmatch 'set\(CMAKE_CXX_COMPILER_VERSION "([0-9.]+)"\)') { throw 'MSVC compiler version unknown' }
$compiler = $matches[1]
$sdlVersion = Read-Pin 'sdl3-pin.cmake' 'EVO_SDL_VERSION'
$imguiVersion = Read-Pin 'imgui-pin.cmake' 'EVO_IMGUI_VERSION'
$mbedVersion = Read-Pin 'mbedtls-pin.cmake' 'EVO_MBEDTLS_VERSION'
$sdl = Join-Path $root "build\external\sdl3\SDL3-$sdlVersion"
$imgui = Join-Path $root "build\external\imgui\imgui-$imguiVersion"
$mbed = Join-Path $root "build\external\mbedtls\mbedtls-$mbedVersion"
foreach ($source in @($sdl, $imgui, $mbed)) {
if (!(Test-Path -LiteralPath (Join-Path $source 'evo-verified.sha256'))) { throw "Unverified dependency source: $source" }
}
New-Item -ItemType Directory -Force $OutputDirectory | Out-Null
$stage = Join-Path $OutputDirectory $name
if (Test-Path -LiteralPath $stage) { Remove-Item -LiteralPath $stage -Recurse -Force }
$licenses = Join-Path $stage 'LICENSES'
New-Item -ItemType Directory -Force $licenses | Out-Null
Copy-Item -LiteralPath $exe -Destination $stage
Copy-Item -LiteralPath (Join-Path $build 'SDL3.dll') -Destination $stage
Copy-Item -LiteralPath (Join-Path $PSScriptRoot 'THIRD-PARTY-NOTICES.txt') -Destination $stage
# Licence texts, copied from the verified sources (never hand-written).
Copy-Item -LiteralPath (Join-Path $sdl 'LICENSE.txt') -Destination (Join-Path $licenses 'SDL3.txt')
Write-Text (Join-Path $licenses 'SDL3-hidapi.txt') (
[IO.File]::ReadAllLines((Join-Path $sdl 'src\hidapi\LICENSE.txt')) + @('', '----', '') +
[IO.File]::ReadAllLines((Join-Path $sdl 'src\hidapi\LICENSE-bsd.txt')))
Copy-Item -LiteralPath (Join-Path $sdl 'src\video\yuv2rgb\LICENSE') -Destination (Join-Path $licenses 'SDL3-yuv2rgb.txt')
Write-Text (Join-Path $licenses 'SDL3-stb_image.txt') (
Get-Block (Join-Path $sdl 'src\video\stb_image.h') '^This software is available under 2 licenses')
$khronos = Join-Path $sdl 'src\video\khronos'
$khronosLines = @('Khronos API headers bundled with SDL (src/video/khronos).', '',
'KHR/khrplatform.h:') + (Get-Block (Join-Path $khronos 'KHR\khrplatform.h') 'Copyright \(c\) 2008' '^\*\*/$|^\*/$') +
@('', 'Vulkan, EGL and OpenGL ES headers (SPDX-License-Identifier: Apache-2.0; full text in Apache-2.0.txt):')
foreach ($header in @('vulkan\vulkan_core.h', 'EGL\egl.h', 'GLES2\gl2.h', 'GLES3\gl3.h')) {
$copyright = Select-String -LiteralPath (Join-Path $khronos $header) -Pattern 'Copyright .*Khronos' | Select-Object -First 1
if (!$copyright) { throw "No Khronos copyright in $header" }
$khronosLines += " $($header.Replace('\', '/')): $($copyright.Line.Trim(' *'))"
}
Write-Text (Join-Path $licenses 'Khronos.txt') $khronosLines
Write-Text (Join-Path $licenses 'Apache-2.0.txt') (
Get-Block (Join-Path $mbed 'LICENSE') '^\s+Apache License\s*$' 'END OF TERMS AND CONDITIONS')
Copy-Item -LiteralPath (Join-Path $mbed 'LICENSE') -Destination (Join-Path $licenses 'MbedTLS.txt')
Copy-Item -LiteralPath (Join-Path $imgui 'LICENSE.txt') -Destination (Join-Path $licenses 'DearImGui.txt')
Copy-Item -LiteralPath (Join-Path $imgui 'docs\FONTS.md') -Destination (Join-Path $licenses 'DearImGui-FONTS.md')
$draw = Join-Path $imgui 'imgui_draw.cpp'
Write-Text (Join-Path $licenses 'DearImGui-embedded-fonts.txt') (
@('Font data embedded in imgui_draw.cpp (MIT; MIT text as in DearImGui.txt):', '') +
(Get-Block $draw '^// MIT License / Copyright \(c\) 2004, 2005 Tristan Grimmer' '^// Download') + @('') +
(Get-Block $draw '^// Based on ProggyForever' '^// MIT license / Copyright'))
$stb = @()
foreach ($header in @('imstb_rectpack.h', 'imstb_textedit.h', 'imstb_truetype.h')) {
$stb += @("== $header ==") + (Get-Block (Join-Path $imgui $header) '^This software is available under 2 licenses') + @('')
}
Write-Text (Join-Path $licenses 'DearImGui-stb.txt') $stb
$readme = [IO.File]::ReadAllText((Join-Path $PSScriptRoot 'README-package.txt'))
$readme = $readme.Replace('{{IDENTITY}}', $identity).Replace('{{COMMIT}}', $commit).Replace(
'{{COMMIT_TIME}}', $commitTime.UtcDateTime.ToString('yyyy-MM-dd HH:mm:ss'))
[IO.File]::WriteAllText((Join-Path $stage 'README.txt'), $readme.Replace("`r`n", "`n").Replace("`n", "`r`n"), $utf8)
$pin = { param($file, $var) Read-Pin $file $var }
Write-Text (Join-Path $stage 'BUILD-INFO.txt') @(
"identity: $identity",
"commit: $commit",
"commit_time_utc: $($commitTime.UtcDateTime.ToString('yyyy-MM-ddTHH:mm:ssZ'))",
"dirty: $($dirty.ToString().ToLowerInvariant())",
'target: windows-x64',
'cmake_preset: client-package',
"cmake: $cmakeVersion",
"msvc_compiler: $compiler",
'msvc_runtime: MultiThreaded (static)',
'deterministic: /Brepro',
"sdl3: $sdlVersion sha256=$(& $pin 'sdl3-pin.cmake' 'EVO_SDL_SHA256')",
"dear_imgui: $imguiVersion sha256=$(& $pin 'imgui-pin.cmake' 'EVO_IMGUI_SHA256')",
"mbedtls: $mbedVersion sha256=$(& $pin 'mbedtls-pin.cmake' 'EVO_MBEDTLS_SHA256')",
"tests: $tests",
"version_output: $version")
$sums = foreach ($relative in (Get-RelativeFiles $stage)) {
"$(Get-Sha256 (Join-Path $stage $relative)) $relative"
}
[IO.File]::WriteAllText((Join-Path $stage 'SHA256SUMS.txt'), (($sums -join "`n") + "`n"), $utf8)
Assert-PackageContent $stage
Assert-NoSecrets $stage
foreach ($binary in @('evo-client.exe', 'SDL3.dll')) { Assert-AllowedImports (Join-Path $stage $binary) }
# Deterministic ZIP: sorted entries under one top folder, commit time stamps.
Add-Type -AssemblyName System.IO.Compression
$zip = Join-Path $OutputDirectory "$name.zip"
if (Test-Path -LiteralPath $zip) { Remove-Item -LiteralPath $zip -Force }
$stream = [IO.File]::Open($zip, [IO.FileMode]::CreateNew)
try {
$archive = New-Object IO.Compression.ZipArchive($stream, [IO.Compression.ZipArchiveMode]::Create)
try {
$stamp = New-Object DateTimeOffset($commitTime.UtcDateTime.Ticks, [TimeSpan]::Zero)
foreach ($relative in (Get-RelativeFiles $stage)) {
$entry = $archive.CreateEntry("$name/$relative", [IO.Compression.CompressionLevel]::Optimal)
$entry.LastWriteTime = $stamp
$out = $entry.Open()
try {
$bytes = [IO.File]::ReadAllBytes((Join-Path $stage $relative))
$out.Write($bytes, 0, $bytes.Length)
} finally { $out.Dispose() }
}
} finally { $archive.Dispose() }
} finally { $stream.Dispose() }
$zipHash = Get-Sha256 $zip
[IO.File]::WriteAllText("$zip.sha256", "$zipHash $name.zip`n", $utf8)
Write-Output "package: $zip"
Write-Output "sha256: $zipHash"
Write-Output "identity: $identity"
+74
View File
@@ -0,0 +1,74 @@
# M9.8e package verification (ADR-0086). Needs no Visual Studio: extracts the ZIP into
# a fresh directory, checks the ZIP digest, SHA256SUMS and exact content, image
# imports and credentials, then runs the client from the extracted folder with a
# minimal environment (system PATH only, settings in the scratch directory).
param(
[Parameter(Mandatory = $true)][string]$Zip,
# Also open a real window with the default video driver and renderer for 3 s.
[switch]$Interactive
)
$ErrorActionPreference = 'Stop'
. (Join-Path $PSScriptRoot 'package-common.ps1')
Add-Type -AssemblyName System.IO.Compression.FileSystem
$Zip = (Resolve-Path -LiteralPath $Zip).Path
$expected = ([IO.File]::ReadAllText("$Zip.sha256") -split '\s+')[0]
if ((Get-Sha256 $Zip) -ne $expected) { throw 'ZIP digest does not match its .sha256 file' }
$scratch = Join-Path ([IO.Path]::GetTempPath()) ("evo-package-verify-" + [Guid]::NewGuid().ToString('N'))
New-Item -ItemType Directory $scratch | Out-Null
try {
[IO.Compression.ZipFile]::ExtractToDirectory($Zip, (Join-Path $scratch 'x'))
$top = @(Get-ChildItem -LiteralPath (Join-Path $scratch 'x') -Force)
if ($top.Count -ne 1 -or !$top[0].PSIsContainer) { throw 'The ZIP must contain exactly one top-level folder' }
$folder = $top[0].FullName
Assert-PackageContent $folder
Assert-NoSecrets $folder
foreach ($binary in @('evo-client.exe', 'SDL3.dll')) { Assert-AllowedImports (Join-Path $folder $binary) }
$identity = ([IO.File]::ReadAllLines((Join-Path $folder 'BUILD-INFO.txt')) | Where-Object { $_ -like 'identity: *' }) -replace '^identity: ', ''
if ($top[0].Name -ne "evo-client-windows-x64-$identity") { throw 'Folder name does not match BUILD-INFO identity' }
# Runs the extracted client with only the Windows system directories on PATH.
$controls = Join-Path $scratch 'controls-v1.txt'
$run = {
param([string[]]$Arguments, [string]$VideoDriver, [int]$TimeoutSeconds = 60)
$info = New-Object Diagnostics.ProcessStartInfo
$info.FileName = Join-Path $folder 'evo-client.exe'
$info.Arguments = ($Arguments | ForEach-Object { '"' + $_ + '"' }) -join ' '
$info.WorkingDirectory = $scratch
$info.UseShellExecute = $false
$info.RedirectStandardOutput = $true
$info.RedirectStandardError = $true
$info.EnvironmentVariables['PATH'] = "$env:SystemRoot\System32;$env:SystemRoot"
foreach ($name in @('SDL_VIDEO_DRIVER', 'SDL_RENDER_DRIVER')) { $info.EnvironmentVariables.Remove($name) }
if ($VideoDriver) { $info.EnvironmentVariables['SDL_VIDEO_DRIVER'] = $VideoDriver }
$process = [Diagnostics.Process]::Start($info)
$stdout = $process.StandardOutput.ReadToEndAsync()
$stderr = $process.StandardError.ReadToEndAsync()
if (!$process.WaitForExit($TimeoutSeconds * 1000)) { $process.Kill(); throw "evo-client $($info.Arguments) timed out" }
[pscustomobject]@{ Code = $process.ExitCode; Out = $stdout.Result; Err = $stderr.Result }
}
$version = & $run @('--version') ''
if ($version.Code -ne 0 -or $version.Out -notmatch [regex]::Escape("evo-client $identity ") -or
$version.Out -notmatch 'remote sessions available') { throw "--version failed: $($version.Out)$($version.Err)" }
$usage = & $run @('--no-such-option') ''
if ($usage.Code -ne 2 -or $usage.Err -notmatch 'usage: evo-client') { throw 'Usage error path failed' }
$fixture = & $run @('--renderer', 'software', '--fixture', '--frames', '60', '--controls', $controls) 'dummy'
if ($fixture.Code -ne 0) { throw "Fixture run failed ($($fixture.Code)): $($fixture.Err)" }
$launcher = & $run @('--renderer', 'software', '--frames', '30', '--controls', $controls) 'dummy'
if ($launcher.Code -ne 0) { throw "Launcher run failed ($($launcher.Code)): $($launcher.Err)" }
$badCa = & $run @('--frames', '1', '--connect', '127.0.0.1:1', '--server-name', 'x', '--ca',
(Join-Path $scratch 'missing.pem'), '--grants', (Join-Path $scratch 'missing.bin'), '--controls', $controls) 'dummy'
if ($badCa.Code -ne 1 -or $badCa.Err -notmatch 'dev CA file could not be read' -or $badCa.Err -match [regex]::Escape($scratch)) {
throw 'Missing credential files must fail with fixed text and no path'
}
if ($Interactive) {
$window = & $run @('--fixture', '--frames', '180', '--controls', $controls) ''
if ($window.Code -ne 0) { throw "Interactive run failed ($($window.Code)): $($window.Err)" }
}
# Running must not write into the package folder (no ini/log/settings there).
Assert-PackageContent $folder
if (Test-Path -LiteralPath $controls) { throw 'A controls file was written without Apply' }
Write-Output "verified: $([IO.Path]::GetFileName($Zip)) ($identity)"
} finally {
Remove-Item -LiteralPath $scratch -Recurse -Force -ErrorAction SilentlyContinue
}
+6 -3
View File
@@ -1,8 +1,11 @@
param(
[ValidateSet('debug', 'release', 'analysis', 'asan', 'tsan', 'client', 'client-probe', 'network', 'client-network')]
[ValidateSet('debug', 'release', 'analysis', 'asan', 'tsan', 'client', 'client-probe', 'network', 'client-network', 'client-package')]
[string]$Preset = 'debug',
[ValidateSet('configure', 'build', 'test', 'format', 'check')]
[string]$Action = 'check'
[string]$Action = 'check',
# Extra configure-time cache entries, NAME=VALUE (e.g. EVO_BUILD_IDENTITY=g0123abcd).
[ValidatePattern('^[A-Z][A-Z0-9_]*=[0-9A-Za-z.+-]*$')]
[string[]]$Define = @()
)
$ErrorActionPreference = 'Stop'
$repositoryRoot = Split-Path -Parent $PSScriptRoot
@@ -29,7 +32,7 @@ $env:Path = ((@("$cmakeRoot\CMake\bin", "$cmakeRoot\Ninja", $llvmRoot) + $env:Pa
Push-Location -LiteralPath $repositoryRoot
try {
if ($Action -in @('configure', 'check')) {
& cmake --preset $Preset
& cmake --preset $Preset @($Define | ForEach-Object { "-D$_" })
if ($LASTEXITCODE -ne 0) { throw 'CMake configure failed' }
}
if ($Action -in @('build', 'check')) {