ci-server-engineer/examples/CI-Eng-Sample/shared/snapshot.ps1
cliu 39e58af2ff R1.05 V4: reduced CI-Eng-Sample load tested and removed on shared server
Classes, sub-items, Modbus loopback and OPC UA loopback pass on R1.05.
New examples/CI-Eng-Sample/shared/: snapshot, reduced load/remove,
test and DSS temp-file cleanup scripts for shared servers. Before/after
snapshot identical; ISS-091 (dss_*.tmp left in tls\lst); ISS-080 note.
Certificate files of the test await deletion by the user.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 19:10:26 +11:00

37 lines
2.1 KiB
PowerShell

# Read-only snapshot of everything the reduced CI-Eng-Sample test can touch.
param([string]$Out)
$ErrorActionPreference = 'Continue'
$w = New-Object System.Collections.Generic.List[string]
$tmp = Join-Path $PSScriptRoot 'snapx'
New-Item -ItemType Directory -Force -Path $tmp | Out-Null
$ds = 'SECTION_DF','ITEM_DF','SUB_ITEM_DF','ALARM_ACK_DF','ALARM_AOI_DF','ALARM_ASA_DF','TRIGGER_DF',
'CLASS_DF','OBJECT_DF','LINE_DF','STATION_DF','POINT_DF','MODBUS_LINE_DF','MODBUS_STATION_DF',
'MODBUS_SCAN_TYPE_DF','MODBUS_POINT_DF','OPCUAC_LINE_DF','OPCUAC_STATION_DF',
'OPCUAC_SUBSCRIPTION_DF','OPCUAC_POINT_DF','PRINTER_DEV_DF','PRINTER_DEST_DF','REPORT_DF',
'AUDIT_SELGRP_DF','OPCUAC_PKI_CERTIFICATES_DF'
foreach ($d in $ds) {
$f = Join-Path $tmp "$d.qlo"
$null = & dssqld -e $f -d $d -c 2>&1
$names = @()
if (Test-Path $f) { $names = @(Import-Csv $f | ForEach-Object { $_.NAME }) | Sort-Object }
$sha = [BitConverter]::ToString((New-Object Security.Cryptography.SHA256Managed).ComputeHash([Text.Encoding]::UTF8.GetBytes(($names -join "`n")))).Replace('-','').Substring(0,16)
$mine = @($names | Where-Object { $_ -match 'CIENG|CI-Eng' })
$w.Add("DS $d count=$($names.Count) hash=$sha cieng=$($mine.Count) $($mine -join ';')")
}
Remove-Item -Recurse -Force $tmp
$root = $env:TLS_ALLUSERS_PATH
foreach ($sub in 'com','sup','sav','lst') {
foreach ($i in (Get-ChildItem -Path (Join-Path $env:TLS_ROOT_PATH "tls\$sub") -File | Sort-Object Name)) {
if ($sub -eq 'lst' -or $sub -eq 'sav') { $w.Add("FILE $sub\$($i.Name)") }
else { $w.Add("FILE $sub\$($i.Name) $($i.Length) $($i.LastWriteTime.ToString('s'))") }
}
}
foreach ($i in (Get-ChildItem -Path (Join-Path $root 'pki') -Recurse -File | Sort-Object FullName)) {
$w.Add("PKI $($i.FullName.Substring($root.Length)) $($i.Length)")
}
$exe = Join-Path $env:TLS_ROOT_PATH 'tls\exe'
foreach ($g in (Get-Process | Where-Object { $_.Path -like "$exe*" } | Group-Object Name | Sort-Object Name)) {
$w.Add("PROC $($g.Name) x$($g.Count)")
}
$w | Set-Content -Encoding utf8 $Out
"snapshot: $($w.Count) lines -> $Out"