Files
lmxopcua/scripts/validation/opcua-lifecycle-memory/sdk1-comparator/launch.ps1
T
Joseph Doherty 2e9cccbdef
v2-ci / unit-tests (push) Has been cancelled
test(soak): #799 SDK 1.5.378.182 comparator for the late-slope workload
Copies the reviewed baseline-canonical SDK1 port and replaces its 1..4-cycle smoke entry with the late-slope
loop (same cycle body, every-fourth-cycle active restart, 30/25/120 s bounds, 7200 s phase, cycle-3 cold
baseline with unchanged +64 MiB managed / +128 MiB RSS / +32 descriptor caps, latched first rejection,
bounded shutdown checks). Run against the immutable efb9197a publication (#807 fix included), never rebuilt.
The held-reference closed-session list assertion is recorded instead (SDK1 Close keeps lists until Dispose,
per OWNERSHIP.md) and the managed-monotonic guard is latched, so the comparator yields numbers for the whole
phase. acceptance=false by construction. Windows descriptor observer shared byte-for-byte with the SDK2 test.

Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
2026-11-12 12:48:44 -05:00

49 lines
3.1 KiB
PowerShell

<#
.SYNOPSIS
Runs the SDK 1.5.378.182 comparator (lmxopcua#799) for 7,200 s on Windows with the same envelope as ../windows/launch.ps1:
private task directory for TEMP and fixture PKI, ephemeral fixture credential, external 30 s sampler, 7,440 s outer deadline.
#>
param(
[Parameter(Mandatory)] [string] $Bin,
[Parameter(Mandatory)] [string] $Output,
[Parameter(Mandatory)] [string] $SourceRevision
)
$ErrorActionPreference = 'Stop'
if (Test-Path $Output) { throw 'Use a fresh output directory' }
New-Item -ItemType Directory -Path $Output | Out-Null
$Output = (Resolve-Path $Output).Path
New-Item -ItemType Directory -Path (Join-Path $Output 'tmp') | Out-Null
& icacls $Output /inheritance:r /grant:r "$($env:USERNAME):(OI)(CI)F" '*S-1-5-18:(OI)(CI)F' | Out-Null
$exe = Join-Path (Resolve-Path $Bin).Path 'sdk1-comparator.exe'
$started = Get-Date
$bytes = New-Object byte[] 3; [System.Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($bytes)
$env:OTOPCUA_BASELINE_CANONICAL_KEY = 'otua_k-server-events_' + (($bytes | ForEach-Object { $_.ToString('x2') }) -join '')
$env:OTOPCUA_COMPARATOR_SOURCE = $SourceRevision
$env:TEMP = Join-Path $Output 'tmp'; $env:TMP = $env:TEMP
@{ kind = 'comparator-launch'; sourceRevision = $SourceRevision; exe = $exe
exeSha256 = (Get-FileHash -Algorithm SHA256 $exe).Hash.ToLowerInvariant()
coreClrSha256 = (Get-FileHash -Algorithm SHA256 (Join-Path (Split-Path $exe) 'coreclr.dll')).Hash.ToLowerInvariant()
startedUtc = $started.ToUniversalTime().ToString('o'); credentialBytes = $env:OTOPCUA_BASELINE_CANONICAL_KEY.Length } |
ConvertTo-Json | Set-Content -Encoding UTF8 (Join-Path $Output 'launch.json')
$psi = New-Object System.Diagnostics.ProcessStartInfo $exe
$psi.Arguments = "`"$(Join-Path $Output 'run')`" 7200 --comparator"
$psi.UseShellExecute = $false; $psi.RedirectStandardOutput = $true; $psi.RedirectStandardError = $true
$proc = [System.Diagnostics.Process]::Start($psi)
$outTask = $proc.StandardOutput.ReadToEndAsync(); $errTask = $proc.StandardError.ReadToEndAsync()
$sampler = Join-Path $Output 'external-samples.jsonl'
while (-not $proc.WaitForExit(30000)) {
$elapsed = ((Get-Date) - $started).TotalSeconds
$row = [ordered]@{ utc = (Get-Date).ToUniversalTime().ToString('o'); launcherElapsedSeconds = [math]::Round($elapsed, 1) }
try {
$p = Get-Process -Id $proc.Id -ErrorAction Stop
$row.workingSet64 = $p.WorkingSet64; $row.privateMemorySize64 = $p.PrivateMemorySize64
$row.peakWorkingSet64 = $p.PeakWorkingSet64; $row.handleCount = $p.HandleCount; $row.threads = $p.Threads.Count
} catch { $row.targetGone = $true }
($row | ConvertTo-Json -Compress) | Add-Content -Encoding UTF8 $sampler
if ($elapsed -gt 7440) { & taskkill /PID $proc.Id /T /F | Out-Null; 'outer-deadline' | Set-Content (Join-Path $Output 'launcher-outcome.txt') }
}
Set-Content -Encoding UTF8 (Join-Path $Output 'stdout.log') $outTask.Result
Set-Content -Encoding UTF8 (Join-Path $Output 'stderr.log') $errTask.Result
"$($proc.ExitCode)" | Set-Content -Encoding ASCII (Join-Path $Output 'exit-status.txt')
'done' | Add-Content (Join-Path $Output 'launcher-outcome.txt')