Files
MBN_STOCK_WEBVIEW/scripts/Test-LegacyCutCoverage.ps1

61 lines
1.7 KiB
PowerShell

#Requires -Version 5.1
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[string] $CutRoot
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
if (-not [IO.Path]::IsPathRooted($CutRoot)) {
throw 'CutRoot must be an absolute path.'
}
$root = [IO.Path]::GetFullPath($CutRoot)
if (-not (Test-Path -LiteralPath $root -PathType Container)) {
throw 'CutRoot does not identify an existing directory.'
}
# Active MainForm aliases for the 34 reachable builders. s8086 intentionally has no alias.
$aliases = @(
'5001', 'N5001', '5006', '5011', '5016', '50160',
'5023', '5024', '5025', '5026', '5029',
'8018', '8032', '5032', '5037',
'5074', '5076', '5077', '5078', '5079',
'5080', '5081', '5082', '5083', '5084', '5085',
'5086', '50860', '5087', '5088',
'6001', '6067', '8001', '8002', '8003',
'8035', '8061', '8040', '8046', '8051', '8056',
'8067', '5068', '5070', '5072'
)
$missing = [Collections.Generic.List[string]]::new()
$unsafe = [Collections.Generic.List[string]]::new()
foreach ($alias in $aliases) {
$path = Join-Path $root ($alias + '.t2s')
if (-not (Test-Path -LiteralPath $path -PathType Leaf)) {
$missing.Add($alias)
continue
}
$item = Get-Item -LiteralPath $path -Force
if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0 -or
$item.Length -le 0) {
$unsafe.Add($alias)
}
}
if ($missing.Count -ne 0 -or $unsafe.Count -ne 0) {
throw "Legacy cut coverage failed. Missing=$($missing.Count), Unsafe=$($unsafe.Count)."
}
[pscustomobject][ordered]@{
Status = 'Passed'
ReachableBuilders = 34
ActiveAliases = $aliases.Count
Missing = $missing.Count
Unsafe = $unsafe.Count
}