EvanZhu0721 / 公开仓库
SBMS
SBMS complete the calculation rules for the default logical desktop topology relationship and the physical dimensions of the displays in the Windows multi-screen collaboration system.
文件
../ build-installer-contract.Tests.ps13.0 KBinno-user-state.Tests.ps12.3 KBlaunch-entry-contract.Tests.ps18.1 KBmaintenance-compensation.Tests.ps15.3 KBprepare-upgrade.Tests.ps110.3 KBinstaller/tests/build-installer-contract.Tests.ps13.0 KB
1
$ErrorActionPreference = 'Stop'2
Set-StrictMode -Version Latest3
4
$buildScript = [IO.Path]::GetFullPath(5
(Join-Path $PSScriptRoot '..\..\build-installer.ps1')6
)7
8
Describe 'Installer build entry point contract' {9
BeforeAll {10
$script:command = Get-Command -Name $buildScript11
$script:source = [IO.File]::ReadAllText(12
$buildScript,13
[Text.Encoding]::UTF814
)15
$tokens = $null16
$parseErrors = $null17
$ast = [Management.Automation.Language.Parser]::ParseFile(18
$buildScript,19
[ref]$tokens,20
[ref]$parseErrors21
)22
@($parseErrors).Count | Should Be 023
$hashFunction = $ast.Find(24
{25
param($node)26
$node -is [Management.Automation.Language.FunctionDefinitionAst] -and27
$node.Name -eq 'Get-Sha256Hex'28
},29
$true30
)31
$hashFunction | Should Not BeNullOrEmpty32
$script:hashFunctionSource = $hashFunction.Extent.Text33
}34
35
It 'requires a certificate in the default signed release path' {36
$signed = @($script:command.ParameterSets |37
Where-Object Name -eq 'Signed')38
39
$signed.Count | Should Be 140
($signed[0].Parameters |41
Where-Object Name -eq 'SigningCertificateThumbprint').IsMandatory |42
Should Be $true43
@($signed[0].Parameters |44
Where-Object Name -eq 'Unsigned').Count | Should Be 045
}46
47
It 'keeps unsigned packaging explicit and on the full build path' {48
$unsigned = @($script:command.ParameterSets |49
Where-Object Name -eq 'Unsigned')50
51
$unsigned.Count | Should Be 152
($unsigned[0].Parameters |53
Where-Object Name -eq 'Unsigned').IsMandatory | Should Be $true54
}55
56
It 'rejects a false unsigned switch instead of weakening release signing' {57
$failure = $null58
try {59
& $buildScript -Unsigned:$false60
}61
catch {62
$failure = $_63
}64
65
$failure | Should Not BeNullOrEmpty66
$failure.Exception.Message | Should Match (67
'Unsigned packaging must be explicitly enabled'68
)69
}70
71
It 'computes SHA256 without depending on PowerShell module discovery' {72
. ([scriptblock]::Create($script:hashFunctionSource))73
$inputFile = Join-Path $TestDrive 'sha256-input.txt'74
[IO.File]::WriteAllText(75
$inputFile,76
'abc',77
[Text.UTF8Encoding]::new($false)78
)79
80
Get-Sha256Hex -LiteralPath $inputFile | Should Be (81
'BA7816BF8F01CFEA414140DE5DAE2223' +82
'B00361A396177A9CB410FF61F20015AD'83
)84
}85
86
It 'locks Rust and always runs the real driver build' {87
$script:source | Should Match (88
'(?m)cargo\.exe\s+build\s+--release\s+--bins\s+--locked'89
)90
$script:source | Should Match (91
"(?m)&\s+\(Join-Path\s+\`$repository\s+'build-driver\.ps1'\)"92
)93
}94
}95